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/libbusposition.php

35 lines
793 B
PHP
Raw Normal View History

2016-02-10 14:09:30 +02:00
<?php
function BusPosition($line, $direction){
global $lang;
$buspositions = DownloadBusposition($line,$direction);
$GenBusPositions = array();
$GenBusPositions_keys = array('line', 'id', 'lat', 'lon');
foreach ($buspositions as $bp){
$GenBusPositions_values = array();
if ($bp == ''){
break;
}
$pieces = explode('-', $bp);
$id = $pieces[0];
if ($id == 'null'){
$lat = '';
$lon = '';
}else{
$lat = $pieces[1];
$lon = $pieces[2];
}
array_push($GenBusPositions_values, $line, $id, $lat, $lon);
array_push($GenBusPositions, array_combine($GenBusPositions_keys, $GenBusPositions_values));
}
return $GenBusPositions;
}
?>