--- a/trip.php +++ b/trip.php @@ -9,15 +9,23 @@ $trip = getTrip($tripid); $routeid = $trip["route_id"]; } -$routetrips = getRouteTrips($routeid); + include_header("Stops on " . $trip['route_short_name'] . ' ' . $trip['route_long_name'], "trip"); trackEvent("Route/Trip View", "View Route", $trip['route_short_name'] . ' ' . $trip['route_long_name'], $routeid); echo ''; echo 'View Original Timetable/Map'; echo '

Via:

' . viaPointNames($tripid) . ''; echo '

Other Trips:

'; -foreach (getRouteTrips($routeid) as $othertrip) { +$routeTrips = getRouteTrips($routeid); +foreach ($routeTrips as $key => $othertrip) { + if ($othertrip['trip_id']!= $tripid) { echo '' . str_replace(" ", ":00", str_replace(":00", " ", $othertrip['arrival_time'])) . ' '; + } else { + // skip this trip but look forward/back + if ($key-1 > 0) $prevTrip = $routeTrips[$key-1]['trip_id']; + if ($key+1 < sizeof($routeTrips)) $nextTrip = $routeTrips[$key+1]['trip_id']; + + } } flush(); @ob_flush(); @@ -33,6 +41,10 @@ echo '
'; flush(); @ob_flush(); +echo "
"; +if($nextTrip) echo 'Next Trip'; +if($prevTrip) echo 'Previous Trip'; +echo "
"; echo '