| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- /**
- * @var int $customer_id
- */
- $customers = Core::$user->getCustomers();
- if(!$customers) {
- throw new RuntimeException(__("An unexpected error has occurred. Please try again later."));
- }
- $customer_ids = array_column($customers, "id");
- if(!in_array($customer_id, $customer_ids)) {
- throw new RuntimeException(__("You do not have permission to access this page."));
- }
- $customer = Customer::get($customer_id);
- $projects = $customer->getProjects();
- $projects = array_filter($projects, static function(Project $project) {
- return $project->isFinished();
- });
- $test_results_url = $customer->getTestResultsUrl();
- $page_title = $customer->name;
- Core::addBreadcrumb("/account", __("Account"));
- Core::addBreadcrumb("/account/test-results", __("Test Results"));
- Core::addBreadcrumb($test_results_url, $customer->name);
- Core::addScript("public/js/app-test-results-project-list.js");
- View::includeOnce("header", compact("page_title"));
- View::include("test_results_project_list", compact("projects"));
- View::includeOnce("footer");
|