Display information about a selected stop
This commit is contained in:
parent
48bd4135f7
commit
65b431c6a3
1 changed files with 57 additions and 0 deletions
57
ShowStop.php
Normal file
57
ShowStop.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>uBus - ShowStop</title>
|
||||
<?php include 'head.php'; ?>
|
||||
</head>
|
||||
<body>
|
||||
<?php include 'nav.php'; ?>
|
||||
|
||||
<h1>ShowStop</h1>
|
||||
<p>Below you can find two tables. One of them shows a list of routes tha visit
|
||||
this bus stop. Click on a route's name to see a list of its bus stops and the
|
||||
position of the bus on the map. The other table shows upcoming arrivals. There
|
||||
is also a map showing the location of the requested stop.</p>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
include 'libdata.php';
|
||||
|
||||
if (isValidStop($_GET["stop"])){
|
||||
PrintRoutes($_GET["stop"]);
|
||||
} else {
|
||||
echo '<span style="display:inline-block" class="alert alert-danger" role="alert">No such stop. <a href="javascript:history.back()">Go back?</a></span>';
|
||||
}
|
||||
|
||||
function PrintRoutes($stp){
|
||||
global $routes;
|
||||
echo '<table class="table table-striped table-bordered"><thead><tr>';
|
||||
echo '<th>Line #</th><th>Route Name</th>';
|
||||
echo '</tr></thead><tbody>';
|
||||
foreach ($routes as $route){
|
||||
foreach ($route['stops'] as $direction){
|
||||
foreach ($direction as $stop){
|
||||
if ($stop == $stp){
|
||||
echo '<tr><td>' . $route['line'] . '</td>';
|
||||
echo '<td><a href="ShowRoute.php?route=' . $route['id'] . '">' . $route['name'] . '</a></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
echo '</tbody></table>';
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<?php include 'foot.php'; ?>
|
||||
</body>
|
||||
</html
|
||||
|
||||
|
Reference in a new issue