hasPermission($project)) throw new Exception("You do not have permission to access this page."); $page_title = $project->name; Core::addBreadcrumb("/account", "Account"); Core::addBreadcrumb("/account/projects", "Projects"); Core::addBreadcrumb("/account/projects/$project->id", $page_title); Core::addScript("public/js/app-project.js"); $completed_percentage = $project->getCompletedPercentage(); $customer = $project->getCustomer(); $locations = $customer->getLocations(); $tests = $project->getTests(); usort($tests, function($a, $b) { return $a->status <=> $b->status; }); $created_test_count = count($tests); $pending_verification_tests = array_filter($tests, function($test) { return $test->status == Test::STATUS_PENDING_VERIFICATION; }); $pending_verification_test_count = count($pending_verification_tests); $completed_tests = array_filter($tests, function($test) { return $test->status == Test::STATUS_COMPLETED; }); $completed_test_count = count($completed_tests); $min_lat = $min_lng = 180; $max_lat = $max_lng = -180; foreach($locations as $location) { if($location->latitude < $min_lat) $min_lat = $location->latitude; if($location->latitude > $max_lat) $max_lat = $location->latitude; if($location->longitude < $min_lng) $min_lng = $location->longitude; if($location->longitude > $max_lng) $max_lng = $location->longitude; } $latitude = ($min_lat + $max_lat) / 2; $longitude = ($min_lng + $max_lng) / 2; $deadline_date = explode(" ", $project->dts_deadline)[0]; View::includeOnce("header", compact("page_title")); View::include("project", compact("project", "tests", "latitude", "longitude", "completed_percentage", "customer", "locations", "deadline_date", "created_test_count", "completed_test_count")); View::includeOnce("footer"); ?>