Пример #1
0
	   $stopInfo['id'] = $stop_id;
	   $routeInfo['stops'][] = $stopInfo;
	 }
       }
     }

     $data[] = $routeInfo;
   }
   break;
 case 'routeInfo': // live info for individual routes
   $route = $_REQUEST['id'];
   $time = time();
   if ($route) {

     $gpsActive = NextBusReader::gps_active($route);
     $stopTimes = list_stop_times($route, $time, $gpsActive);

     if ($_REQUEST['full'] == 'true') {
       $data = get_route_metadata($route);

       $stops = Array();
       if ($stops = NextBusReader::get_route_info($route)) {
	 foreach ($stopTimes as $index => $stopTimeInfo) {
	   $stopInfo = $stops[$stopTimeInfo['id']];
	   foreach ($stopInfo as $property => $value) {
	     if ($property == 'title')
	       continue;
	     $stopTimes[$index][$property] = $value;
	   }
	 }
       }
Пример #2
0
if (!in_array($route, ShuttleSchedule::get_active_routes())) {
    $routeName = ucwords(str_replace('_', ' ', $_REQUEST['route']));
    $not_found_text = '<p>The route ' . $routeName . ' is not currently in service.  Please update your bookmarks accordingly.  For more information see the <a href="help.php">help page</a>.</p>';
    $page->prepare_error_page('Shuttle Schedule', 'shuttle', $not_found_text);
} else {
    $now = time();
    $routeName = ShuttleSchedule::get_title($route);
    $interval = ShuttleSchedule::get_interval($route);
    $loop_time = $interval / 60;
    $summary = ShuttleSchedule::get_summary($route);
    if ($page->branch != 'Basic') {
        // format: 9:05AM -> 9:05<span class="ampm">AM</span>
        $summary = preg_replace('/(\\d)(AM|PM)/', '$1<span class="ampm">$2</span>', $summary);
    }
    $gps_active = ShuttleSchedule::is_running($route) && NextBusReader::gps_active($route);
    $stops = list_stop_times($route, $now, $gps_active);
    $upcoming_stops = array();
    foreach ($stops as $index => $stop) {
        if ($stop['upcoming']) {
            $upcoming_stops[] = $index;
        }
    }
    // determine size of route map to display on each device
    switch ($page->branch) {
        case 'Webkit':
            $size = 270;
            break;
        case 'Touch':
            $size = 200;
            break;
        case 'Basic':