Skip to content

Commit

Permalink
selliott - fixed some code to allow proper sorting of assignments bas…
Browse files Browse the repository at this point in the history
…ed on name, lastmodified, and feedback
  • Loading branch information
selliott committed Aug 23, 2003
1 parent 1f33228 commit e090160
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions mod/assignment/submissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

require_variable($id); // Assignment
optional_variable($sort, "");
optional_variable($dir, "");

$timewas = $_POST['timenow'];
$timenow = time();
Expand Down Expand Up @@ -49,7 +50,7 @@
}

/// Make some easy ways to reference submissions
if ($submissions = assignment_get_all_submissions($assignment, $sort)) {
if ($submissions = assignment_get_all_submissions($assignment, $sort, $dir)) {
foreach ($submissions as $submission) {
$submissionbyuser[$submission->userid] = $submission;
}
Expand All @@ -68,7 +69,7 @@
}

if (isset($newsubmission)) { // Get them all out again to be sure
$submissions = assignment_get_all_submissions($assignment, $sort);
$submissions = assignment_get_all_submissions($assignment, $sort, $dir);
}


Expand Down Expand Up @@ -119,7 +120,7 @@
}
}
}
$submissions = assignment_get_all_submissions($assignment,$sort);
$submissions = assignment_get_all_submissions($assignment,$sort, $dir);
add_to_log($course->id, "assignment", "update grades", "submissions.php?id=$assignment->id", "$count users");
notify(get_string("feedbackupdated", "assignment", $count));
} else {
Expand All @@ -130,9 +131,15 @@
print_simple_box_start("CENTER", "50%");
echo "<P align=\"CENTER\">";
print_string("order");
echo ": <A HREF=\"submissions.php?id=$assignment->id&sort=lastname&dir=ASC\">".get_string("name")."</a> - ";
echo "<A HREF=\"submissions.php?id=$assignment->id\">".get_string("lastmodified")."</a> - ";
echo "<A HREF=\"submissions.php?id=$assignment->id&sort=grade\">".get_string("feedback")."</a>";

if ($dir == "ASC")
$dir = "DESC";
else
$dir = "ASC";

echo ": <A HREF=\"submissions.php?id=$assignment->id&sort=lastname&dir=$dir\">".get_string("name")."</a> - ";
echo "<A HREF=\"submissions.php?id=$assignment->id&sort=timemodified&dir=$dir\">".get_string("lastmodified")."</a> - ";
echo "<A HREF=\"submissions.php?id=$assignment->id&sort=grade&dir=$dir\">".get_string("feedback")."</a>";
echo "</P>";
print_simple_box_end();
print_spacer(8,1);
Expand Down

0 comments on commit e090160

Please sign in to comment.