Example #1
0
$command = $_REQUEST['command'];

switch ($command) {
 case 'stops':
   $data = ShuttleSchedule::getAllStops();
   break;
 case 'stopInfo':
   $stop_id = $_REQUEST['id'];
   $time = time();

   $data['stops'] = ShuttleSchedule::getTimesForStop($stop_id);
   $data['now'] = $time;

   break;
 case 'routes': // static info about all routes
   $route_ids = ShuttleSchedule::getActiveRoutes();
   foreach ($route_ids as $route_id) {
     $routeInfo = get_route_metadata($route_id);

     if (!$_REQUEST['compact']) {
       $routeInfo['stops'] = ShuttleSchedule::list_stop_times($route_id);
       $route = ShuttleSchedule::getRoute($route_id);
       $path = array();
       foreach ($route->anyTrip(time())->shape->points as $point) {
	 $path[] = array('lat' => $point[0], 'lon' => $point[1]);
       }
       // we had each stop's path segment appended to the stop
       // we can split it out later if needed
       $routeInfo['stops'][0]['path'] = $path;
     }
<?
$docRoot = getenv("DOCUMENT_ROOT");

require_once $docRoot . "/mobi-config/mobi_lib_constants.php";
require_once 'GTFSReader.php';

//print_r("all routes:\n");
//print_r(ShuttleSchedule::getRouteList());

foreach (array(
  //'mit',
  'saferide',
  ) as $agency)
{
  $routes = array();
  foreach (ShuttleSchedule::getActiveRoutes($agency) as $route) {
    $routes[$route] = FALSE;
  }

  $activeroutes = ShuttleSchedule::getRunningRoutes($agency);
  foreach ($activeroutes as $route) {
    $routes[$route] = 'running';
  }
  print_r("$agency routes:\n");
  print_r($routes);

  foreach ($routes as $route_id => $status) {

    echo "\n";
    $route = ShuttleSchedule::getRoute($route_id);
    echo $route->long_name . ' (' . $route_id . "):\n";
Example #3
0
<?php
$docRoot = getenv("DOCUMENT_ROOT");

require_once $docRoot . "/mobi-config/mobi_web_constants.php";
require_once WEBROOT . "page_builder/page_header.php";
require_once LIBDIR . "GTFSReader.php";

$now = time();

$day_routes = ShuttleSchedule::getActiveRoutes('mit');
$day_routes = array_merge($day_routes, ShuttleSchedule::getActiveRoutes('charles-river'));
$night_routes = ShuttleSchedule::getActiveRoutes('saferide');

require "$page->branch/index.html";
$page->output();
?>
Example #4
0
<?php

$docRoot = getenv("DOCUMENT_ROOT");

require_once $docRoot . "/mobi-config/mobi_web_constants.php";
require_once WEBROOT . "page_builder/page_header.php";
require_once LIBDIR . "GTFSReader.php";

$route_id = $_REQUEST['route'];

if (!in_array($route_id, ShuttleSchedule::getActiveRoutes())) {
  if (!in_array($route_id, ShuttleSchedule::getRouteList())) {
    $routeName = $route_id;
    $routeError = "does not exist";
  } else {
    $routeName = ShuttleSchedule::getRoute($route_id)->long_name;
    $routeError = "is not currently in service";
  }

  $not_found_text = '<p>The route ' . $routeName . ' ' . $routeError . '.  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();

  $route = ShuttleSchedule::getRoute($route_id);
  $stops = ShuttleSchedule::list_stop_times($route_id);
  $lastIndex = count($stops) - 1;
  if ($stops[$lastIndex]['gps']) {