function get_route_metadata($route) { $metadata = Array(); $metadata['route_id'] = $route; $metadata['title'] = ShuttleSchedule::get_title($route); $metadata['interval'] = ShuttleSchedule::get_interval($route) / 60; $metadata['isSafeRide'] = ShuttleSchedule::is_safe_ride($route); $metadata['isRunning'] = ShuttleSchedule::is_running($route); $metadata['summary'] = ShuttleSchedule::get_summary($route); return $metadata; }
$route = $_REQUEST['route']; if (!in_array($route, ShuttleSchedule::get_active_routes())) { $routeName = ucwords(str_replace('_', ' ', $_REQUEST['route'])); $not_found_text = '<p>The route ' . $routeName . ' is not currently in service. Please update your bookmarks accordingly. For more information see the <a href="help.php">help page</a>.</p>'; $page->prepare_error_page('Shuttle Schedule', 'shuttle', $not_found_text); } else { $now = time(); $routeName = ShuttleSchedule::get_title($route); $interval = ShuttleSchedule::get_interval($route); $loop_time = $interval / 60; $summary = ShuttleSchedule::get_summary($route); if ($page->branch != 'Basic') { // format: 9:05AM -> 9:05<span class="ampm">AM</span> $summary = preg_replace('/(\\d)(AM|PM)/', '$1<span class="ampm">$2</span>', $summary); } $gps_active = ShuttleSchedule::is_running($route) && NextBusReader::gps_active($route); $stops = list_stop_times($route, $now, $gps_active); $upcoming_stops = array(); foreach ($stops as $index => $stop) { if ($stop['upcoming']) { $upcoming_stops[] = $index; } } // determine size of route map to display on each device switch ($page->branch) { case 'Webkit': $size = 270; break; case 'Touch': $size = 200; break;