2002-07-31 14:19:35 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
|
|
|
|
// For a given post, shows a report of all the ratings it has
|
|
|
|
|
2003-01-05 14:19:20 +00:00
|
|
|
require_once("../../config.php");
|
|
|
|
require_once("lib.php");
|
2002-07-31 14:19:35 +00:00
|
|
|
|
|
|
|
require_variable($id);
|
|
|
|
|
|
|
|
if (! $post = get_record("forum_posts", "id", $id)) {
|
|
|
|
error("Post ID was incorrect");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $discussion = get_record("forum_discussions", "id", $post->discussion)) {
|
2002-08-02 17:35:40 +00:00
|
|
|
error("Discussion ID was incorrect");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $forum = get_record("forum", "id", $discussion->forum)) {
|
2002-07-31 14:19:35 +00:00
|
|
|
error("Forum ID was incorrect");
|
|
|
|
}
|
|
|
|
|
2002-10-21 08:44:56 +00:00
|
|
|
if (! $course = get_record("course", "id", $forum->course)) {
|
|
|
|
error("Course ID was incorrect");
|
|
|
|
}
|
|
|
|
|
2002-12-23 09:39:26 +00:00
|
|
|
if (!isteacher($course->id) and $USER->id != $post->userid) {
|
2002-07-31 14:19:35 +00:00
|
|
|
error("You can only look at results for posts you own");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isset($sort)) {
|
|
|
|
$sort = "r.time";
|
|
|
|
}
|
|
|
|
|
2003-08-25 15:59:39 +00:00
|
|
|
$scalemenu = make_grades_menu($forum->scale);
|
2003-08-15 13:59:24 +00:00
|
|
|
|
|
|
|
$strratings = get_string("ratings", "forum");
|
|
|
|
$strrating = get_string("rating", "forum");
|
|
|
|
$strname = get_string("name");
|
|
|
|
$strtime = get_string("time");
|
|
|
|
|
|
|
|
print_header("$strratings: $post->subject");
|
2002-07-31 14:19:35 +00:00
|
|
|
|
2002-12-20 14:44:14 +00:00
|
|
|
if (!$ratings = forum_get_ratings($post->id, $sort)) {
|
2003-08-15 13:59:24 +00:00
|
|
|
error("No ratings for this post: \"$post->subject\"");
|
|
|
|
|
2002-07-31 14:19:35 +00:00
|
|
|
} else {
|
2003-08-15 13:59:24 +00:00
|
|
|
echo "<table border=0 cellpadding=3 cellspacing=3 class=generalbox width=100%>";
|
|
|
|
echo "<tr>";
|
|
|
|
echo "<th> </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>";
|
2002-07-31 14:19:35 +00:00
|
|
|
foreach ($ratings as $rating) {
|
|
|
|
if (isteacher($discussion->course, $rating->id)) {
|
2003-08-15 13:59:24 +00:00
|
|
|
echo "<tr bgcolor=\"$THEME->cellcontent2\">";
|
2002-07-31 14:19:35 +00:00
|
|
|
} else {
|
2003-08-15 13:59:24 +00:00
|
|
|
echo "<tr bgcolor=\"$THEME->cellcontent\">";
|
2002-07-31 14:19:35 +00:00
|
|
|
}
|
2003-08-15 13:59:24 +00:00
|
|
|
echo "<td>";
|
2002-08-02 17:35:40 +00:00
|
|
|
print_user_picture($rating->id, $forum->course, $rating->picture);
|
2003-08-15 13:59:24 +00:00
|
|
|
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";
|
2002-07-31 14:19:35 +00:00
|
|
|
}
|
2003-08-15 13:59:24 +00:00
|
|
|
echo "</table>";
|
|
|
|
echo "<br />";
|
2002-07-31 14:19:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
close_window_button();
|
|
|
|
|
|
|
|
?>
|