bus.of.je | Liberty Bus Timetables

Home'; $route = $_GET['route']; $days = array('mon_fri', 'sat', 'sun'); $directions = array('outbound', 'inbound'); $schedule = getData('schedule', $route, false, false); $routeUpdates = array(); echo '

'. $schedule['service_number'] . ' - ' . $schedule['service_name'] . '

'; // print service updates for current timetable foreach ($servUpdates as $update) { if (in_array($route, $update['services'])) { array_push($routeUpdates, $update['content']); } } if (!empty($routeUpdates)) { echo '

Service Updates:

'; foreach ($routeUpdates as $update) { echo $update . '
'; } } //print friday only gmp_legend echo '
Friday Only
'; // print timetables foreach ($days as $day) { if ($schedule['schedule'][$day] == 'true') { // set display friendly variables for days switch ($day) { case "mon_fri": $displayDay = "Mon - Fri"; break; case "sat": $displayDay = "Saturday"; break; case "sun": $displayDay = "Sunday"; break; default: break; } foreach ($directions as $direction) { if ($schedule['directions'][$direction] == 'true') { $stopList = getData('stoplist', $route, $direction, false); // usort to sort stoplist usort($stopList, "cmp"); $trips = getData('trips', $route, $direction, $day); // print timetable info while setting display friendly case for directions echo ' '; echo '

' . ucfirst($direction) . ' | ' . $displayDay . '

'; echo '
'; // search for $stopList['stop_name'] in each trip and print time in row on table foreach ($stopList as $rowStop) { echo ''; foreach ($trips as $trip) { $found=false; foreach ($trip['stops'] as $stop) { if ($stop['stop_name'] == $rowStop['stop_name']) { // check if bus runs on friday only by checking another day (in this case thursday) and apply custom color to cells if (($day == 'mon_fri') && ($trip['days_of_operation']['mon'] == false)) { echo ''; } else { echo ''; } $found=true; } } // print something to show bus doesn't use this stop on this trip e.g. route variation if ($found != true) { echo ''; } } echo ''; } echo '
' . $rowStop['stop_name'] . '' . $stop['departure_time'] . '' . $stop['departure_time'] . '----
'; } } } } } // print landing page if no route is selected else { $routes = getData('routes', false, false, false); // sort $routes uksort($routes, 'strnatcmp'); $meta = getData('meta', false, false, false); if ($meta['from'] == '-- --- ----') { echo '

' . $meta['name']. '

'; } else { echo '

' . $meta['name']. ' | ' . $meta['from'] . ' - ' . $meta['to'] . '

'; } if (!empty($routeUpdates)) { echo '

Service Updates:

'; foreach ($servUpdates as $update) { echo $update['content'] . '- Affected Routes: ' . implode(", ", $update['services']) . '

'; } } foreach ($routes as $route) { echo '

' . $route['service_number'] . ' - ' . $route['service_name'] . '

'; } echo '

'; } ?> source?