echo "$route_id: ";
  foreach ($times as $time) {
    var_dump($time);
  }
  echo "\n";
}

//$mit = ShuttleSchedule::getAgency('mit');
//$saferide = ShuttleSchedule::getAgency('saferide');

//$mit = NextBusReader::agency('mit');
//$saferide = NextBusReader::agency('saferide');
//$mbta = NextBusReader::agency('mbta');

//$mit->routeList();
//print_r($saferide->routeList());

//print_r($mit->getAllStops());
//print_r($mit->routeConfig('tech'));
//print_r($mit->predictionsForRoute('tech'));
//print_r($mit->vehicleLocations('tech'));
//print_r($mit->predictionsForStop('mass84_d'));

$route = ShuttleSchedule::getRoute('tech');

$trip = $route->anyTrip(time());
$tag = ShuttleSchedule::image_tag(200, $trip, array('kendsq_d'));
var_dump($tag);

?>
示例#2
0
  // 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':
    $size = 200;
    break;
  }

  // produce url to google static maps image
  $image_tag = ShuttleSchedule::image_tag($size, $trip, $highlighted_stops);  

  // device-dependent time formatting function
  if ($page->branch == 'Basic') {
    function format_shuttle_time($tstamp) {
      if ($tstamp === 0) return 'finished';
      return date('g:i', $tstamp) . substr(date('a', $tstamp), 0, 1);
    }
  } else {
    function format_shuttle_time($tstamp) {
      if ($tstamp === 0) return 'finished';
      return date('g:i', $tstamp) . '<span class="ampm">' . date('A', $tstamp) . '</span>';
    }
  }

  require "$page->branch/times.html";