Esempio n. 1
0
    $hasta = date("Y-m-d H:i:s");
}
if (isset($_GET["id_virloc"])) {
    if (isset($_GET["route"])) {
        $titulo = "Route between " . $desde . " and " . $hasta;
        $mapa = XVM::getMapLastPositions($_GET["id_virloc"], $desde, $hasta);
        $script = $mapa[0];
        $html = $mapa[1];
    } else {
        $titulo = "Last Position";
        $mapa = XVM::getMapLastPosition($_GET["id_virloc"]);
        $script = $mapa[0];
        $html = $mapa[1];
    }
} else {
    $rs = XVM::getLastCarsPositions();
}
?>

<html>
<head>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function inicio() {
    <?php 
echo $script;
?>
}
</script>
</head>
<body onload="inicio();">
Esempio n. 2
0
<?php

include "XVM.php";
$html = "";
$script = "";
$rs = XVM::getLastPositions();
while ($pos = mysql_fetch_object($rs)) {
    $script .= XVM::getScriptGoogleMapsApi($pos->id, $pos->latitud, $pos->longitud);
    $url = XVM::getGoogleMapsURL($pos->latitud, $pos->longitud);
    ?>
        <div style="width: 425px; height: 375px; border: 1px solid;float: left;padding: 3px;text-align: center;">
            <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src='<?php 
    echo $url;
    ?>
'></iframe>
            <a href="<?php 
    echo $url;
    ?>
"><?php 
    echo $pos->fecha;
    ?>
 Vehiculo <?php 
    echo $pos->id . " a " . $pos->velocidad;
    ?>
 kms/h Rumbo <?php 
    echo $pos->rumbo;
    ?>
</a>
        </div>
        <?php 
    $html .= "<div id=map" . $pos->id . " style='width:400px; height:400px'></div>";
Esempio n. 3
0
 function getMapLastPositions($id_virloc, $desde, $hasta)
 {
     $rs = XVM::getLastPosition($id_virloc);
     $gm = mysql_fetch_object($rs);
     $var = "";
     $var .= "\n        var myOptions = {\n        center: new google.maps.LatLng(" . $gm->latitud . "," . $gm->longitud . "),\n        zoom: 13,\n        mapTypeId: google.maps.MapTypeId.ROADMAP\n        };\n    \n        var map" . $id_virloc . " = new google.maps.Map(document.getElementById('map" . $id_virloc . "'),myOptions);\n        marker" . $id_virloc . " = new google.maps.Marker({\n                                              position: new google.maps.LatLng(" . $gm->latitud . "," . $gm->longitud . "),\n                                              map: map" . $id_virloc . ",\n                                              title: 'ID:" . $id_virloc . "'\n                                              });\n    \n        var ruta" . $id_virloc . " = [";
     $caca = XVM::getLastPositions($id_virloc, $desde, $hasta);
     while ($gm = mysql_fetch_object($caca)) {
         $var .= "new google.maps.LatLng(" . $gm->latitud . "," . $gm->longitud . "),\n";
     }
     $var .= "];\n    \t\t\t\n        var lineas" . $id_virloc . " = new google.maps.Polyline({\n                                                  path: ruta" . $id_virloc . ",\n                                                  map: map" . $id_virloc . ",\n                                                  strokeColor: '#222000',\n                                                  strokeWeight: 3,\n                                                  strokeOpacity: 0.5,\n                                                  clickable: true\n                                                  });\n        ";
     $html = "<div id=map" . $id_virloc . " class='div_map'></div>";
     return [$var, $html];
 }