Example #1
0
uasort($inbound_times, 'TripTimeComparer');
// TODO: when we are displaying a day's last trip + some morning trips, we want to treat the 24:48:00 differently than we
// treat a day's list with the last trip wrapping over. Currently the last trip(s) are sorting to the end, which is highly
// undesired. We do however need the sort for merging the two routes' schedules during weekdays.
// Some thoughts: 1) other than the route merge, sorting seems to be handled by the database. This may however be implicit
// by trip_id, which is not the safest. See if we can sort in SQL. (Still a problem since evening+morning come from two separate
// SQL queries, but we can just sort inside GetTrips in that case.) 2) if not, incorporate some sort of day/timestamp identity
// to each stoptime returned. This is somewhat absurd, as we'd probably need full timestamp to avoid problems wrapping
// over ends of service periods, months, years, etc.
// Currently leaving unsolved -- ~qviri, 2009.02.22
$outbound_trips = Trip::GetTrips($routes, $outbound_stops, '1', $limit, $time);
$outbound_times = Trip::GetStopTimesForTrips($outbound_trips, $outbound_stops);
uasort($outbound_times, 'TripTimeComparer');
$schedule = Page::GetRequestedServicePeriod($time);
echo '<p style="margin-bottom: -1.5em;">viewing ';
if (Page::IsShowingFullSchedule() === false) {
    echo $schedule->name . ' schedule upcoming trips';
    echo ' &#183; view full schedule: ';
    // TODO: there is a GetAllServicePeriods() but it also includes 'All week' and foreach leaves dangling commas... meh
    echo ' <a href="?serviceperiod=2">weekday</a>, ';
    echo ' <a href="?serviceperiod=3">Saturday</a>, ';
    echo ' <a href="?serviceperiod=4">Sunday</a>';
} else {
    echo 'full ' . $schedule->name . ' schedule';
    echo ' &#183; <a href="/keats/">view upcoming trips</a>';
}
echo '</p>' . "\n\n";
echo '<h2>to universities</h2>';
PrintStopList($inbound_stops, $inbound_times);
echo '<h2>to Fischer-Hallman Rd.</h2>';
PrintStopList($outbound_stops, $outbound_times);