Exemple #1
0
<?php

$docRoot = getenv("DOCUMENT_ROOT");
require_once $docRoot . "/mobi-config/mobi_web_constants.php";
require_once WEBROOT . "api/api_header.php";

log_api('shuttles');

require_once LIBDIR . "GTFSReader.php";
$data = Array();
$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);