<?php | <?php |
/* | /* |
* Copyright 2010,2011 Alexander Sadleir | * Copyright 2010,2011 Alexander Sadleir |
Licensed under the Apache License, Version 2.0 (the "License"); | Licensed under the Apache License, Version 2.0 (the "License"); |
you may not use this file except in compliance with the License. | you may not use this file except in compliance with the License. |
You may obtain a copy of the License at | You may obtain a copy of the License at |
http://www.apache.org/licenses/LICENSE-2.0 | http://www.apache.org/licenses/LICENSE-2.0 |
Unless required by applicable law or agreed to in writing, software | Unless required by applicable law or agreed to in writing, software |
distributed under the License is distributed on an "AS IS" BASIS, | distributed under the License is distributed on an "AS IS" BASIS, |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
See the License for the specific language governing permissions and | See the License for the specific language governing permissions and |
limitations under the License. | limitations under the License. |
*/ | */ |
include ('include/common.inc.php'); | include ('include/common.inc.php'); |
include_header("About", "about") | include_header("About", "about") |
?> | ?> |
<p> | <p> |
Busness Time - An ACT bus timetable webapp<br /> | Busness Time - An ACT bus timetable webapp<br /> |
Based on the maxious-canberra-transit-feed (<a | Based on the maxious-canberra-transit-feed (<a |
href="http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip">download</a>, | href="http://s3-ap-southeast-1.amazonaws.com/busresources/cbrfeed.zip">download</a>, |
last updated <?php echo date("F d Y.", @filemtime('cbrfeed.zip')); ?>)<br /> | last updated <?php echo date("F d Y.", @filemtime('cbrfeed.zip')); ?>)<br /> |
Source code for the <a | Source code for the <a |
href="https://github.com/maxious/ACTBus-data">transit | href="https://github.com/maxious/ACTBus-data">transit |
feed</a> and <a href="https://github.com/maxious/ACTBus-ui">this | feed</a> and <a href="https://github.com/maxious/ACTBus-ui">this |
site</a> available from github.<br /> | site</a> available from github.<br /> |
Uses jQuery Mobile, PHP, PostgreSQL, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service<br /> | Uses jQuery Mobile, PHP, PostgreSQL, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service<br /> |
Suburb Geocoding Based on <A href="http://www.abs.gov.au/AUSSTATS/abs@.nsf/Lookup/1270.0.55.003Main+Features1July%202011?OpenDocument">Australian Bureau of Statistics data.</a><br /> | Suburb Geocoding Based on <A href="http://www.abs.gov.au/AUSSTATS/abs@.nsf/Lookup/1270.0.55.003Main+Features1July%202011?OpenDocument">Australian Bureau of Statistics data.</a><br /> |
Street geocoding based on work by OpenStreetMap contributors<br> | Street geocoding based on work by OpenStreetMap contributors<br> |
<br /> | <br /> |
Feedback encouraged; contact maxious@lambdacomplex.org<br /> | Feedback encouraged; contact maxious@lambdacomplex.org<br /> |
<br /> | <br /> |
Some icons by Joseph Wain / glyphish.com<br /> | Some icons by Joseph Wain / glyphish.com<br /> |
Native clients also available for iPhone(<a href="http://itunes.apple.com/au/app/cbrtimetable/id444287349?mt=8">cbrTimetable by Sandor Kolotenko</a> | Native clients also available for iPhone(<a href="http://itunes.apple.com/au/app/cbrtimetable/id444287349?mt=8">cbrTimetable by Sandor Kolotenko</a> |
, <a href="http://itunes.apple.com/au/app/act-buses/id376634797?mt=8">ACT Buses by David Sullivan</a>) | , <a href="http://itunes.apple.com/au/app/act-buses/id376634797?mt=8">ACT Buses by David Sullivan</a>, <a href="http://itunes.apple.com/app/bus-trips-act/id489146525?mt=8">Bus Trips ACT by Molson Chengalath</a>) |
, Android (<a href="https://market.android.com/details?id=com.action">MyBus 2.0 by Imagine Team</a>, <A href="https://market.android.com/details?id=GetMe2CanberraFree.source">GetMe2 Canberra by | , Android (<a href="https://market.android.com/details?id=com.action">MyBus 2.0 by Imagine Team</a>, <A href="https://market.android.com/details?id=GetMe2CanberraFree.source">GetMe2 Canberra by |
Colin Thompson </a>) | Colin Thompson </a>) |
and Windows Phone 7 (<a href="http://www.windowsphone.com/en-AU/apps/d840375e-429c-4aa4-a358-80eec6ea9e66">TransHub Canberra by Soul Solutions</a>) Other web clients include <a href="http://canberra.itranzit.com/option.html">iTranzit</a>. | and Windows Phone 7 (<a href="http://www.windowsphone.com/en-AU/apps/d840375e-429c-4aa4-a358-80eec6ea9e66">TransHub Canberra by Soul Solutions</a>) Other web clients include <a href="http://canberra.itranzit.com/option.html">iTranzit</a>. |
<br /> | <br /> |
GTFS-realtime API: | GTFS-realtime API: |
Alerts and Trip Updates (but only Cancelled or Stop Skipped) | Alerts and Trip Updates (but only Cancelled or Stop Skipped) |
Default format binary Protocol Buffer but can get JSON by adding ?ascii=yes | Default format binary Protocol Buffer but can get JSON by adding ?ascii=yes |
<br /> | <br /> |
<br /> | <br /> |
<small>Disclaimer: The content of this website is of a general and informative nature. Please check with printed timetables or those available on http://action.act.gov.au before your trip. | <small>Disclaimer: The content of this website is of a general and informative nature. Please check with printed timetables or those available on http://action.act.gov.au before your trip. |
Whilst every effort has been made to ensure the high quality and accuracy of the Site, the Author makes no warranty, | Whilst every effort has been made to ensure the high quality and accuracy of the Site, the Author makes no warranty, |
express or implied concerning the topicality, correctness, completeness or quality of the information, which is provided | express or implied concerning the topicality, correctness, completeness or quality of the information, which is provided |
"as is". The Author expressly disclaims all warranties, including but not limited to warranties of fitness for a particular purpose and warranties of merchantability. | "as is". The Author expressly disclaims all warranties, including but not limited to warranties of fitness for a particular purpose and warranties of merchantability. |
All offers are not binding and without obligation. The Author expressly reserves the right, in his discretion, to suspend, | All offers are not binding and without obligation. The Author expressly reserves the right, in his discretion, to suspend, |
change, modify, add or remove portions of the Site and to restrict or terminate the use and accessibility of the Site | change, modify, add or remove portions of the Site and to restrict or terminate the use and accessibility of the Site |
without prior notice. </small> | without prior notice. </small> |
<?php | <?php |
include_footer(); | include_footer(); |
?> | ?> |
<?php | <?php |
/* | /* |
* Copyright 2010,2011 Alexander Sadleir | * Copyright 2010,2011 Alexander Sadleir |
Licensed under the Apache License, Version 2.0 (the "License"); | Licensed under the Apache License, Version 2.0 (the "License"); |
you may not use this file except in compliance with the License. | you may not use this file except in compliance with the License. |
You may obtain a copy of the License at | You may obtain a copy of the License at |
http://www.apache.org/licenses/LICENSE-2.0 | http://www.apache.org/licenses/LICENSE-2.0 |
Unless required by applicable law or agreed to in writing, software | Unless required by applicable law or agreed to in writing, software |
distributed under the License is distributed on an "AS IS" BASIS, | distributed under the License is distributed on an "AS IS" BASIS, |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
See the License for the specific language governing permissions and | See the License for the specific language governing permissions and |
limitations under the License. | limitations under the License. |
*/ | */ |
// you have to open the session to be able to modify or remove it | // you have to open the session to be able to modify or remove it |
session_start(); | session_start(); |
if (isset($_REQUEST['geolocate']) && $_REQUEST['geolocate'] != "Enter co-ordinates or address here") { | if (isset($_REQUEST['geolocate']) && $_REQUEST['geolocate'] != "Enter co-ordinates or address here") { |
$geocoded = false; | $geocoded = false; |
if (isset($_REQUEST['lat']) && isset($_REQUEST['lon'])) { | if (isset($_REQUEST['lat']) && isset($_REQUEST['lon'])) { |
$_SESSION['lat'] = trim(filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); | $_SESSION['lat'] = trim(filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); |
$_SESSION['lon'] = trim(filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); | $_SESSION['lon'] = trim(filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); |
} else { | } else { |
if (startsWith($geolocate, "-")) { | if (startsWith($geolocate, "-")) { |
$locateparts = explode(",", $geolocate); | $locateparts = explode(",", $geolocate); |
$_SESSION['lat'] = $locateparts[0]; | $_SESSION['lat'] = $locateparts[0]; |
$_SESSION['lon'] = $locateparts[1]; | $_SESSION['lon'] = $locateparts[1]; |
} else if (strpos($geolocate, "(") !== false) { | } else if (strpos($geolocate, "(") !== false) { |
$geoParts = explode("(", $geolocate); | $geoParts = explode("(", $geolocate); |
$locateparts = explode(",", str_replace(")", "", $geoParts[1])); | $locateparts = explode(",", str_replace(")", "", $geoParts[1])); |
$_SESSION['lat'] = $locateparts[0]; | $_SESSION['lat'] = $locateparts[0]; |
$_SESSION['lon'] = $locateparts[1]; | $_SESSION['lon'] = $locateparts[1]; |
} else { | } else { |
$contents = geocode($geolocate, true); | $contents = geocode($geolocate, true); |
print_r($contents); | print_r($contents); |
if (isset($contents[0]->centroid)) { | if (isset($contents[0]->centroid)) { |
$geocoded = true; | $geocoded = true; |
$_SESSION['lat'] = $contents[0]->centroid->coordinates[0]; | $_SESSION['lat'] = $contents[0]->centroid->coordinates[0]; |
$_SESSION['lon'] = $contents[0]->centroid->coordinates[1]; | $_SESSION['lon'] = $contents[0]->centroid->coordinates[1]; |
} else { | } else { |
$_SESSION['lat'] = ""; | $_SESSION['lat'] = ""; |
$_SESSION['lon'] = ""; | $_SESSION['lon'] = ""; |
} | } |
} | } |
} | } |
sessionUpdated(); | sessionUpdated(); |
} | } |
function sessionUpdated() { | function sessionUpdated() { |
$_SESSION['lastUpdated'] = time(); | $_SESSION['lastUpdated'] = time(); |
} | } |
// timeoutSession | // timeoutSession |
$TIMEOUT_LIMIT = 60 * 5; // 5 minutes | $TIMEOUT_LIMIT = 60 * 5; // 5 minutes |
if (isset($_SESSION['lastUpdated']) && $_SESSION['lastUpdated'] + $TIMEOUT_LIMIT < time()) { | if (isset($_SESSION['lastUpdated']) && $_SESSION['lastUpdated'] + $TIMEOUT_LIMIT < time()) { |
debug("Session timeout " . ($_SESSION['lastUpdated'] + $TIMEOUT_LIMIT) . ">" . time(), "session"); | debug("Session timeout " . ($_SESSION['lastUpdated'] + $TIMEOUT_LIMIT) . ">" . time(), "session"); |
session_destroy(); | session_destroy(); |
session_start(); | session_start(); |
} | } |
//debug(print_r($_SESSION, true) , "session"); | //debug(print_r($_SESSION, true) , "session"); |
function current_time($time = "") { | function current_time($time = "") { |
if ($_REQUEST['time']) return $_REQUEST['time']; | if (isset($_REQUEST['time'])) return $_REQUEST['time']; |
else if ($time != "") date("H:i:s",$time); | else if ($time != "") date("H:i:s",$time); |
else return date("H:i:s"); | else return date("H:i:s"); |
} | } |
?> | ?> |
<?php | <?php |
/* | /* |
* Copyright 2010,2011 Alexander Sadleir | * Copyright 2010,2011 Alexander Sadleir |
Licensed under the Apache License, Version 2.0 (the "License"); | Licensed under the Apache License, Version 2.0 (the "License"); |
you may not use this file except in compliance with the License. | you may not use this file except in compliance with the License. |
You may obtain a copy of the License at | You may obtain a copy of the License at |
http://www.apache.org/licenses/LICENSE-2.0 | http://www.apache.org/licenses/LICENSE-2.0 |
Unless required by applicable law or agreed to in writing, software | Unless required by applicable law or agreed to in writing, software |
distributed under the License is distributed on an "AS IS" BASIS, | distributed under the License is distributed on an "AS IS" BASIS, |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
See the License for the specific language governing permissions and | See the License for the specific language governing permissions and |
limitations under the License. | limitations under the License. |
*/ | */ |
function getRoute($routeID) { | function getRoute($routeID) { |
global $conn; | global $conn; |
$query = "Select * from routes where route_id = :routeID LIMIT 1"; | $query = "Select * from routes where route_id = :routeID LIMIT 1"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":routeID", $routeID); | $query->bindParam(":routeID", $routeID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetch(PDO :: FETCH_ASSOC); | return $query->fetch(PDO :: FETCH_ASSOC); |
} | } |
function getRoutesByShortName($routeShortName) { | function getRoutesByShortName($routeShortName) { |
global $conn; | global $conn; |
$query = "Select distinct route_id, route_short_name from routes where route_short_name = :routeShortName"; | $query = "Select distinct route_id, route_short_name from routes where route_short_name = :routeShortName"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":routeShortName", $routeShortName); | $query->bindParam(":routeShortName", $routeShortName); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getRouteHeadsigns($routeID) { | function getRouteHeadsigns($routeID) { |
global $conn; | global $conn; |
$query = "select stops.stop_name, trip_headsign, direction_id,max(service_id) as service_id, count(*) | $query = "select stops.stop_name, trip_headsign, direction_id,max(service_id) as service_id, count(*) |
from routes join trips on trips.route_id = routes.route_id | from routes join trips on trips.route_id = routes.route_id |
join stop_times on stop_times.trip_id = trips.trip_id join stops on | join stop_times on stop_times.trip_id = trips.trip_id join stops on |
stop_times.stop_id = stops.stop_id where trips.route_id = :routeID | stop_times.stop_id = stops.stop_id where trips.route_id = :routeID |
and stop_times.stop_sequence = 1 group by stops.stop_name, trip_headsign, direction_id having count(*) > 2"; | and stop_times.stop_sequence = 1 group by stops.stop_name, trip_headsign, direction_id having count(*) > 2"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":routeID", $routeID); | $query->bindParam(":routeID", $routeID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getRouteDescription($routeID, $directionID) { | function getRouteDescription($routeID, $directionID) { |
$trip = getRouteNextTrip($routeID, $directionID); | $trip = getRouteNextTrip($routeID, $directionID); |
$start = getTripStartingPoint($trip['trip_id']); | $start = getTripStartingPoint($trip['trip_id']); |
$end = getTripDestination($trip['trip_id']); | $end = getTripDestination($trip['trip_id']); |
return "From ".$start['stop_name']." to ".$end['stop_name']; | return "From ".$start['stop_name']." to ".$end['stop_name']; |
} | } |
function getRouteByFullName($routeFullName) { | function getRouteByFullName($routeFullName) { |
global $conn; | global $conn; |
$query = "Select * from routes where route_short_name||route_long_name = :routeFullName LIMIT 1"; | $query = "Select * from routes where route_short_name||route_long_name = :routeFullName LIMIT 1"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":routeFullName", $routeFullName); | $query->bindParam(":routeFullName", $routeFullName); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetch(PDO :: FETCH_ASSOC); | return $query->fetch(PDO :: FETCH_ASSOC); |
} | } |
function getRoutes() { | function getRoutes() { |
global $conn; | global $conn; |
$query = "Select * from routes order by route_short_name;"; | $query = "Select * from routes order by route_short_name;"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getRoutesByNumberSeries($routeNumberSeries = "") { | function getRoutesByNumberSeries($routeNumberSeries = "") { |
global $conn; | global $conn; |
if (strlen($routeNumberSeries) == 1) { | if (strlen($routeNumberSeries) == 1) { |
return getRoutesByNumber($routeNumberSeries); | return getRoutesByNumber($routeNumberSeries); |
} | } |
$seriesMin = substr($routeNumberSeries, 0, -1) . "0"; | $seriesMin = substr($routeNumberSeries, 0, -1) . "0"; |
$seriesMax = substr($routeNumberSeries, 0, -1) . "9"; | $seriesMax = substr($routeNumberSeries, 0, -1) . "9"; |
$query = "Select distinct routes.route_id,routes.route_short_name,routes.route_long_name,service_id from routes join trips on trips.route_id = | $query = "Select distinct routes.route_id,routes.route_short_name,routes.route_long_name,service_id from routes join trips on trips.route_id = |
routes.route_id join stop_times on stop_times.trip_id = trips.trip_id where to_number(route_short_name, 'FM999') between :seriesMin and :seriesMax OR route_short_name LIKE :routeNumberSeries order by route_short_name;"; | routes.route_id join stop_times on stop_times.trip_id = trips.trip_id where to_number(route_short_name, 'FM999') between :seriesMin and :seriesMax OR route_short_name LIKE :routeNumberSeries order by route_short_name;"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":seriesMin", $seriesMin); | $query->bindParam(":seriesMin", $seriesMin); |
$query->bindParam(":seriesMax", $seriesMax); | $query->bindParam(":seriesMax", $seriesMax); |
$routeNumberSeries = "% " . substr($routeNumberSeries, 0, -1) . "%"; | $routeNumberSeries = "% " . substr($routeNumberSeries, 0, -1) . "%"; |
$query->bindParam(":routeNumberSeries", $routeNumberSeries); | $query->bindParam(":routeNumberSeries", $routeNumberSeries); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
return $query->fetchAll(); | return $query->fetchAll(); |
} | } |
function getRouteNextTrip($routeID, $directionID) { | function getRouteNextTrip($routeID, $directionID) { |
global $conn; | global $conn; |
$query = "select routes.route_id,direction_id,trips.trip_id,trip_headsign,departure_time from routes join trips on trips.route_id = routes.route_id | $query = "select routes.route_id,direction_id,trips.trip_id,trip_headsign,departure_time from routes join trips on trips.route_id = routes.route_id |
join stop_times on stop_times.trip_id = trips.trip_id where arrival_time between :currentTime and :futureTime | join stop_times on stop_times.trip_id = trips.trip_id where arrival_time between :currentTime and :futureTime |
and routes.route_id = :routeID and trips.direction_id = :directionID order by | and routes.route_id = :routeID and trips.direction_id = :directionID order by |
arrival_time limit 1"; | arrival_time limit 1"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":currentTime", current_time()); | $query->bindParam(":currentTime", current_time()); |
$futureTime = current_time(strtotime(current_time() ." +2h")); | $futureTime = current_time(strtotime(current_time() ." +2h")); |
if (date("h",strtotime(current_time()) > 22)) $futureTime = "23:59:59"; | if (date("h",strtotime(current_time()) > 22)) $futureTime = "23:59:59"; |
$query->bindParam(":futureTime", $futureTime); | $query->bindParam(":futureTime", $futureTime); |
$query->bindParam(":routeID", $routeID); | $query->bindParam(":routeID", $routeID); |
$query->bindParam(":directionID", $directionID); | $query->bindParam(":directionID", $directionID); |
$query->execute(); | $query->execute(); |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
$r = $query->fetch(PDO :: FETCH_ASSOC); | $r = $query->fetch(PDO :: FETCH_ASSOC); |
return $r; | return $r; |
} | } |
function getRouteFirstTrip($routeID,$directionID) { | function getRouteFirstTrip($routeID,$directionID) { |
global $conn; | global $conn; |
$query = "select * from routes join trips on trips.route_id = routes.route_id | $query = "select * from routes join trips on trips.route_id = routes.route_id |
join stop_times on stop_times.trip_id = trips.trip_id where routes.route_id = :routeID | join stop_times on stop_times.trip_id = trips.trip_id where routes.route_id = :routeID |
and trips.direction_id = :directionID order by | and trips.direction_id = :directionID order by |
arrival_time DESC limit 1"; | arrival_time DESC limit 1"; |
debug($query, "database"); | debug($query, "database"); |
$query = $conn->prepare($query); | $query = $conn->prepare($query); |
$query->bindParam(":routeID", $routeID); | $query->bindParam(":routeID", $routeID); |
$query->bindParam(":directionID", $directionID); | $query->bindParam(":directionID", $directionID); |
$query->execute(); | $query->execute(); |
if (!$query) { | if (!$query) { |
databaseError($conn->errorInfo()); | databaseError($conn->errorInfo()); |
return Array(); | return Array(); |
} | } |
$r = $query->fetch(PDO :: FETCH_ASSOC); | $r = $query->fetch(PDO :: FETCH_ASSOC); |
return $r; | return $r; |
} | } |
function getRouteAtStop($routeID, $directionID, $stop_id) { | function getRouteAtStop($routeID, $directionID, $stop_id) { |
$nextTrip = getRouteNextTrip($routeID, $directionID); | $nextTrip = getRouteNextTrip($routeID, $directionID); |
if ($nextTrip['trip_id']) { | if ($nextTrip['trip_id']) { |
foreach (getTripStopTimes($nextTrip['trip_id']) as $tripStop) { | foreach (getTripStopTimes($nextTrip['trip_id']) as $tripStop) { |
if ($tripStop['stop_id'] == $stop_id) | if ($tripStop['stop_id'] == $stop_id) |