| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- $location = Location::get($id);
- if(!$location) throw new Exception("Location not found.");
- if(!Core::$user->hasPermission($location)) throw new Exception("You do not have permission to access this page.");
- $page_title = $location->name;
- Core::addBreadcrumb("/account", "Account");
- Core::addBreadcrumb("/account/locations", "Locations");
- Core::addBreadcrumb("/account/locations/$location->id", $page_title);
- $status_constraint = new Constraint("BETWEEN");
- if(Core::$user->level >= User::LEVEL_ADMIN) {
- $status_constraint->setValues(Test::STATUS_UNASSIGNED, Test::STATUS_COMPLETED);
- }
- else {
- $status_constraint->setValues(Test::STATUS_COMPLETED, Test::STATUS_COMPLETED);
- }
- $tests = Test::query([
- "location_id" => $location->id,
- "status" => $status_constraint,
- ], [
- "sort" => "status",
- "order" => "asc",
- ]);
- $projects = Project::load(array_column($tests, "project_id"));
- View::includeOnce("header", compact("page_title"));
- View::include("location", compact("location", "tests"));
- View::includeOnce("footer");
- ?>
|