function printRouteInfo($routeInfo)
{
    $name = "";
    $agency = "MARTA";
    echo "\t\t<div class='bus'><div class='title {$agency}'>";
    if ($routeInfo != null) {
        $name = $routeInfo['name'];
        $agency = $routeInfo['agency'];
        if (array_key_exists('routes', $routeInfo)) {
            $name = implode('/', $routeInfo['routes']);
        }
        echo "<h3>{$name}</h3>";
        echo "<ul class='places'>";
        $destArray = explode(" via ", $routeInfo['direction2']);
        echo "<li class='origin-destination'>" . str_replace(". ", ".&nbsp;", str_replace(" to ", "&nbsp;&#x27A4;&nbsp;", $destArray[0])) . "</li>";
        //echo "<li><b>" . $destArray[0] . "</b></li>";
        if (count($destArray) > 1) {
            echo "<li class='waypoints'><i>via</i> " . $destArray[1] . "</li>";
        }
        echo "</ul>";
    }
    echo "\t\t</div>";
    $shouldPrintWeekday = count($routeInfo['wkday']) > 0;
    $shouldPrintSaturday = count($routeInfo['sat']) > 0;
    $shouldPrintSunday = count($routeInfo['sun']) > 0;
    echo "\t\t<table class='schedule'>";
    if ($routeInfo != null) {
        echo "<thead><tr>";
        if ($shouldPrintWeekday) {
            echo '<th>M-F <span class="alt-lang">L-V</span></th>';
        }
        if ($shouldPrintSaturday) {
            echo '<th>Sat <span class="alt-lang">Sab</span></th>';
        }
        if ($shouldPrintSunday) {
            echo '<th>Sun <span class="alt-lang">Dom</span></th>';
        }
        echo "</tr></thead><tbody><tr>";
        if ($shouldPrintWeekday) {
            echo "<td><ul>";
            printTimeTable($routeInfo['wkday']);
            echo "</ul></td>";
        }
        if ($shouldPrintSaturday) {
            echo "<td><ul>";
            printTimeTable($routeInfo['sat']);
            echo "</ul></td>";
        }
        if ($shouldPrintSunday) {
            echo "<td><ul>";
            printTimeTable($routeInfo['sun']);
            echo "</ul></td>";
        }
        echo "</tr></tbody>";
    } else {
        echo "<thead></thead><tbody></tbody>";
    }
    echo "</table></div>";
}
示例#2
0
function printRouteInfo($routeInfo)
{
    $name = "";
    if (array_key_exists('routes', $routeInfo)) {
        $name = implode('</h3><h3>', $routeInfo['routes']);
    }
    $agency = $routeInfo['agency'];
    $destArray = explode(" via ", $routeInfo['direction2']);
    $originDestination = str_replace(". ", ".&nbsp;", str_replace(" to ", "&nbsp;&#x27A4;&nbsp;", $destArray[0]));
    $waypoints_li = "";
    if (count($destArray) > 1) {
        $waypoints_li = "<li class='waypoints'><i>via</i> " . $destArray[1] . "</li>";
    }
    echo <<<EOT
\t<div class='bus'><div class='title {$agency}'>
\t\t<h3>{$name}</h3>
\t\t<ul class='places'>
\t\t\t<li class='origin-destination'>{$originDestination}</li>
\t\t\t{$waypoints_li}
\t\t</ul>
\t</div>
EOT;
    $shouldPrintWeekday = count($routeInfo['wkday']) > 0;
    $shouldPrintSaturday = count($routeInfo['sat']) > 0;
    $shouldPrintSunday = count($routeInfo['sun']) > 0;
    echo "\t\t<table class='schedule'>";
    if ($routeInfo != null) {
        echo "<thead><tr>";
        if ($shouldPrintWeekday) {
            echo '<th>Weekdays<br/><span class="alt-lang">En semana</span></th>';
        }
        if ($shouldPrintSaturday) {
            echo '<th>Saturday<br/><span class="alt-lang">S&aacute;bado</span></th>';
        }
        if ($shouldPrintSunday) {
            echo '<th>Sunday<br/><span class="alt-lang">Domingo</span></th>';
        }
        echo "</tr></thead><tbody><tr>";
        if ($shouldPrintWeekday) {
            echo "<td><ul>";
            printTimeTable($routeInfo['wkday']);
            echo "</ul></td>";
        }
        if ($shouldPrintSaturday) {
            echo "<td><ul>";
            printTimeTable($routeInfo['sat']);
            echo "</ul></td>";
        }
        if ($shouldPrintSunday) {
            echo "<td><ul>";
            printTimeTable($routeInfo['sun']);
            echo "</ul></td>";
        }
        echo "</tr></tbody>";
    } else {
        echo "<thead></thead><tbody></tbody>";
    }
    echo "</table></div>";
}