first commit
This commit is contained in:
43
templates/articles/map.php
Normal file
43
templates/articles/map.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?
|
||||
global $settings;
|
||||
if ( is_array( $this -> settings ) ) foreach ( $this -> settings as $row )
|
||||
{
|
||||
$data = explode( ':', $row );
|
||||
switch ( $data[0] ):
|
||||
case 'dlugosc':
|
||||
$dlugosc = $data[1];
|
||||
break;
|
||||
case 'szerokosc':
|
||||
$szerokosc = $data[1];
|
||||
break;
|
||||
case 'wysokosc_mapy':
|
||||
$wysokosc_mapy = $data[1];
|
||||
break;
|
||||
case 'szerokosc_mapy':
|
||||
$szerokosc_mapy = $data[1];
|
||||
break;
|
||||
case 'zoom':
|
||||
$zoom = $data[1];
|
||||
break;
|
||||
case 'opis':
|
||||
$opis = $data[1];
|
||||
break;
|
||||
endswitch;
|
||||
}
|
||||
?>
|
||||
<div id="map-<?= $this -> map_counter;?>" style="width: <?= $szerokosc_mapy;?>; height: <?= $wysokosc_mapy;?>"></div>
|
||||
<script type="text/javascript">
|
||||
var mymap<?= $this -> map_counter;?> = L.map('map-<?= $this -> map_counter;?>', {
|
||||
center: [<?= $szerokosc;?>, <?= $dlugosc;?>],
|
||||
zoom: <?= $zoom;?>,
|
||||
scrollWheelZoom: false
|
||||
});
|
||||
var marker = L.marker([<?= $szerokosc;?>, <?= $dlugosc;?>]).addTo(mymap<?= $this -> map_counter;?>);
|
||||
<? if ( $opis ):?>
|
||||
marker.bindPopup("<?= $opis;?>").openPopup();
|
||||
<? endif;?>
|
||||
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=<?= $settings['google_map_key'];?>', {
|
||||
maxZoom: 24,
|
||||
id: 'mapbox.streets'
|
||||
}).addTo(mymap<?= $this -> map_counter;?>);
|
||||
</script>
|
||||
Reference in New Issue
Block a user