Example #1
0
<?php

include_once '../common/headers.php';
$selectForm = new Form();
$selectForm->Add(new DropDown('routeID', Route::GetAllRoutes()));
$selectForm->Add(new SubmitButton());
echo $selectForm->ToString();
if (isset($_GET['routeID'])) {
    $route = new Route(false, false, $_GET['routeID']);
    echo '<p>Route: ' . $route->short_name . ' ' . $route->long_name;
    $routedirs = $route->GetDirections();
    if (count($routedirs) > 0) {
        foreach ($routedirs as $route_dir) {
            echo '<p>Direction: ' . $route_dir->description;
            $stops = $route_dir->GetStops();
            if (count($stops) > 0) {
                echo '<blockquote><p>Stops:';
                echo '<table border=1 cellpadding=3>';
                echo '<tr>';
                //<td>&nbsp;</td>';
                foreach ($stops as $stop) {
                    echo '<td>';
                    if ($stop->timepoint) {
                        echo '<strong>';
                    }
                    echo $stop->ToString();
                    echo '</td>';
                }
                echo '</tr>' . "\n";
                /*	for($i = 0; $i < 5; $i++)
                			{
Example #2
0
<?php

include_once '../common/headers.php';
echo '<p>Select route:';
$dropdown = new DropDown('routeID', Route::GetAllRoutes());
$form = new Form();
$form->Add($dropdown);
$form->Add(new SubmitButton());
echo $form->ToString();
if (isset($_POST['routeID'])) {
    /* adding a direction */
    echo '<hr />';
    $route_id = $_POST['routeID'];
    $dir = $_POST['direction'];
    $descr = $_POST['description'];
    $stops = explode(',', $_POST['stops']);
    echo 'adding direction ' . $descr . ' to route ' . $route_id;
    $new_dir = new Direction($route_id, $dir, $descr);
    $new_dir->WriteToDatabase();
    echo '<p>route direction created as ID ' . $new_dir->GetID() . ', adding stops... ';
    $sequence = 0;
    foreach ($stops as $stopValue) {
        $stop = trim($stopValue);
        $new_dir->AddStop($stop, $sequence);
        $sequence++;
    }
    echo $sequence . ' stops added.</p>';
    echo '<hr/>';
}
if (isset($_GET['routeID'])) {
    $route = new Route(false, false, $_GET['routeID']);
Example #3
0
<?php

include_once '../common/headers.php';
echo '<a href="createDirection.php">Insert directions for routes</a><br /><br />';
echo '<a href="view.php">View existing routes and directions</a><br />';
exit;
print 'Select route:<br/>';
$route = new Route('12');
$route->long_name = 'Conestoga Mall/Fairview Mall';
$route->short_name = '12';
//$route->WriteToDatabase();
$Routes = Route::GetAllRoutes();
$dd = new DropDown('routeID', $Routes);
$dd->Write();
$ddsp = new DropDown('servicePeriod', ServicePeriod::GetAllServicePeriods());
$ddsp->Write();
echo '<pre>';
print Route::WriteGTFSHeader();
foreach ($Routes as $route) {
    print $route->WriteToGTFS();
}
print '<br/><br/><br/>Query count: ' . $Database->GetQueryCount();