WARNING: BIG CHANGES!

OK, this is a big check-in with some big changes, and needs work still.

It seems relatively stable, but I need help identifying the rough patches.

1) First grading scales support.  There is a now a new table called "scale"
   that contains grading scales.  There can be site scales (course=0) and
   custom course scales.  These can be used in modules - I've only done
   forums for now but that was the hard one.  Scales can be edited via
   the new item in the course admin menu.

   There is one default scale - the connected/separate knowing one that used
   to be in forum.  To build this I pull data from the language packs
   to create one during the upgrade, or anytime a scales menu is called
   and no scales are found.

2) New roles for course creator and teachers.  I've fixed up the course
   menus and some other things but there's a lot left to do on this to
   make it all smooth.  The idea is that teachers no longer can edit courses
   unless they are also course creators.  The interface for this needs to
   be smoothed out a fair bit and I need help with this.

   The upgrade will upgrade all teachers to be creators, but will default
   the new site config "creatornewcourses" to "no", so that effectively
   these new teachers have the same privileges.

3) Simplified teacher management.  There is no longer an "assign teachers"
   and a "teacher roles" page - it's all on one page in course/teacher.html.


Phew ... time for a shower and then back into it.
This commit is contained in:
moodler 2003-08-15 13:59:24 +00:00
parent 655f2aaf2f
commit 02ebf404c8
21 changed files with 668 additions and 410 deletions

View File

@ -300,6 +300,22 @@
<?php print_string("configsecureforms") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>creatornewcourse:</td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu ($options, "creatornewcourse", $config->creatornewcourse, "", "", "");
?>
</td>
<td>
<?php print_string("configcreatornewcourse") ?>
</td>
</tr>
<tr>

View File

@ -267,7 +267,7 @@
if ($creatorediting) {
echo "<td>";
if ($adminediting) {
echo "<a title=\"$strassignteachers\" href=\"$CFG->wwwroot/$CFG->admin/teacher.php?id=$course->id\"><img".
echo "<a title=\"$strassignteachers\" href=\"$CFG->wwwroot/course/teacher.php?id=$course->id\"><img".
" src=\"$pixpath/t/user.gif\" height=11 width=11 border=0></a> ";
echo "<a title=\"$strdelete\" href=\"delete.php?id=$course->id\"><img".
" src=\"$pixpath/t/delete.gif\" height=11 width=11 border=0></a> ";
@ -311,7 +311,7 @@
} else if (isteacher($course->id)) {
echo "<td>";
echo "<a title=\"$strassignteachers\" href=\"$CFG->wwwroot/$CFG->admin/teacher.php?id=$course->id\"><img".
echo "<a title=\"$strassignteachers\" href=\"$CFG->wwwroot/course/teacher.php?id=$course->id\"><img".
" src=\"$pixpath/t/user.gif\" height=11 width=11 border=0></a> ";
}
echo "</td>";

View File

@ -66,7 +66,7 @@
add_to_log($newcourseid, "course", "new", "view.php?id=$newcourseid", "");
if (isadmin()) { // Redirect admin to add teachers
redirect("../$CFG->admin/teacher.php?id=$newcourseid", get_string("changessaved"));
redirect("teacher.php?id=$newcourseid", get_string("changessaved"));
} else { // Add current teacher and send to course

View File

@ -742,19 +742,32 @@ function print_course_admin_links($course, $width=180) {
$modpixpath = "$CFG->wwwroot/theme/$CFG->theme/pix/mod";
}
if (isteacher($course->id)) {
$adminicon[]="<img src=\"$pixpath/i/edit.gif\" height=16 width=16 alt=\"\">";
if (isediting($course->id)) {
$admindata[]="<a href=\"view.php?id=$course->id&edit=off\">".get_string("turneditingoff")."</a>";
} else {
$admindata[]="<a href=\"view.php?id=$course->id&edit=on\">".get_string("turneditingon")."</a>";
if (iscreator()) {
$adminicon[]="<img src=\"$pixpath/i/edit.gif\" height=16 width=16 alt=\"\">";
if (isediting($course->id)) {
$admindata[]="<a href=\"view.php?id=$course->id&edit=off\">".get_string("turneditingoff")."</a>";
} else {
$admindata[]="<a href=\"view.php?id=$course->id&edit=on\">".get_string("turneditingon")."</a>";
}
$admindata[]="<a href=\"edit.php?id=$course->id\">".get_string("settings")."...</a>";
$adminicon[]="<img src=\"$pixpath/i/settings.gif\" height=16 width=16 alt=\"\">";
if (!$course->teachers) {
$course->teachers = get_string("defaultcourseteachers");
}
$admindata[]="<a href=\"teacher.php?id=$course->id\">$course->teachers...</a>";
$adminicon[]="<img src=\"$pixpath/i/settings.gif\" height=16 width=16 alt=\"\">";
$admindata[]="<a href=\"$CFG->wwwroot/backup/backup.php?id=$course->id\">".get_string("backup")."...</a>";
$adminicon[]="<img src=\"$pixpath/i/backup.gif\" height=16 width=16 alt=\"\">";
//Only showed if "backupdata" dir exists
if (is_dir("$CFG->dataroot/$course->id/backupdata")) {
$admindata[]="<a href=\"$CFG->wwwroot/files/index.php?id=$course->id&wdir=/backupdata\">".get_string("restore")."...</a>";
$adminicon[]="<img src=\"$pixpath/i/restore.gif\" height=16 width=16 alt=\"\">";
}
$admindata[]="<a href=\"scales.php?id=$course->id\">".get_string("scales")."...</a>";
$adminicon[]="<img src=\"$pixpath/i/scales.gif\" height=16 width=16 alt=\"\">";
}
$admindata[]="<a href=\"edit.php?id=$course->id\">".get_string("settings")."...</a>";
$adminicon[]="<img src=\"$pixpath/i/settings.gif\" height=16 width=16 alt=\"\">";
if (!$course->teachers) {
$course->teachers = get_string("defaultcourseteachers");
}
$admindata[]="<a href=\"teachers.php?id=$course->id\">$course->teachers...</a>";
$adminicon[]="<img src=\"$pixpath/i/settings.gif\" height=16 width=16 alt=\"\">";
$admindata[]="<a href=\"grades.php?id=$course->id\">".get_string("grades")."...</a>";
$adminicon[]="<img src=\"$pixpath/i/grades.gif\" height=16 width=16 alt=\"\">";
@ -765,14 +778,6 @@ function print_course_admin_links($course, $width=180) {
$admindata[]="<a href=\"$CFG->wwwroot/files/index.php?id=$course->id\">".get_string("files")."...</a>";
$adminicon[]="<img src=\"$pixpath/i/files.gif\" height=16 width=16 alt=\"\">";
$admindata[]="<a href=\"$CFG->wwwroot/backup/backup.php?id=$course->id\">".get_string("backup")."...</a>";
$adminicon[]="<img src=\"$pixpath/i/backup.gif\" height=16 width=16 alt=\"\">";
//Only showed if "backupdata" dir exists
if (is_dir("$CFG->dataroot/$course->id/backupdata")) {
$admindata[]="<a href=\"$CFG->wwwroot/files/index.php?id=$course->id&wdir=/backupdata\">".get_string("restore")."...</a>";
$adminicon[]="<img src=\"$pixpath/i/restore.gif\" height=16 width=16 alt=\"\">";
}
$admindata[]="<a href=\"$CFG->wwwroot/doc/view.php?id=$course->id&file=teacher.html\">".get_string("help")."...</a>";
$adminicon[]="<img src=\"$modpixpath/resource/icon.gif\" height=16 width=16 alt=\"\">";

View File

@ -10,18 +10,19 @@
optional_variable($remove, "");
optional_variable($search, ""); // search string
if (! $site = get_site()) {
redirect("$CFG->wwwroot/$CFG->admin/index.php");
}
require_login();
if (!iscreator()) {
if (! $course = get_record("course", "id", $id)) {
error("Course ID was incorrect (can't find it)");
}
if (!iscreator() and isteacher($course->id)) {
error("You must be an administrator or course creator to use this page.");
}
$strassignteachers = get_string("assignteachers");
$strcourses = get_string("courses");
$strteachers = get_string("teachers");
$stradministration = get_string("administration");
$strexistingteachers = get_string("existingteachers");
$strnoexistingteachers = get_string("noexistingteachers");
@ -40,32 +41,63 @@
$searchstring = $strsearch;
}
if (! $course = get_record("course", "id", $id)) {
error("Course ID was incorrect (can't find it)");
if ($course->teachers != $strteachers) {
$parateachers = " ($course->teachers)";
} else {
$parateachers = "";
}
print_header("$site->shortname: $course->shortname: $strassignteachers",
"$site->fullname",
"<a href=\"../course/index.php\">$strcourses</a> -> ".
"<a href=\"../course/view.php?id=$course->id\">$course->fullname</a> -> ".
/// Print headers
print_header("$course->shortname: $strassignteachers",
"$course->fullname",
"<a href=\"index.php\">$strcourses</a> -> ".
"<a href=\"view.php?id=$course->id\">$course->shortname</a> -> ".
"$strassignteachers", "");
print_heading("<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname ($course->shortname)</a>");
/// If data submitted, then process and store.
if ($form = data_submitted()) {
$rank = array();
// Peel out all the data from variable names.
foreach ($form as $key => $val) {
if ($key <> "id") {
$type = substr($key,0,1);
$num = substr($key,1);
$rank[$num][$type] = $val;
}
}
foreach ($rank as $num => $vals) {
if (! $teacher = get_record("user_teachers", "course", "$course->id", "userid", "$num")) {
error("No such teacher in course $course->shortname with user id $num");
}
$teacher->role = $vals['r'];
$teacher->authority = $vals['a'];
if (!update_record("user_teachers", $teacher)) {
error("Could not update teacher entry id = $teacher->id");
}
}
redirect("teacher.php?id=$course->id", get_string("changessaved"));
}
/// Get all existing teachers for this course.
$teachers = get_course_teachers($course->id);
/// Add a teacher if one is specified
if (!empty($add)) {
if (!empty($_GET['add'])) {
if (!isteacher($course->id)){
error("You must be an administrator or teacher to modify this course.");
}
if (! $user = get_record("user", "id", $add)) {
if (! $user = get_record("user", "id", $_GET['add'])) {
error("That teacher (id = $add) doesn't exist", "teacher.php?id=$course->id");
}
@ -88,17 +120,19 @@
if (empty($teacher->id)) {
error("Could not add that teacher to this course!");
}
$user->authority = $teacher->authority;
$teachers[] = $user;
}
/// Remove a teacher if one is specified.
if (!empty($remove)) {
if (!empty($_GET['remove'])) {
if (!isteacher($course->id)){
error("You must be an administrator or teacher to modify this course.");
}
if (! $user = get_record("user", "id", $remove)) {
if (! $user = get_record("user", "id", $_GET['remove'])) {
error("That teacher (id = $remove) doesn't exist", "teacher.php?id=$course->id");
}
if (!empty($teachers)) {
@ -111,35 +145,59 @@
}
}
print_heading_with_help("$strexistingteachers $parateachers", "teachers");
/// Print the lists of existing and potential teachers
echo "<table cellpadding=2 cellspacing=10 align=center>";
echo "<tr><th width=50%>$strexistingteachers</th><th width=50%>$strpotentialteachers</th></tr>";
echo "<tr><td width=50% nowrap valign=top>";
/// First, show existing teachers for this course
if (empty($teachers)) {
if (empty($teachers)) {
echo "<p align=center>$strnoexistingteachers</a>";
$teacherlist = "";
} else {
$table->head = array ("", get_string("name"), get_string("order"), get_string("role"), "&nbsp");
$table->align = array ("right", "left", "center", "center", "center");
$table->size = array ("35", "", "", "", "");
$option[0] = get_string("hide");
for ($i=1; $i<=8; $i++) {
$option[$i] = $i;
}
$teacherarray = array();
echo "<form action=teacher.php method=post>";
foreach ($teachers as $teacher) {
$teacherarray[] = $teacher->id;
echo "<p align=right>$teacher->firstname $teacher->lastname, $teacher->email &nbsp;";
print_user_picture($teacher->id, $site->id, $teacher->picture, false, false, false);
echo "&nbsp;&nbsp;<a href=\"teacher.php?id=$course->id&remove=$teacher->id\" title=\"$strremoveteacher\"><img src=\"../pix/t/right.gif\" border=0></a></p>";
$picture = print_user_picture($teacher->id, $course->id, $teacher->picture, false, true);
$authority = choose_from_menu ($option, "a$teacher->id", $teacher->authority, "", "", "", true);
$removelink = "<a href=\"teacher.php?id=$course->id&remove=$teacher->id\">$strremoveteacher</a>";
if (!$teacher->role) {
$teacher->role = $course->teacher;
}
$table->data[] = array ($picture, "$teacher->firstname $teacher->lastname", $authority,
"<input type=text name=\"r$teacher->id\" value=\"$teacher->role\" size=30>",
$removelink);
}
$teacherlist = implode(",",$teacherarray);
unset($teacherarray);
print_table($table);
echo "<input type=hidden name=id value=\"$course->id\">";
echo "<center><input type=submit value=\"".get_string("savechanges")."\"> ";
echo "</center>";
echo "</form>";
echo "<br />";
}
echo "<td width=50% nowrap valign=top>";
/// Print list of potential teachers
print_heading("$strpotentialteachers $parateachers");
$usercount = get_users(false, $search, true, $teacherlist);
if ($usercount == 0) {
@ -158,24 +216,29 @@
error("Could not get users!");
}
unset($table);
$table->head = array ("", get_string("name"), get_string("email"), "");
$table->align = array ("right", "left", "center", "center");
$table->size = array ("35", "", "", "");
foreach ($users as $user) {
echo "<p align=left><a href=\"{$_SERVER['PHP_SELF']}?id=$course->id&add=$user->id\"".
"title=\"$straddteacher\"><img src=\"../pix/t/left.gif\"".
"border=0></a>&nbsp;&nbsp;";
print_user_picture($user->id, $site->id, $user->picture, false, false, false);
echo "&nbsp;$user->firstname $user->lastname, $user->email";
$addlink = "<a href=\"teacher.php?id=$course->id&add=$user->id\">$straddteacher</a>";
$picture = print_user_picture($user->id, $course->id, $user->picture, false, true);
$table->data[] = array ($picture, "$user->firstname $user->lastname", $user->email, $addlink);
}
print_table($table);
}
if ($search or $usercount > MAX_USERS_PER_PAGE) {
echo "<form action={$_SERVER['PHP_SELF']} method=post>";
echo "<form action=teacher.php method=post>";
echo "<input type=hidden name=id value=\"$course->id\">";
echo "<input type=text name=search size=20>";
echo "<input type=submit value=\"$searchstring\">";
echo "</form>";
}
echo "</tr></table>";
echo "</td></tr></table>";
print_footer();

View File

@ -1,92 +0,0 @@
<?PHP // $Id$
// Allows a teacher to edit teacher order and roles for a course
require_once("../config.php");
require_once("lib.php");
require_variable($id); // course id
require_login();
if (! $course = get_record("course", "id", $id)) {
error("Course ID was incorrect");
}
if (!isteacher($course->id)) {
error("Only teachers can edit the course!");
}
/// If data submitted, then process and store.
if ($form = data_submitted()) {
$rank = array();
// Peel out all the data from variable names.
foreach ($form as $key => $val) {
if ($key <> "id") {
$type = substr($key,0,1);
$num = substr($key,1);
$rank[$num][$type] = $val;
}
}
foreach ($rank as $num => $vals) {
if (! $teacher = get_record("user_teachers", "course", "$course->id", "userid", "$num")) {
error("No such teacher in course $course->shortname with user id $num");
}
$teacher->role = $vals['r'];
$teacher->authority = $vals['a'];
if (!update_record("user_teachers", $teacher)) {
error("Could not update teacher entry id = $teacher->id");
}
}
redirect("teachers.php?id=$course->id", get_string("changessaved"));
}
/// Otherwise fill and print the form.
print_header("$course->shortname: $course->teachers", "$course->fullname",
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>
-> $course->teachers");
if (!$teachers = get_course_teachers($course->id)) {
error("No teachers found in this course!");
}
print_heading($course->teachers);
$table->head = array ("", get_string("name"), get_string("order"), get_string("role"));
$table->align = array ("RIGHT", "LEFT", "CENTER", "CENTER");
$table->size = array ("35", "", "", "");
$option[0] = get_string("hide");
for ($i=1; $i<=8; $i++) {
$option[$i] = $i;
}
echo "<FORM ACTION=teachers.php METHOD=post>";
foreach ($teachers as $teacher) {
$picture = print_user_picture($teacher->id, $course->id, $teacher->picture, false, true);
$authority = choose_from_menu ($option, "a$teacher->id", $teacher->authority, "", "", "", true);
if (!$teacher->role) {
$teacher->role = $course->teacher;
}
$table->data[] = array ($picture, "$teacher->firstname $teacher->lastname", $authority,
"<INPUT TYPE=text NAME=\"r$teacher->id\" VALUE=\"$teacher->role\" SIZE=30>");
}
print_table($table);
echo "<INPUT TYPE=hidden NAME=id VALUE=\"$course->id\">";
echo "<CENTER><BR><INPUT TYPE=submit VALUE=\"".get_string("savechanges")."\"> ";
helpbutton("teachers", $course->teachers);
echo "</CENTER>";
echo "</FORM>";
print_footer($course);
?>

View File

@ -830,160 +830,6 @@ function adminlogin($username, $md5password) {
}
function get_site () {
/// Returns $course object of the top-level site.
if ( $course = get_record("course", "category", 0)) {
return $course;
} else {
return false;
}
}
function get_courses($categoryid="all", $sort="sortorder ASC", $fields="*") {
/// Returns list of courses, for whole site, or category
if ($categoryid == "all") {
$courses = get_records("course", "", "", $sort, $fields);
} else {
$courses = get_records("course", "category", "$categoryid", $sort, $fields);
}
if ($courses) { /// Remove unavailable courses from the list
foreach ($courses as $key => $course) {
if (!$course->visible) {
if (!isteacher($course->id)) {
unset($courses[$key]);
}
}
}
}
return $courses;
}
function get_my_courses($userid, $sort="c.fullname ASC") {
global $CFG;
return get_records_sql("SELECT c.*
FROM {$CFG->prefix}course c,
{$CFG->prefix}user_students s,
{$CFG->prefix}user_teachers t
WHERE (s.userid = '$userid' AND s.course = c.id)
OR (t.userid = '$userid' AND t.course = c.id)
GROUP BY c.id
ORDER BY $sort");
}
function get_courses_search($search, $sort="fullname ASC", $page=0, $recordsperpage=50) {
/// Returns a list of courses that match a search
global $CFG;
switch ($CFG->dbtype) {
case "mysql":
$limit = "LIMIT $page,$recordsperpage";
break;
case "postgres7":
$limit = "LIMIT $recordsperpage OFFSET ".($page * $recordsperpage);
break;
default:
$limit = "LIMIT $recordsperpage,$page";
}
//to allow caseinsensitive search for postgesql
if ($CFG->dbtype == "postgres7") {
$LIKE = "ILIKE";
} else {
$LIKE = "LIKE";
}
$fullnamesearch = "";
$summarysearch = "";
$searchterms = explode(" ", $search); // Search for words independently
foreach ($searchterms as $searchterm) {
if ($fullnamesearch) {
$fullnamesearch .= " AND ";
}
$fullnamesearch .= " fullname $LIKE '%$searchterm%' ";
if ($summarysearch) {
$summarysearch .= " AND ";
}
$summarysearch .= " summary $LIKE '%$searchterm%' ";
}
$courses = get_records_sql("SELECT *
FROM {$CFG->prefix}course
WHERE ($fullnamesearch OR $summarysearch)
ORDER BY $sort $limit");
if ($courses) { /// Remove unavailable courses from the list
foreach ($courses as $key => $course) {
if (!$course->visible) {
if (!isteacher($course->id)) {
unset($courses[$key]);
}
}
}
}
return $courses;
}
function get_categories($parent="none", $sort="sortorder ASC") {
/// Returns a sorted list of categories
if ($parent == "none") {
$categories = get_records("course_categories", "", "", $sort);
} else {
$categories = get_records("course_categories", "parent", $parent, $sort);
}
if ($categories) { /// Remove unavailable categories from the list
$admin = isadmin();
foreach ($categories as $key => $category) {
if (!$category->visible) {
if (!$admin) {
unset($categories[$key]);
}
}
}
}
return $categories;
}
function fix_course_sortorder($categoryid, $sort="sortorder ASC") {
/// Given a category object, this function makes sure the courseorder
/// variable reflects the real world.
if (!$courses = get_records("course", "category", "$categoryid", "$sort", "id, sortorder")) {
return true;
}
$count = 0;
$modified = false;
foreach ($courses as $course) {
if ($course->sortorder != $count) {
set_field("course", "sortorder", $count, "id", $course->id);
$modified = true;
}
$count++;
}
if ($modified) {
set_field("course_categories", "timemodified", time(), "id", $categoryid);
}
return true;
}
function get_guest() {
return get_user_info_from_db("username", "guest");
}
@ -1223,6 +1069,222 @@ function get_users_longtimenosee($cutofftime) {
}
/// OTHER SITE AND COURSE FUNCTIONS /////////////////////////////////////////////
function get_site () {
/// Returns $course object of the top-level site.
if ( $course = get_record("course", "category", 0)) {
return $course;
} else {
return false;
}
}
function get_courses($categoryid="all", $sort="sortorder ASC", $fields="*") {
/// Returns list of courses, for whole site, or category
if ($categoryid == "all") {
$courses = get_records("course", "", "", $sort, $fields);
} else {
$courses = get_records("course", "category", "$categoryid", $sort, $fields);
}
if ($courses) { /// Remove unavailable courses from the list
foreach ($courses as $key => $course) {
if (!$course->visible) {
if (!isteacher($course->id)) {
unset($courses[$key]);
}
}
}
}
return $courses;
}
function get_my_courses($userid, $sort="c.fullname ASC") {
global $CFG;
return get_records_sql("SELECT c.*
FROM {$CFG->prefix}course c,
{$CFG->prefix}user_students s,
{$CFG->prefix}user_teachers t
WHERE (s.userid = '$userid' AND s.course = c.id)
OR (t.userid = '$userid' AND t.course = c.id)
GROUP BY c.id
ORDER BY $sort");
}
function get_courses_search($search, $sort="fullname ASC", $page=0, $recordsperpage=50) {
/// Returns a list of courses that match a search
global $CFG;
switch ($CFG->dbtype) {
case "mysql":
$limit = "LIMIT $page,$recordsperpage";
break;
case "postgres7":
$limit = "LIMIT $recordsperpage OFFSET ".($page * $recordsperpage);
break;
default:
$limit = "LIMIT $recordsperpage,$page";
}
//to allow caseinsensitive search for postgesql
if ($CFG->dbtype == "postgres7") {
$LIKE = "ILIKE";
} else {
$LIKE = "LIKE";
}
$fullnamesearch = "";
$summarysearch = "";
$searchterms = explode(" ", $search); // Search for words independently
foreach ($searchterms as $searchterm) {
if ($fullnamesearch) {
$fullnamesearch .= " AND ";
}
$fullnamesearch .= " fullname $LIKE '%$searchterm%' ";
if ($summarysearch) {
$summarysearch .= " AND ";
}
$summarysearch .= " summary $LIKE '%$searchterm%' ";
}
$courses = get_records_sql("SELECT *
FROM {$CFG->prefix}course
WHERE ($fullnamesearch OR $summarysearch)
ORDER BY $sort $limit");
if ($courses) { /// Remove unavailable courses from the list
foreach ($courses as $key => $course) {
if (!$course->visible) {
if (!isteacher($course->id)) {
unset($courses[$key]);
}
}
}
}
return $courses;
}
function get_categories($parent="none", $sort="sortorder ASC") {
/// Returns a sorted list of categories
if ($parent == "none") {
$categories = get_records("course_categories", "", "", $sort);
} else {
$categories = get_records("course_categories", "parent", $parent, $sort);
}
if ($categories) { /// Remove unavailable categories from the list
$admin = isadmin();
foreach ($categories as $key => $category) {
if (!$category->visible) {
if (!$admin) {
unset($categories[$key]);
}
}
}
}
return $categories;
}
function fix_course_sortorder($categoryid, $sort="sortorder ASC") {
/// Given a category object, this function makes sure the courseorder
/// variable reflects the real world.
if (!$courses = get_records("course", "category", "$categoryid", "$sort", "id, sortorder")) {
return true;
}
$count = 0;
$modified = false;
foreach ($courses as $course) {
if ($course->sortorder != $count) {
set_field("course", "sortorder", $count, "id", $course->id);
$modified = true;
}
$count++;
}
if ($modified) {
set_field("course_categories", "timemodified", time(), "id", $categoryid);
}
return true;
}
function make_default_scale() {
/// This function creates a default separated/connected scale
/// so there's something in the database. The locations of
/// strings and files is a bit odd, but this is because we
/// need to maintain backward compatibility with many different
/// existing language translations and older sites.
global $CFG;
$defaultscale = NULL;
$defaultscale->courseid = 0;
$defaultscale->userid = 0;
$defaultscale->name = get_string("separateandconnected");
$defaultscale->scale = get_string("postrating1", "forum").",".
get_string("postrating2", "forum").",".
get_string("postrating3", "forum");
$defaultscale->timemodified = time();
/// Read in the big description from the file. Note this is not
/// HTML (despite the file extension) but Moodle format text.
$parentlang = get_string("parentlang");
if (is_readable("$CFG->dirroot/lang/$CFG->lang/help/forum/ratings.html")) {
$file = file("$CFG->dirroot/lang/$CFG->lang/help/forum/ratings.html");
} else if ($parentlang and is_readable("$CFG->dirroot/lang/$parentlang/help/forum/ratings.html")) {
$file = file("$CFG->dirroot/lang/$parentlang/help/forum/ratings.html");
} else if (is_readable("$CFG->dirroot/lang/en/help/forum/ratings.html")) {
$file = file("$CFG->dirroot/lang/en/help/forum/ratings.html");
} else {
$file = "";
}
$defaultscale->description = addslashes(implode("", $file));
if ($defaultscale->id = insert_record("scale", $defaultscale)) {
execute_sql("UPDATE {$CFG->prefix}forum SET scale = '$defaultscale->id'");
}
}
function get_scales_menu($courseid=0) {
/// Returns a menu of all available scales
/// from the site as well as the given course
global $CFG;
$sql = "SELECT id, name FROM {$CFG->prefix}scale
WHERE courseid = '0' or courseid = '$courseid'
ORDER BY courseid ASC, name ASC";
if ($scales = get_records_sql_menu("$sql")) {
return $scales;
}
make_default_scale();
return get_records_sql_menu("$sql");
}
/// MODULE FUNCTIONS /////////////////////////////////////////////////
function get_course_mods($courseid) {

View File

@ -440,6 +440,28 @@ function main_upgrade($oldversion=0) {
table_column("course", "format", "format", "varchar", "10", "", "topics");
}
if ($oldversion < 2003081500) {
print_simple_box("Some important changes have been made to how course creators work. Formerly, they could create new courses and assign teachers, and teachers could edit courses. Now, ordinary teachers can no longer edit courses - they <b>need to be a teacher of a course AND a course creator</b>. A new site-wide configuration variable allows you to choose whether to allow course creators to create new courses as well (by default this is off). <p>The following update will automatically convert all your existing teachers into course creators, to maintain backward compatibility. Make sure you look at your upgraded site carefully and understand these new changes.", "center", "50%", "$THEME->cellheading", "20", "noticebox");
$count = 0;
$errorcount = 0;
if ($teachers = get_records("user_teachers")) {
foreach ($teachers as $teacher) {
if (! record_exists("user_coursecreators", "userid", $teacher->userid)) {
$creator = NULL;
$creator->userid = $teacher->userid;
if (!insert_record("user_coursecreators", $creator)) {
$errorcount++;
} else {
$count++;
}
}
}
}
print_simple_box("$count teachers were upgraded to course creators (with $errorcount errors)", "center", "50%", "$THEME->cellheading", "20", "noticebox");
}
return $result;
}

View File

@ -7,6 +7,7 @@
"auth" => "email",
"changepassword" => true,
"country" => "",
"creatornewcourse" => false,
"debug" => 7,
"framename" => "_top",
"frontpage" => 0,

View File

@ -1584,6 +1584,17 @@ function microtime_diff($a, $b) {
return $b_sec - $a_sec + $b_dec - $a_dec;
}
function make_menu_from_list($list, $separator=",") {
/// Given a list (eg a,b,c,d,e) this function returns
/// an array of 1->a, 2->b, 3->c etc
$array = array_reverse(explode($separator, $list), true);
foreach ($array as $key => $item) {
$outarray[$key+1] = trim($item);
}
return $outarray;
}
// vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
?>

View File

@ -1273,6 +1273,41 @@ function print_time_selector($hour, $minute, $currenttime=0) {
choose_from_menu($minutes, $minute, $currentdate['minutes'], "");
}
function print_scale_menu($courseid, $name, $current) {
/// Prints a scale menu (as part of an existing form) including help button
global $CFG, $THEME;
$strscales = get_string("scales");
choose_from_menu(get_scales_menu($courseid), "$name", $current, "");
if (empty($THEME->custompix)) {
$helpicon = "$CFG->wwwroot/pix/help.gif";
} else {
$helpicon = "$CFG->wwwroot/theme/$CFG->theme/pix/help.gif";
}
$linkobject = "<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"$strscales\" src=\"$helpicon\">";
link_to_popup_window ("/course/scales.php?id=$courseid&list=true", "ratingscales",
$linkobject, 400, 500, $strscales);
}
function print_scale_menu_helpbutton($courseid, $scale) {
/// Prints a help button about a scale
/// scale is an object
global $CFG, $THEME;
$strscales = get_string("scales");
if (empty($THEME->custompix)) {
$helpicon = "$CFG->wwwroot/pix/help.gif";
} else {
$helpicon = "$CFG->wwwroot/theme/$CFG->theme/pix/help.gif";
}
$linkobject = "<img align=\"absmiddle\" border=0 height=17 width=22 alt=\"$scale->name\" src=\"$helpicon\">";
link_to_popup_window ("/course/scales.php?id=$courseid&list=true&scale=$scale->id", "ratingscale",
$linkobject, 400, 500, $scale->name);
}
function error ($message, $link="") {
global $CFG, $SESSION;

View File

@ -61,6 +61,16 @@ function forum_upgrade($oldversion) {
if ($oldversion < 2003042402) {
execute_sql("INSERT INTO {$CFG->prefix}log_display VALUES ('forum', 'move discussion', 'forum_discussions', 'name')");
}
if ($oldversion < 2003081300) {
table_column("forum", "assessed", "assessed", "integer", "10", "unsigned", "0");
table_column("forum", "", "scale", "integer", "10", "unsigned", "0", "", "assessed");
}
if ($oldversion < 2003081403) {
get_scales_menu(); /// This function will create a new default scale
}
return true;
}

View File

@ -9,7 +9,8 @@ CREATE TABLE prefix_forum (
name varchar(255) NOT NULL default '',
intro text NOT NULL,
open tinyint(2) unsigned NOT NULL default '2',
assessed tinyint(1) unsigned NOT NULL default '0',
assessed int(10) unsigned NOT NULL default '0',
scale int(10) unsigned NOT NULL default '0',
forcesubscribe tinyint(1) unsigned NOT NULL default '0',
timemodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id),

View File

@ -10,6 +10,10 @@ function forum_upgrade($oldversion) {
execute_sql("INSERT INTO {$CFG->prefix}log_display VALUES ('forum', 'move discussion', 'forum_discussions', 'name')");
}
if ($oldversion < 2003081300) {
table_column("forum", "", "scale", "integer", "10", "unsigned", "0", "", "assessed");
}
return true;
}

View File

@ -10,6 +10,7 @@ CREATE TABLE prefix_forum (
intro text NOT NULL default '',
open integer NOT NULL default '2',
assessed integer NOT NULL default '0',
scale integer NOT NULL default '0',
forcesubscribe integer NOT NULL default '0',
timemodified integer NOT NULL default '0'
);

View File

@ -89,6 +89,9 @@
"$navmiddle -> $navtail", "", "", true, $searchform, navmenu($course, $cm));
}
echo "<table width=\"100%\"><tr><td width=\"33%\">&nbsp;</td><td width=\"33%\">";
forum_print_mode_form($discussion->id, $mode);
echo "</td><td width=\"33%\">";
if (isteacher($course->id)) { // Popup menu to allow discussions to be moved to other forums
if ($forums = get_all_instances_in_course("forum", $course)) {
foreach ($forums as $courseforum) {
@ -105,6 +108,7 @@
}
}
}
echo "</td></tr></table>";
if (isset($discussionmoved)) {
notify(get_string("discussionmoved", "forum", $forum->name));

View File

@ -405,7 +405,6 @@ function forum_print_recent_instance_activity($forum, $timestart, $detail=false)
function forum_grades($forumid) {
/// Must return an array of grades, indexed by user, and a max grade.
global $FORUM_POST_RATINGS;
if (!$forum = get_record("forum", "id", $forumid)) {
return false;
@ -413,19 +412,33 @@ function forum_grades($forumid) {
if (!$forum->assessed) {
return false;
}
if (!$scale = get_record("scale", "id", $forum->scale)) {
return false;
}
$scalemenu = make_menu_from_list($scale->scale);
$currentuser = 0;
$ratingsuser = array();
if ($ratings = forum_get_user_grades($forumid)) {
foreach ($ratings as $rating) {
$u = $rating->userid;
$r = $rating->rating;
if (!isset($sumrating[$u])) {
$sumrating[$u][1] = 0;
$sumrating[$u][2] = 0;
$sumrating[$u][3] = 0;
foreach ($ratings as $rating) { // Ordered by user
if ($currentuser and $rating->userid != $currentuser) {
if (!empty($ratingsuser)) {
$return->grades[$currentuser] = forum_get_ratings_median(0, $scalemenu, $ratingsuser);
$return->grades[$currentuser] .= "<br />".forum_get_ratings_summary(0, $scalemenu, $ratingsuser);
} else {
$return->grades[$currentuser] = "";
}
$ratingsuser = array();
}
$sumrating[$u][$r]++;
$ratingsuser[] = $rating->rating;
$currentuser = $rating->userid;
}
foreach ($sumrating as $user => $rating) {
$return->grades[$user] = $rating[1]."s/".$rating[2]."/".$rating[3]."c";
if (!empty($ratingsuser)) {
$return->grades[$currentuser] = forum_get_ratings_median(0, $scalemenu, $ratingsuser);
$return->grades[$currentuser] .= "<br />".forum_get_ratings_summary(0, $scalemenu, $ratingsuser);
} else {
$return->grades[$currentuser] = "";
}
} else {
$return->grades = array();
@ -631,7 +644,8 @@ function forum_get_user_grades($forumid) {
{$CFG->prefix}forum_ratings r
WHERE d.forum = '$forumid'
AND p.discussion = d.id
AND r.post = p.id");
AND r.post = p.id
ORDER by p.userid ");
}
@ -945,7 +959,7 @@ function forum_make_mail_post(&$post, $user, $touser, $course,
}
function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link=false, $rate=false, $footer="", $highlight="") {
function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link=false, $ratings=NULL, $footer="", $highlight="") {
global $THEME, $USER, $CFG;
echo "<a name=\"$post->id\"></a>";
@ -1025,16 +1039,16 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
echo "</p>";
echo "<div align=right><p align=right>";
if ($rate && $USER->id) {
if (!empty($ratings) and !empty($USER->id)) {
if (isteacher($courseid)) {
forum_print_ratings($post->id);
forum_print_ratings_median($post->id, $ratings->scale);
if ($USER->id != $post->userid) {
forum_print_rating($post->id, $USER->id);
forum_print_rating_menu($post->id, $USER->id, $ratings->scale);
}
} else if ($USER->id == $post->userid) {
forum_print_ratings($post->id);
} else {
forum_print_rating($post->id, $USER->id);
forum_print_ratings_median($post->id, $ratings->scale);
} else if (!empty($ratings->allow) ) {
forum_print_rating_menu($post->id, $USER->id, $ratings->scale);
}
}
@ -1142,33 +1156,106 @@ function forum_shorten_post($message) {
}
function forum_print_ratings($post) {
if ($ratings = get_records("forum_ratings", "post", $post)) {
$sumrating[1] = 0;
$sumrating[2] = 0;
$sumrating[3] = 0;
foreach ($ratings as $rating) {
$sumrating[$rating->rating]++;
}
$summary = $sumrating[1]."s/".$sumrating[2]."/".$sumrating[3]."c";
function forum_print_ratings_median($postid, $scale) {
/// Print the multiple ratings on a post given to the current user by others.
/// Scale is an array of ratings
echo get_string("ratings", "forum").": ";
link_to_popup_window ("/mod/forum/report.php?id=$post", "ratings", $summary, 400, 550);
static $strrate;
if ($median = forum_get_ratings_median($postid, $scale)) {
if (empty($strratings)) {
$strratings = get_string("ratings", "forum");
}
echo "$strratings: ";
link_to_popup_window ("/mod/forum/report.php?id=$postid", "ratings", $median, 400, 600);
}
}
function forum_print_rating($post, $user) {
global $FORUM_POST_RATINGS;
if ($rating = get_record("forum_ratings", "userid", $user, "post", $post)) {
if ($FORUM_POST_RATINGS[$rating->rating]) {
echo "<FONT SIZE=-1>".get_string("youratedthis", "forum").": <FONT COLOR=green>";
echo $FORUM_POST_RATINGS[$rating->rating];
echo "</FONT></FONT>";
return;
function forum_get_ratings_median($postid, $scale, $ratings=NULL) {
/// Return the median rating of a post given to the current user by others.
/// Scale is an array of possible ratings in the scale
/// Ratings is an optional simple array of actual ratings (just integers)
if (!$ratings) {
$ratings = array();
if ($rates = get_records("forum_ratings", "post", $postid)) {
foreach ($rates as $rate) {
$ratings[] = $rate->rating;
}
}
}
choose_from_menu($FORUM_POST_RATINGS, $post, "", get_string("rate", "forum")."...");
if (!$count = count($ratings)) {
return "";
}
sort($ratings, SORT_NUMERIC);
if ($count == 1) {
return $scale[$ratings[0]]." (1)";
} else {
$median = $ratings[ceil($count/2)];
return $scale[$median]." ($count)";
}
}
function forum_get_ratings_summary($postid, $scale, $ratings=NULL) {
/// Return a summary of post ratings given to the current user by others.
/// Scale is an array of possible ratings in the scale
/// Ratings is an optional simple array of actual ratings (just integers)
if (!$ratings) {
$ratings = array();
if ($rates = get_records("forum_ratings", "post", $postid)) {
foreach ($rates as $rate) {
$rating[] = $rate->rating;
}
}
}
if (!$count = count($ratings)) {
return "";
}
foreach ($scale as $key => $scaleitem) {
$sumrating[$key] = 0;
}
foreach ($ratings as $rating) {
$sumrating[$rating]++;
}
$summary = "";
foreach ($scale as $key => $scaleitem) {
$summary = $sumrating[$key].$summary;
if ($key > 1) {
$summary = "/$summary";
}
}
return $summary;
}
function forum_print_rating_menu($postid, $userid, $scale) {
/// Print the menu of ratings as part of a larger form.
/// If the post has already been - set that value.
/// Scale is an array of ratings
static $strrate;
if (!$rating = get_record("forum_ratings", "userid", $userid, "post", $postid)) {
$rating->rating = 0;
}
if (empty($strrate)) {
$strrate = get_string("rate", "forum");
}
choose_from_menu($scale, $postid, $rating->rating, "$strrate...");
}
function forum_print_mode_form($discussion, $mode) {
@ -1772,50 +1859,49 @@ function forum_print_discussion($course, $forum, $discussion, $post, $mode) {
}
$reply = forum_user_can_post($forum);
forum_print_post($post, $course->id, $ownpost, $reply, $link=false, $rate=false);
forum_print_mode_form($discussion->id, $mode);
$ratingform = false;
$ratings = NULL;
if ($forum->assessed and !empty($USER->id)) {
$unrated = forum_count_unrated_posts($discussion->id, $USER->id);
if ($unrated > 0) {
$ratingform = true;
if ($scale = get_record("scale", "id", $forum->scale)) {
$ratings->scale = make_menu_from_list($scale->scale);
if ($forum->assessed == 2 and !isteacher($course->id)) {
$ratings->allow = false;
} else {
$ratings->allow = true;
}
echo "<form name=form method=post action=rate.php>";
echo "<input type=hidden name=id value=\"$course->id\">";
}
}
if ($ratingform) {
echo "<FORM NAME=form METHOD=POST ACTION=rate.php>";
echo "<INPUT TYPE=hidden NAME=id VALUE=\"$course->id\">";
}
forum_print_post($post, $course->id, $ownpost, $reply, $link=false, $ratings);
switch ($mode) {
case 1 : // Flat ascending
case -1 : // Flat descending
default:
echo "<UL>";
forum_print_posts_flat($post->discussion, $course->id, $mode, $forum->assessed, $reply);
echo "</UL>";
echo "<ul>";
forum_print_posts_flat($post->discussion, $course->id, $mode, $ratings, $reply);
echo "</ul>";
break;
case 2 : // Threaded
forum_print_posts_threaded($post->id, $course->id, 0, $forum->assessed, $reply);
forum_print_posts_threaded($post->id, $course->id, 0, $ratings, $reply);
break;
case 3 : // Nested
forum_print_posts_nested($post->id, $course->id, $forum->assessed, $reply);
forum_print_posts_nested($post->id, $course->id, $ratings, $reply);
break;
}
if ($ratingform) {
echo "<CENTER><P ALIGN=center><INPUT TYPE=submit VALUE=\"".get_string("sendinratings", "forum")."\">";
helpbutton("ratings", get_string("separateandconnected"), "forum");
echo "</P></CENTER>";
echo "</FORM>";
if ($ratings) {
echo "<center><input type=\"submit\" value=\"".get_string("sendinratings", "forum")."\">";
print_scale_menu_helpbutton($course->id, $scale);
echo "</center>";
echo "</form>";
}
}
function forum_print_posts_flat($discussion, $course, $direction, $assessed, $reply) {
function forum_print_posts_flat($discussion, $course, $direction, $ratings, $reply) {
global $USER;
$link = false;
@ -1829,14 +1915,14 @@ function forum_print_posts_flat($discussion, $course, $direction, $assessed, $re
if ($posts = forum_get_discussion_posts($discussion, $sort)) {
foreach ($posts as $post) {
$ownpost = ($USER->id == $post->userid);
forum_print_post($post, $course, $ownpost, $reply, $link, $assessed);
forum_print_post($post, $course, $ownpost, $reply, $link, $ratings);
}
} else {
return;
}
}
function forum_print_posts_threaded($parent, $course, $depth, $assessed, $reply) {
function forum_print_posts_threaded($parent, $course, $depth, $ratings, $reply) {
global $USER;
$link = false;
@ -1847,7 +1933,7 @@ function forum_print_posts_threaded($parent, $course, $depth, $assessed, $reply)
echo "<ul>";
if ($depth > 0) {
$ownpost = ($USER->id == $post->userid);
forum_print_post($post, $course, $ownpost, $reply, $link, $assessed); // link=true?
forum_print_post($post, $course, $ownpost, $reply, $link, $ratings); // link=true?
echo "<br />";
} else {
$by->name = "$post->firstname $post->lastname";
@ -1857,7 +1943,7 @@ function forum_print_posts_threaded($parent, $course, $depth, $assessed, $reply)
echo "</font></p></li>";
}
forum_print_posts_threaded($post->id, $course, $depth-1, $assessed, $reply);
forum_print_posts_threaded($post->id, $course, $depth-1, $ratings, $reply);
echo "</ul>\n";
}
} else {
@ -1865,7 +1951,7 @@ function forum_print_posts_threaded($parent, $course, $depth, $assessed, $reply)
}
}
function forum_print_posts_nested($parent, $course, $assessed, $reply) {
function forum_print_posts_nested($parent, $course, $ratings, $reply) {
global $USER;
$link = false;
@ -1880,9 +1966,9 @@ function forum_print_posts_nested($parent, $course, $assessed, $reply) {
}
echo "<UL>";
forum_print_post($post, $course, $ownpost, $reply, $link, $assessed);
forum_print_post($post, $course, $ownpost, $reply, $link, $ratings);
echo "<BR>";
forum_print_posts_nested($post->id, $course, $assessed, $reply);
forum_print_posts_nested($post->id, $course, $ratings, $reply);
echo "</UL>\n";
}
} else {

View File

@ -75,19 +75,29 @@
<?php
choose_from_menu($FORUM_OPEN_MODES, "open", $form->open, "");
helpbutton("allowdiscussions", get_string("allowdiscussions",
"forum", strtolower("$course->student")), "forum");
"forum", moodle_strtolower("$course->student")), "forum");
?>
</td>
</tr>
<tr>
<td align=right><p><b><?php print_string("allowratings", "forum") ?>:</b></p></td>
<td align=right valign=top><p><b><?php print_string("allowratings", "forum") ?>:</b></p></td>
<td>
<?php
$options[0] = get_string("no");
$options[1] = get_string("yes");
// The odd order below was to maintain backward compatibility
unset($options);
$options[0] = get_string("ratingno", "forum");
$options[2] = get_string("ratingonlyteachers", "forum", moodle_strtolower($course->teachers));
$options[1] = get_string("ratingeveryone", "forum");
choose_from_menu($options, "assessed", $form->assessed, "");
helpbutton("ratings", get_string("allowratings", "forum"), "forum");
echo "<p><b>";
print_string("scale");
echo ":</b> ";
print_scale_menu($course->id, "scale", $form->scale);
echo "</p>";
?>
</td>
</tr>
@ -95,6 +105,9 @@
<td align=right><p><b><?php print_string("forcesubscribeq", "forum") ?>:</b></p></td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu($options, "forcesubscribe", $form->forcesubscribe, "");
helpbutton("subscription", get_string("forcesubscribeq", "forum"), "forum");
?>

View File

@ -24,20 +24,24 @@
if ($post == "id") {
continue;
}
if ($rating) {
if (record_exists("forum_ratings", "userid", $USER->id, "post", $post)) {
error("You've rated this question before ($post)");
} else {
unset($newrating);
$newrating->userid = $USER->id;
$newrating->time = time();
$newrating->post = $post;
$newrating->rating = $rating;
if (! insert_record("forum_ratings", $newrating)) {
error("Could not insert a new rating ($post = $rating)");
if ($oldrating = get_record("forum_ratings", "userid", $USER->id, "post", $post)) {
if ($rating != $oldrating->rating) {
$oldrating->rating = $rating;
$oldrating->time = time();
if (! update_record("forum_ratings", $oldrating)) {
error("Could not update an old rating ($post = $rating)");
}
}
} else if ($rating) {
unset($newrating);
$newrating->userid = $USER->id;
$newrating->time = time();
$newrating->post = $post;
$newrating->rating = $rating;
if (! insert_record("forum_ratings", $newrating)) {
error("Could not insert a new rating ($post = $rating)");
}
}
}
redirect($_SERVER["HTTP_REFERER"], get_string("ratingssaved", "forum"));

View File

@ -31,32 +31,44 @@
$sort = "r.time";
}
print_header("Ratings for: $post->subject");
if (!$scale = get_record("scale", "id", $forum->scale)) {
error("Scale not found!");
}
$scalemenu = make_menu_from_list($scale->scale);
$strratings = get_string("ratings", "forum");
$strrating = get_string("rating", "forum");
$strname = get_string("name");
$strtime = get_string("time");
print_header("$strratings: $post->subject");
if (!$ratings = forum_get_ratings($post->id, $sort)) {
echo "No ratings for this post: \"$post->subject\"";
die;
error("No ratings for this post: \"$post->subject\"");
} else {
echo "<TABLE BORDER=0 CELLPADDING=3>";
echo "<TR>";
echo "<TH>&nbsp;</TH>";
echo "<TH><A HREF=report.php?id=$post->id&sort=u.firstname>Name</A>";
echo "<TH><A HREF=report.php?id=$post->id&sort=r.rating>Rating</A>";
echo "<TH><A HREF=report.php?id=$post->id&sort=r.time>Date</A>";
echo "<table border=0 cellpadding=3 cellspacing=3 class=generalbox width=100%>";
echo "<tr>";
echo "<th>&nbsp;</th>";
echo "<th><a href=report.php?id=$post->id&sort=u.firstname>$strname</a>";
echo "<th width=100%><a href=report.php?id=$post->id&sort=r.rating>$strrating</a>";
echo "<th><a href=report.php?id=$post->id&sort=r.time>$strtime</a>";
foreach ($ratings as $rating) {
if (isteacher($discussion->course, $rating->id)) {
echo "<TR BGCOLOR=\"$THEME->cellcontent2\">";
echo "<tr bgcolor=\"$THEME->cellcontent2\">";
} else {
echo "<TR BGCOLOR=\"$THEME->cellcontent\">";
echo "<tr bgcolor=\"$THEME->cellcontent\">";
}
echo "<TD>";
echo "<td>";
print_user_picture($rating->id, $forum->course, $rating->picture);
echo "<TD NOWRAP><P><FONT SIZE=-1>$rating->firstname $rating->lastname</P>";
echo "<TD NOWRAP><P><FONT SIZE=-1>".$FORUM_POST_RATINGS[$rating->rating]."</P>";
echo "<TD NOWRAP><P><FONT SIZE=-1>".userdate($rating->time)."</P>";
echo "</TR>\n";
echo "<td nowrap><p><font size=-1>$rating->firstname $rating->lastname</p>";
echo "<td nowrap align=center><p><font size=-1>".$scalemenu[$rating->rating]."</p>";
echo "<td nowrap align=center><p><font size=-1>".userdate($rating->time)."</p>";
echo "</tr>\n";
}
echo "</TABLE>";
echo "</table>";
echo "<br />";
}
close_window_button();

View File

@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2003042402;
$module->version = 2003081403;
$module->cron = 60;
?>