summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php48
1 files changed, 34 insertions, 14 deletions
diff --git a/index.php b/index.php
index 90a58f3..d0103da 100644
--- a/index.php
+++ b/index.php
@@ -9,7 +9,13 @@
table {
border-collapse: collapse;
}
+
tr:nth-child(even) {background-color: #f2f2f2;}
+
+.frionly {
+ background-color: #039DFF;
+}
+
</style>
<body>
@@ -17,8 +23,13 @@ tr:nth-child(even) {background-color: #f2f2f2;}
<?php
-// TODO: tidy up HTML creation
-// TODO: make it pretty
+function debug_to_console($data) {
+ $output = $data;
+ if (is_array($output))
+ $output = implode(',', $output);
+
+ echo "<script>console.log('Debug Objects: " . $output . "' );</script>";
+}
ini_set('display_errors', 1);
error_reporting(~0);
@@ -49,6 +60,11 @@ function getData($type, $route, $direction, $day) {
}
}
+// function to $stopList by $stopList['order'] using usort
+function cmp($a, $b) {
+ return $a['order'] - $b['order'];
+}
+
$servUpdates = getData('service', false, false, false);
if (isset($_GET['route'])) {
@@ -71,6 +87,10 @@ if (isset($_GET['route'])) {
echo $update . '<br>';
}
}
+
+ //print friday only gmp_legend
+ echo '<br><table align="left" border="1" cellpadding="3" style="background-color: #039DFF;"><tr><td>Friday Only</td><tr><table><br>';
+
// print timetables
foreach ($days as $day) {
if ($schedule['schedule'][$day] == 'true') {
@@ -88,30 +108,30 @@ 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");
+ $trips = getData('trips', $route, $direction, $day);
// 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 '<h3>' . ucfirst($direction) . ' | ' . $displayDay . '</h3>';
echo '<table align="left" border="1" cellpadding="3" width="100%">';
- $trips = getData('trips', $route, $direction, $day);
- // 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) {
- // TODO: don't use $rowStop if it doesn't appear in $trip
echo '<tr><td><b>' . $rowStop['stop_name'] . '</b></td>';
foreach ($trips as $trip) {
$found=False;
foreach ($trip['stops'] as $stop) {
if ($stop['stop_name'] == $rowStop['stop_name']) {
- echo '<td>' . $stop['departure_time'] . '</td>';
+ // 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 '<td class="frionly">' . $stop['departure_time'] . '</td>';
+ } else {
+ echo '<td>' . $stop['departure_time'] . '</td>';
+ }
$found=True;
}
}
@@ -122,7 +142,7 @@ if (isset($_GET['route'])) {
}
echo '</tr>';
}
- echo '</table><br><br></p>';
+ echo '</table>';
}
}
}
@@ -132,7 +152,7 @@ if (isset($_GET['route'])) {
else {
$routes = getData('routes', false, false, false);
$meta = getData('meta', false, false, false);
- if ($meta['from'] = "-- --- ----") {
+ if ($meta['from'] == '-- --- ----') {
echo '<h3>' . $meta['name']. '</h3>';
} else {
echo '<h3>' . $meta['name']. ' | ' . $meta['from'] . ' - ' . $meta['to'] . '</h3>';
@@ -141,7 +161,7 @@ else {
foreach ($servUpdates as $update) {
echo $update['content'] . '- <b>Affected Routes: </b>' . implode(", ",$update['services']) . '<br><br>';
}
- // TODO: sort routes to print in (alpha)numerical order
+ // TODO: sort routes to print in alphanumerical order
foreach ($routes as $route) {
echo '<h4><a href="index.php?route=' . $route['service_number'] . '">' . $route['service_number'] . ' - ' . $route['service_name'] . '</a></h4>';
}