|
|
@@ -31,7 +31,21 @@ if($user->level >= User::LEVEL_ADMIN) {
|
|
|
$filter_count = count($nvp);
|
|
|
if(!$filter_count) $filter_count = "";
|
|
|
|
|
|
- $tests = Test::query($nvp, ["sort" => "status"]);
|
|
|
+ $sort = http::value("sort");
|
|
|
+ switch($sort) {
|
|
|
+ case "updated":
|
|
|
+ $query_options = ["sort" => "dts_updated", "order" => "desc"];
|
|
|
+ break;
|
|
|
+ case "due":
|
|
|
+ $query_options = ["sort" => "dts_due", "order" => "desc"];
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $sort = "status";
|
|
|
+ $query_options = ["sort" => "status", "order" => "asc"];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ $tests = Test::query($nvp, $query_options);
|
|
|
$test_count = count($tests);
|
|
|
|
|
|
$page_count = ceil($test_count / $page_size);
|
|
|
@@ -56,8 +70,14 @@ if($user->level >= User::LEVEL_ADMIN) {
|
|
|
|
|
|
$pagination_string = "Showing $item_number_first-$item_number_last of $test_count tests";
|
|
|
|
|
|
+ $sorts = [
|
|
|
+ "status" => "Status",
|
|
|
+ "updated" => "Update",
|
|
|
+ "due" => "Due",
|
|
|
+ ];
|
|
|
+
|
|
|
View::includeOnce("header", compact("page_title"));
|
|
|
- View::include("test_list", compact("tests", "test_count", "pagination_string", "projects", "project_id", "location_id", "test_id", "filter_count", "status"));
|
|
|
+ View::include("test_list", compact("tests", "test_count", "sort", "sorts", "pagination_string", "projects", "project_id", "location_id", "test_id", "filter_count", "status"));
|
|
|
}
|
|
|
|
|
|
// HQ / Venue (view completed tests)
|