summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/index.php b/index.php
index 392dedf..90a58f3 100644
--- a/index.php
+++ b/index.php
@@ -14,7 +14,6 @@ tr:nth-child(even) {background-color: #f2f2f2;}
<body>
<h2>bus.of.je | Liberty Bus Timetables</h2>
-<br><a href="https://www.blatech.co.uk/ars/bus.of.je">source?</a>
<?php
@@ -89,15 +88,20 @@ if (isset($_GET['route'])) {
default:
break;
}
+ // function to $stopList by $stopList['order'] using usort
+ function cmp($a, $b) {
+ return $a['order'] - $b['order'];
+ }
foreach ($directions as $direction) {
if ($schedule['directions'][$direction] == 'true') {
$stopList = getData('stoplist', $route, $direction, false);
+ // usort to sort stoplist
+ usort($stopList,"cmp");
// print timetable info while setting display friendly case for directions
// TODO: add linebreaks between end of table and next table title
echo '<p><br><b>' . ucfirst($direction) . ' | ' . $displayDay . '</b>';
echo '<table align="left" border="1" cellpadding="3" width="100%">';
$trips = getData('trips', $route, $direction, $day);
- // TODO: sort $stopList by $stopList['order']
// TODO: must be a more efficient way to search for $rowStop['stop_name'] in $trip?
// search for $stopList['stop_name'] in each trip and print time in row on table
foreach ($stopList as $rowStop) {
@@ -128,7 +132,11 @@ if (isset($_GET['route'])) {
else {
$routes = getData('routes', false, false, false);
$meta = getData('meta', false, false, false);
- echo '<h3>' . $meta['name']. ' | ' . $meta['from'] . ' - ' . $meta['to'] . '</h3>';
+ if ($meta['from'] = "-- --- ----") {
+ echo '<h3>' . $meta['name']. '</h3>';
+ } else {
+ echo '<h3>' . $meta['name']. ' | ' . $meta['from'] . ' - ' . $meta['to'] . '</h3>';
+ }
echo '<h4>Service Updates:</h4><p>';
foreach ($servUpdates as $update) {
echo $update['content'] . '- <b>Affected Routes: </b>' . implode(", ",$update['services']) . '<br><br>';