New option to allow students to see aggregate ratings on other posts (anonymous)

This commit is contained in:
moodler 2004-01-01 04:48:55 +00:00
parent e097165541
commit 3bd98ad4bc
9 changed files with 54 additions and 25 deletions

View File

@ -51,6 +51,7 @@
fwrite ($bf,full_tag("INTRO",4,false,$forum->intro));
fwrite ($bf,full_tag("OPEN",4,false,$forum->open));
fwrite ($bf,full_tag("ASSESSED",4,false,$forum->assessed));
fwrite ($bf,full_tag("ASSESSPUBLIC",4,false,$forum->assesspublic));
fwrite ($bf,full_tag("ASSESSTIMESTART",4,false,$forum->assesstimestart));
fwrite ($bf,full_tag("ASSESSTIMEFINISH",4,false,$forum->assesstimefinish));
fwrite ($bf,full_tag("MAXBYTES",4,false,$forum->maxbytes));

View File

@ -79,6 +79,10 @@ function forum_upgrade($oldversion) {
if ($oldversion < 2003100600) {
table_column("forum", "", "maxbytes", "integer", "10", "unsigned", "0", "", "scale");
}
if ($oldversion < 2004010100) {
table_column("forum", "", "assesspublic", "integer", "4", "unsigned", "0", "", "assessed");
}
return true;

View File

@ -10,6 +10,7 @@ CREATE TABLE prefix_forum (
intro text NOT NULL,
open tinyint(2) unsigned NOT NULL default '2',
assessed int(10) unsigned NOT NULL default '0',
assesspublic int(4) unsigned NOT NULL default '0',
assesstimestart int(10) unsigned NOT NULL default '0',
assesstimefinish int(10) unsigned NOT NULL default '0',
scale int(10) NOT NULL default '0',

View File

@ -23,6 +23,10 @@ function forum_upgrade($oldversion) {
table_column("forum", "", "maxbytes", "integer", "10", "unsigned", "0", "", "scale");
}
if ($oldversion < 2004010100) {
table_column("forum", "", "assesspublic", "integer", "4", "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',
assesspublic integer NOT NULL default '0',
assesstimestart integer NOT NULL default '0',
assesstimefinish integer NOT NULL default '0',
scale integer NOT NULL default '0',

View File

@ -1098,7 +1098,7 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
global $THEME, $USER, $CFG;
static $stredit, $strdelete, $strreply, $strparent, $threadedmode;
static $stredit, $strdelete, $strreply, $strparent, $threadedmode, $isteacher;
if (empty($stredit)) {
$stredit = get_string("edit", "forum");
@ -1106,6 +1106,7 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
$strreply = get_string("reply", "forum");
$strparent = get_string("parent", "forum");
$threadedmode = (!empty($USER->mode) and ($USER->mode == FORUM_MODE_THREADED));
$isteacher = isteacher($courseid);
}
echo "<a name=\"$post->id\"></a>";
@ -1128,7 +1129,7 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
echo "<font size=3><b>$post->subject</b></font><br \>";
echo "<font size=2>";
$fullname = fullname($post, isteacher($courseid));
$fullname = fullname($post, $isteacher);
$by->name = "<a href=\"$CFG->wwwroot/user/view.php?id=$post->userid&course=$courseid\">$fullname</a>";
$by->date = userdate($post->modified);
print_string("bynameondate", "forum", $by);
@ -1185,7 +1186,7 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
echo "<a href=\"$CFG->wwwroot/mod/forum/post.php?edit=$post->id\">$stredit</a> | ";
}
}
if ($ownpost or isteacher($courseid)) {
if ($ownpost or $isteacher) {
echo "<a href=\"$CFG->wwwroot/mod/forum/post.php?delete=$post->id\">$strdelete</a>";
if ($reply) {
echo "| ";
@ -1210,14 +1211,16 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
}
}
if ($useratings) {
if (isteacher($courseid)) {
forum_print_ratings_mean($post->id, $ratings->scale);
if ($USER->id != $post->userid) {
forum_print_rating_menu($post->id, $USER->id, $ratings->scale);
$ratingsmenuused = true;
}
} else if ($USER->id == $post->userid) {
forum_print_ratings_mean($post->id, $ratings->scale);
$mypost = ($USER->id == $post->userid);
if (($isteacher or $ratings->assesspublic) and !$mypost) {
forum_print_ratings_mean($post->id, $ratings->scale, $isteacher);
forum_print_rating_menu($post->id, $USER->id, $ratings->scale);
$ratingsmenuused = true;
} else if ($mypost) {
forum_print_ratings_mean($post->id, $ratings->scale, true);
} else if (!empty($ratings->allow) ) {
forum_print_rating_menu($post->id, $USER->id, $ratings->scale);
$ratingsmenuused = true;
@ -1335,7 +1338,7 @@ function forum_shorten_post($message) {
}
function forum_print_ratings_mean($postid, $scale) {
function forum_print_ratings_mean($postid, $scale, $link=true) {
/// Print the multiple ratings on a post given to the current user by others.
/// Scale is an array of ratings
@ -1350,7 +1353,11 @@ function forum_print_ratings_mean($postid, $scale) {
}
echo "$strratings: ";
link_to_popup_window ("/mod/forum/report.php?id=$postid", "ratings", $mean, 400, 600);
if ($link) {
link_to_popup_window ("/mod/forum/report.php?id=$postid", "ratings", $mean, 400, 600);
} else {
echo "$mean ";
}
}
}
@ -2089,19 +2096,17 @@ function forum_print_discussion($course, $forum, $discussion, $post, $mode) {
} else {
$ownpost = false;
}
$reply = forum_user_can_post($forum);
$reply = forum_user_can_post($forum);
$ratings = NULL;
$ratingsmenuused = false;
if ($forum->assessed and !empty($USER->id)) {
if ($ratings->scale = make_grades_menu($forum->scale)) {
$ratings->assesspublic = $forum->assesspublic;
$ratings->assesstimestart = $forum->assesstimestart;
$ratings->assesstimefinish = $forum->assesstimefinish;
if ($forum->assessed == 2 and !isteacher($course->id)) {
$ratings->allow = false;
} else {
$ratings->allow = true;
}
$ratings->allow = ($forum->assessed != 2 or isteacher($course->id));
echo "<form name=form method=post action=rate.php>";
echo "<input type=hidden name=id value=\"$course->id\">";
}

View File

@ -12,10 +12,13 @@
$form->open = 2;
}
if (!isset($form->assessed)) {
$form->assessed = "";
$form->assessed = 0;
}
if (!isset($form->assesspublic)) {
$form->assesspublic = 0;
}
if (!isset($form->forcesubscribe)) {
$form->forcesubscribe = "";
$form->forcesubscribe = 0;
}
if (!isset($form->maxbytes)) {
$form->maxbytes = $CFG->forum_maxbytes;
@ -112,9 +115,10 @@
<?php
echo "<script>";
echo " var subitemstime = ['startday','startmonth','startyear','starthour', 'startminute',".
"'finishday','finishmonth','finishyear','finishhour','finishminute'];";
echo " var subitemsall = ['assessed', 'ratingtime', 'scale', 'startday','startmonth','startyear','starthour', 'startminute',".
"'finishday','finishmonth','finishyear','finishhour','finishminute'];";
"'finishday','finishmonth','finishyear','finishhour','finishminute'];";
echo " var subitemsall = ['assessed', 'assesspublic', 'ratingtime', 'scale', ".
"'startday','startmonth','startyear','starthour', 'startminute',".
"'finishday','finishmonth','finishyear','finishhour','finishminute'];";
echo "</script>";
echo "<input name=\"userating\" type=checkbox value=1 ";
@ -134,6 +138,13 @@
choose_from_menu($options, "assessed", $form->assessed, "");
echo "<br />";
unset($options);
$options[0] = get_string("ratingpublicnot", "forum", $course->students);
$options[1] = get_string("ratingpublic", "forum", $course->students);
echo get_string("view").":";
choose_from_menu($options, "assesspublic", $form->assesspublic, "");
echo "<br />";
echo get_string("grade").":";
print_grade_menu($course->id, "scale", $form->scale, false);
echo "<br />";
@ -159,6 +170,7 @@
echo "</td></tr></table>";
echo "<input type=\"hidden\" name=\"hratingtime\" value=0>";
echo "<input type=\"hidden\" name=\"hassessed\" value=0>";
echo "<input type=\"hidden\" name=\"hassesspublic\" value=0>";
echo "<input type=\"hidden\" name=\"hscale\" value=0>";
echo "<input type=\"hidden\" name=\"hstartday\" value=0>";
echo "<input type=\"hidden\" name=\"hstartmonth\" value=0>";

View File

@ -54,6 +54,7 @@
$forum->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
$forum->open = backup_todb($info['MOD']['#']['OPEN']['0']['#']);
$forum->assessed = backup_todb($info['MOD']['#']['ASSESSED']['0']['#']);
$forum->assesspublic = backup_todb($info['MOD']['#']['ASSESSPUBLIC']['0']['#']);
$forum->assesstimestart = backup_todb($info['MOD']['#']['ASSESSTIMESTART']['0']['#']);
$forum->assesstimefinish = backup_todb($info['MOD']['#']['ASSESSTIMEFINISH']['0']['#']);
$forum->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']);

View File

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