discussion)) { error("Discussion ID was incorrect"); } if (! $forum = get_record('forum', 'id', $discussion->forum)) { error("Forum ID was incorrect"); } if (! $course = get_record('course', 'id', $forum->course)) { error("Course ID was incorrect"); } if (! $cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) { error("Course Module ID was incorrect"); } require_login($course, false, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); if (!$forum->assessed) { error("This activity does not use ratings"); } if (!has_capability('mod/forum:viewrating', $context)) { error("You do not have the capability to view post ratings"); } if (!has_capability('mod/forum:viewanyrating', $context) and $USER->id != $post->userid) { error("You can only look at results for posts that you made"); } switch ($sort) { case 'firstname': $sqlsort = "u.firstname ASC"; break; case 'rating': $sqlsort = "r.rating ASC"; break; default: $sqlsort = "r.time ASC"; } $scalemenu = make_grades_menu($forum->scale); $strratings = get_string('ratings', 'forum'); $strrating = get_string('rating', 'forum'); $strname = get_string('name'); $strtime = get_string('time'); print_header("$strratings: ".format_string($post->subject)); if (!$ratings = forum_get_ratings($post->id, $sqlsort)) { error("No ratings for this post: \"".format_string($post->subject)."\""); } else { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; foreach ($ratings as $rating) { echo ''; echo "'; echo '"; echo '"; echo "\n"; } echo "
 id&sort=firstname\">$strnameid&sort=rating\">$strratingid&sort=time\">$strtime
"; print_user_picture($rating->id, $forum->course, $rating->picture); echo ''.fullname($rating).''.$scalemenu[$rating->rating]."'.userdate($rating->time)."
"; echo "
"; } close_window_button(); print_footer('none'); ?>