dts_start . " UTC")))[0]; $date_start_parts = explode("-", $date_start); $date_deadline = explode(" ", date("Y-m-d H:i:s", strtotime($project->dts_deadline . " UTC")))[0]; $date_deadline_parts = explode("-", $date_deadline); $date_report_parts = [0, 0, 0]; if($project->dts_report) { $date_report = explode(" ", date("Y-m-d H:i:s", strtotime($project->dts_report . " UTC")))[0]; $date_report_parts = explode("-", $date_report); } $time_of_day_options = [ "A" => "Anytime", "D" => "Daytime", "N" => "Night", ]; $name_readonly = $project->id ? "" : "readonly"; $autogen_checked = $project->id ? "" : "checked"; $tests = []; if($project->id) { $tests = $project->getTests(); $location_test = []; foreach($tests as $test) { $location_test[$test->location_id] = $test; } } $selected_locations = array_filter($locations, function(Location $l) use ($location_ids) { return in_array($l->id, $location_ids); }); $deselected_locations = array_filter($locations, function(Location $l) use ($location_ids) { return !in_array($l->id, $location_ids); }); $output_locations = function(array $locations, bool $selected) use ($location_test) { foreach($locations as $location) { $address = $location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]); $filter_parts = array_filter([ $address, $location->name ]); $filter = strtolower(implode("", $filter_parts)); $button_class = $selected ? "danger" : "success"; $button_text = $selected ? "Deselect" : "Select"; $icon = $selected ? "times" : "check"; $test = $location_test[$location->id] ?? null; $test_status = $test_class = ""; if($test) { $test_status = $test->getStatusText(); $test_class = $test->getStatusClass(); } ?>