--- a/stop.php +++ b/stop.php @@ -74,10 +74,10 @@ } } if (sizeof($stops) > 0) { -$stopDescParts = explode("<br>",$stop['stop_desc']); -include_header(trim(str_replace("Street: ","",$stopDescParts[0])), "stop"); + $stopDescParts = explode("<br>", $stop['stop_desc']); + include_header(trim(str_replace("Street: ", "", $stopDescParts[0])), "stop"); } else { - include_header($stop['stop_name']); + include_header($stop['stop_name'], "stop"); } /* $serviceAlerts = json_decode(getPage(curPageURL() . "/servicealerts_api.php?filter_class=stop&filter_id=".$stopid) , true); @@ -108,15 +108,15 @@ sktimesort($allStopsTrips, "arrival_time", true); $trips = $allStopsTrips; } else { - $trips = getStopTripsWithTimes($stopid); + $trips = getStopTripsWithTimes($stopid, "", "", "", (isset($filterIncludeRoutes) || isset($filterHasStop) ? "75" : "")); } echo "<div class='ui-header' style='overflow: visible; height: 2.5em'>"; // if we have too many trips, cut down to size. -if (sizeof($trips) > 10) { - $trips = array_splice($trips, 0,10); +if (!isset($filterIncludeRoutes) && !isset($filterHasStop) && sizeof($trips) > 10) { + $trips = array_splice($trips, 0, 10); } - + // later/earlier button setup if (sizeof($trips) == 0) { $time = isset($_REQUEST['time']) ? strtotime($_REQUEST['time']) : time(); @@ -127,7 +127,7 @@ $earlierTime = strtotime($trips[$tripsKeys[0]]['arrival_time']) - (90 * 60); $laterTime = strtotime($trips[$tripsKeys[sizeof($trips) - 1]]['arrival_time']) - 60; } -if (sizeof($stopids) > 0) { +if (isset($stopids) && sizeof($stopids) > 0) { $stopidurl = "stopids=" . implode(",", $stopids); } else { $stopidurl = "stopid=$stopid"; @@ -141,29 +141,35 @@ echo "<li style='text-align: center;'>No trips in the near future.</li>"; } else { foreach ($trips as $trip) { - echo '<li>'; + if ( + isset($filterHasStop) && (getTripHasStop($trip['trip_id'], $filterHasStop) == 1) + || (isset($filterIncludeRoutes) && in_array($trip["route_short_name"], $filterIncludeRoutes)) + || (!isset($filterIncludeRoutes) && !isset($filterHasStop)) + ) { + echo '<li>'; - $destination = getTripDestination($trip['trip_id']); - echo '<a href="trip.php?stopid=' . $stopid . '&tripid=' . $trip['trip_id'] . '"><h3>'. $trip['route_short_name'] . " towards " . $destination['stop_name'] . "</h3><p>"; - $viaPoints = viaPointNames($trip['trip_id'], $trip['stop_sequence']); - if ($viaPoints != "") - echo '<br><span class="viaPoints">Via: ' . $viaPoints . '</span>'; - if (sizeof($tripStopNumbers) > 0) { - echo '<br><small>Boarding At: '; - if (sizeof($tripStopNumbers[$trip['trip_id']]) == sizeof($stopids)) { - echo "All Stops"; - } else { - foreach ($tripStopNumbers[$trip['trip_id']] as $key) { - echo $stopNames[$key] . ', '; + $destination = getTripDestination($trip['trip_id']); + echo '<a href="trip.php?stopid=' . $stopid . '&tripid=' . $trip['trip_id'] . '"><h3>' . $trip['route_short_name'] . " towards " . $destination['stop_name'] . "</h3><p>"; + $viaPoints = viaPointNames($trip['trip_id'], $trip['stop_sequence']); + if ($viaPoints != "") + echo '<br><span class="viaPoints">Via: ' . $viaPoints . '</span>'; + if (sizeof($tripStopNumbers) > 0) { + echo '<br><small>Boarding At: '; + if (sizeof($tripStopNumbers[$trip['trip_id']]) == sizeof($stopids)) { + echo "All Stops"; + } else { + foreach ($tripStopNumbers[$trip['trip_id']] as $key) { + echo $stopNames[$key] . ', '; + } } + echo '</small>'; } - echo '</small>'; + echo '</p>'; + echo '<p class="ui-li-aside"><strong>' . $trip['arrival_time'] . '</strong></p>'; + echo '</a></li>'; + flush(); + @ob_flush(); } - echo '</p>'; - echo '<p class="ui-li-aside"><strong>' . $trip['arrival_time'] . '</strong></p>'; - echo '</a></li>'; - flush(); - @ob_flush(); } } echo '</ul>';