several vehicles

This commit is contained in:
Walter Hupfeld
2020-08-02 20:08:48 +02:00
parent 558d336fa0
commit 2ff7124f6f
4 changed files with 97 additions and 63 deletions

View File

@@ -5,33 +5,59 @@
$strIntro ="<h4>".$strTitle."</h4>";
$strIntro .= nl2br2($strIntroText);
$numKey = (isset($_GET['key'])) ? $_GET['key'] : 1 ;
switch ($numKey) {
case 1 : $strKey = "IstRad=1";
break;
case 2: $strKey = "IstPKW=1";
break;
case 3 : $strKey = "IstFuss=1";
break;
$numVehicle = (isset($_GET['v'])) ? (int) $_GET['v'] : 1;
switch ($numVehicle) {
case 1:
case 0:
$strWhere ="IstRad = 1";
$topic=2;
break;
case 2:
$strWhere = "IstPKW = 1";
$topic=4;
break;
case 3:
$strWhere = "IstFuss = 1";
$topic=1;
break;
case 4:
$strWhere = "IstKrad = 1";
$topic=0;
break;
case 5:
$strWhere = "IstGkfz = 1";
$topic=5;
break;
case 6:
$strWhere = "IstSonstige = 1";
$topic=3;
break;
default: $strWhere ="IstRad = 1";
$topic=2;
}
$strSQL="SELECT * FROM Unfallorte2019_Hamm WHERE ".$strKey;
$strSQL="SELECT * FROM Unfallorte2019_Hamm WHERE ".$strWhere;
$result = $db->query($strSQL);
$arrMarker = array();
$arrDescription = array();
$description="";
while ($row = $result->fetchArray()) {
//print_r($row);echo "<hr>";
$id = $row[0];
$topic = 2;
$numLng = $row['XGCSWGS84'];
$numLat = $row['YGCSWGS84'];
if ($row['IstRad']) $description .="mit Fahrradbeteiligung, ";
if ($row['IstPKW']) $description .="mit PKW-Beteiligung, ";
if ($row['IstFuss']) $description .="mit Fußgängerbeteiligung, ";
if ($row['IstKrad']) $description .="mit Kraftradbeteiligung, ";
if ($row['IstGkfz']) $description .="mit Güterkraftzeugbeteiligung, ";
if ($row['IstSonstige']) $description .="mit Beteiligung eines oben nicht genannten Verkehrsmittels";
$strDescription=generate_tooltip_description($row);
@@ -77,9 +103,16 @@
<div class="collapse navbar-collapse" id="navbars">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="index.php?ref=1">Karte <span class="sr-only">(current)</span></a>
</li>
<?php foreach ($arrVehicles as $key => $strVehicle):
$strActive = ($numVehicle==$key) ? "active" : ""
?>
<li class="nav-item <?=$strActive?>">
<a class="nav-link" href="index.php?v=<?=$key?>"><?=$strVehicle?>
<span class="sr-only">(current)</span> </a>
<?php endforeach; ?>
</ul>
<div>
@@ -101,17 +134,10 @@
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
<div class="sidebar-sticky">
<img class="logo" src="<?=$strLogo?>" alt="Logo" >
<ul class="nav flex-column">
Unfälle mit
<?php
foreach ($arrTopic as $key=>$topic) {
echo "<li class='nav-item'>";
echo "<label>";
echo "<a class='nav-link'>".$arrIcon[$key]." ";
echo "<input type='checkbox' name='check_".$key."' id='check_".$key."' class='check' checked='checked' > ";
echo $topic."</a></label>";
echo "</li>";
}
echo $arrVehicles_pl[$numVehicle];
?>
</ul>
</div>
@@ -187,8 +213,6 @@
// Marker from database -------------------------------------------------------
var up="up";
var down="down";
var marker = [];
var arrDescription = [];
@@ -196,28 +220,23 @@
foreach ($arrMarker as $idx=>$strMarker) {
echo $strMarker."\n";
}
echo "var marker_max=".$markerid."\n";
?>
// Info-Marker für Start --------------------------------------------------------
var marker2 = L.marker([<?=$numInfoLat?>, <?=$numInfoLng?>], { icon: infoMarker }).addTo(mymap);
<?php
echo "marker2.bindPopup('".$strIntro."').openPopup();";
echo "marker2.bindPopup('".$strIntro."');";
if ($numVehicle==0) {
echo "marker2.openPopup();";
}
?>
hammLayer.on('click',function(e){ e.preventDefault(); })
mymap.on('click', onMapClick);
// Hide and show marker form checkbox ----------------------------------------
$('.check').click(function() {