<?


require_once "mobi_lib_constants.php";
require_once(LIB_ROOT . 'ShuttleSchedule.php');

//print_r(ShuttleSchedule::get_route_list());
$routes = ShuttleSchedule::get_active_routes();
//$routes = Array('boston_all');
//print_r($routes);
//$routes = Array('boston_east');
foreach ($routes as $route) {
  echo ShuttleSchedule::get_title($route) . '(' . $route . ")\n";
  //print_r(ShuttleSchedule::get_next_scheduled_loop($route));
  //echo 'is running: ' . ShuttleSchedule::is_running($route) . "\n";
}

?>
<?php

require_once "../config/mobi_web_constants.php";
require_once PAGE_HEADER;
require_once "shuttle_lib.php";
$route = $_REQUEST['route'];
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':