diff options
author | ars <asav1410@gmail.com> | 2020-10-06 18:49:33 +0100 |
---|---|---|
committer | ars <asav1410@gmail.com> | 2020-10-06 18:49:33 +0100 |
commit | f2711b492d8a0fff64764b489ed55547b3755c50 (patch) | |
tree | fbf3957f5cbdffb1263f2015b984eb1995ef11c0 /index.php | |
parent | 623a1b1bf78494c983e33611199f1a1bca648017 (diff) |
Remove duplicate Source? hyperlink. Fix displaying of timetable dates of service if not received from API. Sort bus stops by order rather than displaying in the order received from API
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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>'; |