location_view.php 986 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. $location = Location::get($id);
  3. if(!$location) throw new Exception("Location not found.");
  4. if(!Core::$user->hasPermission($location)) throw new Exception("You do not have permission to access this page.");
  5. $page_title = $location->name;
  6. Core::addBreadcrumb("/account", "Account");
  7. Core::addBreadcrumb("/account/locations", "Locations");
  8. Core::addBreadcrumb("/account/locations/$location->id", $page_title);
  9. $status_constraint = new Constraint("BETWEEN");
  10. $status_constraint->setValues(Test::STATUS_ASSIGNED, Test::STATUS_PENDING_VERIFICATION);
  11. $pending_tests = Test::query([
  12. "location_id" => $location->id,
  13. "status" => $status_constraint,
  14. ], [
  15. "sort" => "id",
  16. "order" => "desc",
  17. ]);
  18. $completed_tests = Test::query([
  19. "location_id" => $location->id,
  20. "status" => Test::STATUS_COMPLETED,
  21. ], [
  22. "sort" => "dts_end",
  23. "order" => "desc",
  24. ]);
  25. View::includeOnce("header", compact("page_title"));
  26. View::include("location", compact("location"));
  27. View::includeOnce("footer");
  28. ?>