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/modules/libher/libroutes.php
2016-02-21 14:31:47 +02:00

40 lines
1.1 KiB
PHP

<?php
function Routes(){
global $lang;
$GenRoutes = array();
$GenRoutes_keys = array('id', 'line', 'name', 'stops');
$GenRoutesStop_keys = array('go', 'come');
$codes = DownloadRouteUIDs();
# Get each route's name
foreach ($codes as $id){
$GenRoutes_values = array();
$GenRoutesStop_values = array();
$title = DownloadRouteTitle($id);
$lineCode = $title[0];
$lineName = $title[1];
array_push($GenRoutesStop_values, StopsOfRoute($id,'go'), StopsOfRoute($id,'come'));
array_push($GenRoutes_values, $id, $lineCode, $lineName, array_combine($GenRoutesStop_keys, $GenRoutesStop_values));
array_push($GenRoutes, array_combine($GenRoutes_keys, $GenRoutes_values));
}
return $GenRoutes;
}
function StopsOfRoute($line,$dir){
global $lang;
$stopsList = array();
foreach (DownloadRouteStops($line,$dir) as $stop){
$stp = $stop->getAttribute('value');
if ($stp == 0){
continue;
}
array_push($stopsList, $stp);
}
return $stopsList;
}
?>