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 " | id&sort=firstname\">$strname | "; echo "id&sort=rating\">$strrating | "; echo "id&sort=time\">$strtime | "; echo "
---|---|---|---|
"; print_user_picture($rating->id, $forum->course, $rating->picture); echo ' | '.fullname($rating).' | '; echo ''.$scalemenu[$rating->rating]." | "; echo ''.userdate($rating->time)." | "; echo "