This repository has been archived on 2025-07-13. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
open-heraklion-bus/ShowStop.php

59 lines
1.5 KiB
PHP
Raw Normal View History

<!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><th>Direction</th>';
echo '</tr></thead><tbody>';
foreach ($routes as $route){
foreach ($route['stops'] as $direction => $stops){
foreach ($stops as $stop){
if ($stop == $stp){
echo '<tr><td>' . $route['line'] . '</td>';
echo '<td><a href="ShowRoute.php?route=' . $route['id'] . '">' . $route['name'] . '</a></td>';
echo '<td>' . getLabelOfDir($direction) . '</td></tr>';
}
}
}
}
echo '</tbody></table>';
}
?>
</tbody>
</table>
<?php include 'foot.php'; ?>
</body>
</html