Moved some files in directories.
This commit is contained in:
parent
e23bb22ea2
commit
50a0369ba1
9 changed files with 0 additions and 0 deletions
5
modules/data.php
Normal file
5
modules/data.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
$routes = json_decode(file_get_contents("routes.json"), true);
|
||||
$stops = json_decode(file_get_contents("stops.json"), true);
|
||||
$busposition = json_decode(file_get_contents("busposition.json"), true);
|
||||
?>
|
1
modules/foot.php
Normal file
1
modules/foot.php
Normal file
|
@ -0,0 +1 @@
|
|||
</div>
|
6
modules/head.php
Normal file
6
modules/head.php
Normal file
|
@ -0,0 +1,6 @@
|
|||
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="css/style.css" />
|
||||
<script src="js/jquery.min.js"></script>
|
||||
<script src="bootstrap/js/bootstrap.min.js"></script>
|
||||
<meta charset='utf-8' />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
98
modules/libdata.php
Normal file
98
modules/libdata.php
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
include 'data.php';
|
||||
|
||||
function getStopsOfRoute($id){
|
||||
global $routes;
|
||||
foreach ($routes as $route){
|
||||
if ($route['id'] == $id){
|
||||
return $route['stops'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getRoutesOfLine($line){
|
||||
global $routes;
|
||||
$tmp = array();
|
||||
foreach ($routes as $route){
|
||||
if ($route['line'] == $line){
|
||||
array_push($tmp, $route);
|
||||
}
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
function getRoutesByStop($stopId){
|
||||
global $routes;
|
||||
$tmp = array();
|
||||
foreach ($routes as $route){
|
||||
foreach ($route['stops'] as $stop){
|
||||
if ($stop == $stopId){
|
||||
array_push($tmp, $route);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
function isValidRoute($id){
|
||||
global $routes;
|
||||
foreach ($routes as $route){
|
||||
if ($route['id'] == $id){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isValidLine($line){
|
||||
global $routes;
|
||||
foreach ($routes as $route){
|
||||
if ($route['line'] == $line){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isValidStop($stp){
|
||||
global $stops;
|
||||
foreach ($stops as $stop){
|
||||
if ($stop['id'] == $stp){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function getRouteInfo($id){
|
||||
global $routes;
|
||||
foreach ($routes as $route){
|
||||
if ($route['id'] == $id){
|
||||
return $route;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getStopInfo($id){
|
||||
global $stops;
|
||||
foreach ($stops as $stop){
|
||||
if ($stop['id'] == $id){
|
||||
return $stop;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getLabelOfDir($dir){
|
||||
if ($dir == 'go'){
|
||||
return '<span class="label label-info">Go</span>';
|
||||
} else if ($dir == 'come'){
|
||||
return '<span class="label label-primary">Come</span>';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
20
modules/map.php
Normal file
20
modules/map.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<link rel="stylesheet" href="openlayers/ol.css" />
|
||||
<script src="openlayers/ol.js"></script>
|
||||
|
||||
<?php
|
||||
function ShowMap($lat,$lon){
|
||||
echo '<div style="display:none;"><div id="marker" style="width:10px;height:10px;border-radius:50%;background-color:#ff0000;opacity:0.6;"></div></div>';
|
||||
echo '<div id="mymap" style="width:300px;height:300px;overflow:hidden;"></div>';
|
||||
echo '<script>';
|
||||
echo 'var pos = new ol.proj.fromLonLat([' . $lon . ', ' . $lat . ']);';
|
||||
echo 'var map = new ol.Map({target:"mymap"});';
|
||||
echo 'var osmSource = new ol.source.OSM();';
|
||||
echo 'var myview = new ol.View({center: pos, zoom: 13});';
|
||||
echo 'map.setView(myview);';
|
||||
echo 'var osmLayer = new ol.layer.Tile({source: osmSource});';
|
||||
echo 'map.addLayer(osmLayer);';
|
||||
echo 'var marker = new ol.Overlay({position: pos, element: document.getElementById("marker")});';
|
||||
echo 'map.addOverlay(marker);';
|
||||
echo '</script>';
|
||||
}
|
||||
?>
|
25
modules/nav.php
Normal file
25
modules/nav.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<nav class="navbar navbar-inverse">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href=".">uBus</a>
|
||||
</div>
|
||||
<div id="navbar" >
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="<?php echo isActive("/Routes.php");?>" ><a href="/Routes.php">Routes</a></li>
|
||||
<li class="<?php echo isActive("/Stops.php");?>"><a href="/Stops.php">Stops</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container">
|
||||
|
||||
<?php
|
||||
|
||||
function isActive($url){
|
||||
if ($_SERVER['PHP_SELF'] == $url){
|
||||
return ' active ';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
Reference in a new issue