require_once("../../config.php");
require_once("lib.php");
- $id = required_param('id',PARAM_INT);
+ $id = required_param('id',PARAM_INT);
+ $sort = optional_param('sort', '', PARAM_RAW);
if (!$record = get_record('data_records','id',$id)) {
error("rating ID was incorrect");
if (!$data = get_record('data','id',$record->dataid)) {
error("rating ID was incorrect");
}
-
- if (!isset($sort)) {
- $sort = "r.id";
+
+ switch ($sort) {
+ case 'firstname': $sqlsort = "u.firstname ASC"; break;
+ case 'rating': $sqlsort = "r.rating ASC"; break;
+ default: $sqlsort = "r.id ASC";
}
$scalemenu = make_grades_menu($data->scale);
print_header($strratings);
- if (!$ratings = data_get_ratings($record->id, $sort)) {
+ if (!$ratings = data_get_ratings($record->id, $sqlsort)) {
error("No ratings for this record!");
} else {
echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\" class=\"generalbox\" width=\"100%\">";
echo "<tr>";
echo "<th> </th>";
- echo "<th><a href=\"report.php?id=$id&sort=u.firstname\">$strname</a>";
- echo "<th width=\"100%\"><a href=\"report.php?id=$id&sort=r.rating\">$strrating</a>";
+ echo "<th><a href=\"report.php?id=$id&sort=firstname\">$strname</a>";
+ echo "<th width=\"100%\"><a href=\"report.php?id=$id&sort=rating\">$strrating</a>";
foreach ($ratings as $rating) {
if (isteacher($data->course)) {
echo '<tr class="forumpostheadertopic">';
require_once("../../config.php");
require_once("lib.php");
- $id = required_param('id',PARAM_INT);
+ $id = required_param('id',PARAM_INT);
+ $sort = optional_param('sort', '', PARAM_RAW);
if (! $post = get_record("forum_posts", "id", $id)) {
error("Post ID was incorrect");
error("You can only look at results for posts you own");
}
- if (!isset($sort)) {
- $sort = "r.time";
+ switch ($sort) {
+ case 'time': $sqlsort = "r.time ASC"; break;
+ 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);
print_header("$strratings: ".format_string($post->subject));
- if (!$ratings = forum_get_ratings($post->id, $sort)) {
+ if (!$ratings = forum_get_ratings($post->id, $sqlsort)) {
error("No ratings for this post: \"".format_string($post->subject)."\"");
} else {
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>";
+ echo "<th><a href=\"report.php?id=$post->id&sort=firstname\">$strname</a>";
+ echo "<th width=\"100%\"><a href=\"report.php?id=$post->id&sort=rating\">$strrating</a>";
+ echo "<th><a href=\"report.php?id=$post->id&sort=time\">$strtime</a>";
foreach ($ratings as $rating) {
if (isteacher($discussion->course, $rating->id)) {
echo '<tr class="forumpostheadertopic">';
require_once("../../config.php");
require_once("lib.php");
- $id = required_param('id', PARAM_INT);
- global $USER;
-
+ $id = required_param('id', PARAM_INT);
+ $sort = optional_param('sort', '', PARAM_RAW);
+
if (! $entry = get_record("glossary_entries", "id", $id)) {
error("Entry ID was incorrect");
}
error("You can only look at results for your own entries");
}
- if (!isset($sort)) {
- $sort = "r.time";
+ switch ($sort) {
+ case 'time': $sqlsort = "r.time ASC"; break;
+ case 'firstname': $sqlsort = "u.firstname ASC"; break;
+ case 'rating': $sqlsort = "r.rating ASC"; break;
+ default: $sqlsort = "r.time ASC";
}
$scalemenu = make_grades_menu($glossary->scale);
print_header("$strratings: $entry->concept");
- if (!$ratings = glossary_get_ratings($entry->id, $sort)) {
+ if (!$ratings = glossary_get_ratings($entry->id, $sqlsort)) {
error("No ratings for this entry: \"$entry->concept\"");
} else {
echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\" class=\"generalbox\" width=\"100%\">";
echo "<tr>";
echo "<th class=\"header\"> </th>";
- echo "<th class=\"header\"><a href=\"report.php?id=$entry->id&sort=u.firstname\">$strname</a></th>";
- echo "<th width=\"100%\" class=\"header\"><a href=\"report.php?id=$entry->id&sort=r.rating\">$strrating</a></th>";
- echo "<th class=\"header\"><a href=\"report.php?id=$entry->id&sort=r.time\">$strtime</a></th>";
+ echo "<th class=\"header\"><a href=\"report.php?id=$entry->id&sort=firstname\">$strname</a></th>";
+ echo "<th width=\"100%\" class=\"header\"><a href=\"report.php?id=$entry->id&sort=rating\">$strrating</a></th>";
+ echo "<th class=\"header\"><a href=\"report.php?id=$entry->id&sort=time\">$strtime</a></th>";
foreach ($ratings as $rating) {
if (isteacher($glossary->course, $rating->id)) {
echo '<tr class="teacher">';