CIM37 - Improved error handling geolocation

This commit is contained in:
“VeLiTi”
2024-04-04 11:08:50 +02:00
parent a657daa1de
commit d483c41832
2 changed files with 30 additions and 24 deletions

View File

@@ -221,31 +221,33 @@ $view .= '<div class="content-block">
if (!empty($responses->geolocation) || $responses->geolocation != ''){
$geolocation = json_decode($responses->geolocation,true);
$view .= '<div class="content-block">
<div id="map" style="height:300px;z-index: 0;">
</div>
<script>
// initialize Leaflet
var map = L.map(\'map\').setView({lon: '.$geolocation[1].', lat: '.$geolocation[0].'}, 10);
if ($geolocation[1] != ''){
$view .= '<div class="content-block">
<div id="map" style="height:300px;z-index: 0;">
</div>
<script>
// initialize Leaflet
var map = L.map(\'map\').setView({lon: '.$geolocation[1].', lat: '.$geolocation[0].'}, 10);
//Add TSS Avatar to MAP
var TSSemp = L.icon({
iconUrl: \'./assets/images/EP.png\',
iconSize: [50, 50], // size of the icon
});
L.marker(['.$geolocation[0].','.$geolocation[1].'], {icon: TSSemp}).addTo(map);
//Add TSS Avatar to MAP
var TSSemp = L.icon({
iconUrl: \'./assets/images/EP.png\',
iconSize: [50, 50], // size of the icon
});
L.marker(['.$geolocation[0].','.$geolocation[1].'], {icon: TSSemp}).addTo(map);
// add the OpenStreetMap tiles
L.tileLayer(\'https://tile.openstreetmap.org/{z}/{x}/{y}.png\', {
maxZoom: 19,
attribution: \'&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>\'
}).addTo(map);
// add the OpenStreetMap tiles
L.tileLayer(\'https://tile.openstreetmap.org/{z}/{x}/{y}.png\', {
maxZoom: 19,
attribution: \'&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>\'
}).addTo(map);
// show the scale bar on the lower left corner
L.control.scale({imperial: true, metric: true}).addTo(map);
</script>
</div>
';
// show the scale bar on the lower left corner
L.control.scale({imperial: true, metric: true}).addTo(map);
</script>
</div>
';
}
}
//Get all related service events