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));
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;
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',
table_column("forum", "", "maxbytes", "integer", "10", "unsigned", "0", "", "scale");
}
+ if ($oldversion < 2004010100) {
+ table_column("forum", "", "assesspublic", "integer", "4", "unsigned", "0", "", "assessed");
+ }
+
return true;
}
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',
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");
$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>";
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);
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 "| ";
}
}
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;
}
-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
}
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 ";
+ }
}
}
} 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\">";
}
$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;
<?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 ";
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 />";
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>";
$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']['#']);
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2003100600;
+$module->version = 2004010100;
$module->cron = 60;
?>