Display information on a selected route.
This commit is contained in:
parent
899fb6103f
commit
ad91053c6b
1 changed files with 51 additions and 0 deletions
51
ShowRoute.php
Normal file
51
ShowRoute.php
Normal file
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>uBus - ShowRoute</title>
|
||||
<?php include 'head.php'; ?>
|
||||
</head>
|
||||
<body>
|
||||
<?php include 'nav.php'; ?>
|
||||
|
||||
<h1>ShowRoute</h1>
|
||||
<p>There are two tables below that list the bus stops of a route; one for each
|
||||
direction. Click on a bus stop's name to see a list of routes that visit it
|
||||
and view its position on a map.</p>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
include 'libdata.php';
|
||||
|
||||
if (isValidRoute($_GET["route"])){
|
||||
$route = getRouteInfo($_GET["route"]);
|
||||
PrintStops($route,'go');
|
||||
PrintStops($route,'come');
|
||||
} else {
|
||||
echo '<span style="display:inline-block" class="alert alert-danger" role="alert">No such route. <a href="javascript:history.back()">Go back?</a></span>';
|
||||
}
|
||||
|
||||
function PrintStops($rt,$dir){
|
||||
echo '<table class="table table-striped table-bordered"><thead><tr>';
|
||||
echo '<th>Stop #</th><th>Stop Name</th>';
|
||||
echo '</tr></thead><tbody>';
|
||||
foreach ($rt['stops'][$dir] as $stp){
|
||||
$stop = getStopInfo($stp);
|
||||
echo '<tr><td>' . $stop['id'] . '</td>';
|
||||
echo '<td><a href="ShowStop.php?stop=' . $stop['id'] . '">' . $stop['name'] . '</a></td></tr>';
|
||||
}
|
||||
echo '</tbody></table>';
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<?php include 'foot.php'; ?>
|
||||
</body>
|
||||
</html
|
||||
|
||||
|
Reference in a new issue