2015-07-16 20:18:24 +03:00
<! DOCTYPE html >
< html >
< head >
< title > uBus - ShowStop </ title >
< ? php include 'head.php' ; ?>
2015-07-17 20:03:22 +03:00
< ? php include 'map.php' ; ?>
2015-07-16 20:18:24 +03:00
</ 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 " ])){
2015-07-17 20:03:22 +03:00
$stop = getStopInfo ( $_GET [ " stop " ]);
2015-07-19 13:18:27 +03:00
echo '<header><h1>Stop ' . $stop [ 'id' ] . ' - ' . $stop [ 'name' ] . '</h1></header>' ;
echo '<ul class="nav nav-tabs" role="tablist" >' ;
echo '<li role="presentation" class="active"><a href="#routes" aria-controls="routes" data-toggle="tab" role="tab">Routes</a></li>' ;
echo '<li role="presentation"><a href="#map" onclick="setTimeout(function(){map.updateSize();}, 200);" aria-controls="map" data-toggle="tab" role="tab">Map</a></li>' ;
echo '</ul>' ;
echo '<div class="tab-content">' ;
echo '<div id="routes" class="tab-pane fade in active" role="tabpanel">' ;
2015-07-18 04:18:52 +03:00
PrintRoutes ( $_GET [ " stop " ]);
2015-07-19 13:18:27 +03:00
echo '</div><div id="map" class="tab-pane fade" role="tabpanel">' ;
2015-07-17 20:03:22 +03:00
ShowMap ( $stop [ 'lat' ], $stop [ 'lon' ]);
2015-07-19 13:18:27 +03:00
echo '</div></div>' ;
2015-07-16 20:18:24 +03:00
} 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>' ;
2015-07-17 15:15:20 +03:00
echo '<th>Line #</th><th>Route Name</th><th>Direction</th>' ;
2015-07-16 20:18:24 +03:00
echo '</tr></thead><tbody>' ;
foreach ( $routes as $route ){
2015-07-17 15:15:20 +03:00
foreach ( $route [ 'stops' ] as $direction => $stops ){
foreach ( $stops as $stop ){
2015-07-16 20:18:24 +03:00
if ( $stop == $stp ){
echo '<tr><td>' . $route [ 'line' ] . '</td>' ;
2015-07-17 15:15:20 +03:00
echo '<td><a href="ShowRoute.php?route=' . $route [ 'id' ] . '">' . $route [ 'name' ] . '</a></td>' ;
echo '<td>' . getLabelOfDir ( $direction ) . '</td></tr>' ;
2015-07-16 20:18:24 +03:00
}
}
}
}
echo '</tbody></table>' ;
}
?>
< ? php include 'foot.php' ; ?>
</ body >
</ html