Display routes that belong to a line.

This commit is contained in:
George Kaklamanos 2015-07-17 15:27:27 +03:00
parent 59c9a37e91
commit 18daa125c7

45
ShowLine.php Normal file
View file

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<title>uBus - ShowLine</title>
<?php include 'head.php'; ?>
</head>
<body>
<?php include 'nav.php'; ?>
<h1>ShowLine</h1>
<p>Here you can find a list of routes that have a specified line number. Click
on a route's name to see a list of its bus stops and the position of the bus
on the map.</p>
<?php
include 'libdata.php';
if (isValidLine($_GET["line"])){
PrintRoutes($_GET["line"]);
} else {
echo '<span style="display:inline-block" class="alert alert-danger" role="alert">No such line. <a href="javascript:history.back()">Go back?</a></span>';
}
function PrintRoutes($line){
$routes = getRoutesOfLine($line);
echo '<table class="table table-striped table-bordered"><thead><tr>';
echo '<th>Route #</th><th>Route Name</th>';
echo '</tr></thead><tbody>';
foreach ($routes as $route){
echo '<tr><td>' . $route['id'] . '</td>';
echo '<td><a href="ShowRoute.php?route=' . $route['id'] . '">' . $route['name'] . '</a></td></tr>';
}
echo '</tbody></table>';
}
?>
<?php include 'foot.php'; ?>
</body>
</html