| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- $page_title = "Tests";
- Core::addBreadcrumb("/account", "Account");
- Core::addBreadcrumb("/account/tests", $page_title);
- $user = Core::$user;
- // Admin / Super Admin
- if($user->level >= User::LEVEL_ADMIN) {
- $status = http::value("status", "int");
- $project_id = http::value("project_id", "int");
- $location_id = http::value("location_id", "int");
- $test_id = http::value("test_id", "int");
- $nvp = [];
- if($status) $nvp["status"] = $status;
- if($project_id) $nvp["project_id"] = $project_id;
- if($location_id) $nvp["location_id"] = $location_id;
- if($test_id) $nvp["id"] = $test_id;
- $filter_count = count($nvp);
- if(!$filter_count) $filter_count = "";
- $tests = Test::query($nvp, ["sort" => "status"]);
- $testers = User::load(array_column($tests, "tester_id"));
- $projects = Project::load(array_column($tests, "project_id"));
- usort($projects, function($a, $b) {
- return $a->name <=> $b->name;
- });
- View::includeOnce("header", compact("page_title"));
- View::include("test_list", compact("tests", "projects", "project_id", "location_id", "test_id", "filter_count", "status"));
- View::includeOnce("footer");
- }
- // HQ / Venue (view completed tests)
- else if($user->level >= User::LEVEL_VENUE) {
- //$testers = User::load(array_column($tests, "tester_id"));
- View::includeOnce("header", compact("page_title"));
- View::include("test_list_completed", compact("tests"));
- View::includeOnce("footer");
- }
- // Tester
- else if($user->level == User::LEVEL_TESTER) {
- $tests = $user->getPendingTests();
- $testers = User::load(array_column($tests, "tester_id"));
- View::includeOnce("header", compact("page_title"));
- View::include("test_list_assigned", compact("tests"));
- View::includeOnce("footer");
- }
- ?>
|