several vehicles
This commit is contained in:
parent
558d336fa0
commit
2ff7124f6f
43
config.php
43
config.php
@ -12,6 +12,34 @@ $numInfoLng =7.825;
|
||||
$numZoom=12;
|
||||
$fileGeojson ="geojson/hamm.geojson";
|
||||
|
||||
$arrVehicles = array (
|
||||
1 => "Fahrrad",
|
||||
2 => "PKW",
|
||||
3 => "Fussgänger",
|
||||
4 => "Kraftrad",
|
||||
5 => "LKW",
|
||||
6 => "Sonstiges"
|
||||
);
|
||||
|
||||
$arrVehicles_pl = array (
|
||||
1 => "Fahrrädern",
|
||||
2 => "PKWs",
|
||||
3 => "Fussgängern",
|
||||
4 => "Krafträdern",
|
||||
5 => "LKWs",
|
||||
6 => "Sonstigen"
|
||||
);
|
||||
|
||||
$arrWochentage = array (
|
||||
1 => "Sonntag",
|
||||
2 => "Montag",
|
||||
3 => "Dienstag",
|
||||
4 => "Mittwoch",
|
||||
5 => "Donnerstag",
|
||||
6 => "Freitag",
|
||||
7 => "Samstag"
|
||||
);
|
||||
|
||||
|
||||
$arrCategory = array (
|
||||
1 => "Unfall mit Getöteten",
|
||||
@ -59,8 +87,6 @@ $arrStrassenzustand = array (
|
||||
2 => "winterglatt",
|
||||
);
|
||||
|
||||
|
||||
|
||||
$arrTopic = array (
|
||||
2 => "Radverkehr",
|
||||
1 => "Fußverkehr",
|
||||
@ -70,6 +96,7 @@ $arrTopic = array (
|
||||
);
|
||||
|
||||
$arrMarkerType = array (
|
||||
0=>"infoMarker",
|
||||
1=>"pedestrianMarker",
|
||||
2=>"bicycleMarker",
|
||||
3=>"trainMarker",
|
||||
@ -78,18 +105,8 @@ $arrMarkerType = array (
|
||||
);
|
||||
|
||||
|
||||
|
||||
$arrTransport = array (
|
||||
0 => "keine Angabe",
|
||||
1 => "kein Auto",
|
||||
2 => "Auto",
|
||||
3 => "Motorroller/Motorrad",
|
||||
4 => "Bus/Bahn",
|
||||
5 => "Fahrrad",
|
||||
6 => "Zu Fuß"
|
||||
);
|
||||
|
||||
$arrIcon = array (
|
||||
0 => "<i class='wa bg-primary fa fa-info'></i>",
|
||||
1 => "<i class='wa bg-danger fa fa-male'></i>",
|
||||
2 => "<i class='wa bg-danger fa fa-bicycle'></i>",
|
||||
3 => "<i class='wa bg-primary fa fa-bus'></i>",
|
||||
|
@ -45,15 +45,15 @@
|
||||
<div class="card-body">
|
||||
<p> Die Unfallkarte basiert auf Daten des Statistischen Bundesamtes:</p>
|
||||
<p> </p>
|
||||
<div><img style="width:220px" src="<?=$strLogo?>" alt="Logo"></div>
|
||||
Weiter Erläuterungen unter <a href="https://unfallatlas.statistikportal.de" target="_blank">https://unfallatlas.statistikportal.de</a>
|
||||
<p> </p>
|
||||
<p>
|
||||
<?= stripslashes(nl2br($strImpressum)) ?>
|
||||
|
||||
</p>
|
||||
<p><a href="<?=$strUrl?>"><?=$strUrlBez?></a></p>
|
||||
|
||||
|
||||
<p> </p>
|
||||
Anfragen an <a href="mailto:<?=$contactEmail?>"><?=$contactEmail?></a>
|
||||
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<!-- Bitte nicht entfernen -->
|
||||
|
99
index.php
99
index.php
@ -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() {
|
||||
|
@ -8,18 +8,16 @@ function generate_tooltip_description($row) {
|
||||
global $arrLicht;
|
||||
global $arrRad;
|
||||
global $arrStrassenzustand;
|
||||
global $arrWochentage;
|
||||
global $db;
|
||||
|
||||
//$description = $row['description'];
|
||||
|
||||
//$id = $row['id'];
|
||||
//$topic = $row['topic'];
|
||||
//$numDatum= strtotime($row['created_at']);
|
||||
//$datum= date("d.m.Y",$numDatum);
|
||||
|
||||
|
||||
|
||||
$strDescription = "<h3>Daten zum Unfall</h3>";
|
||||
$description = "<strong>Unfallkategorie:</strong> ".$arrCategory[$row['UKATEGORIE']]."<br>";
|
||||
$description .= "<strong>Unfallmonat/Jahr:</strong> ".$row['UMONAT']."/".$row['UJAHR']."<br>";
|
||||
$description .= "<strong>Tag/Stunde:</strong> ".$arrWochentage[$row['UWOCHENTAG']]." ".$row['USTUNDE']." Uhr<br>";
|
||||
$description .= "<strong>Unfallart:</strong> ".$arrUnfallart[$row['UART']]."<br>";
|
||||
$description .= "<strong>Unfalltyp:</strong> ".$arrUnfalltyp[$row['UTYP1']]."<br>";
|
||||
$description .= "<strong>Lichtverhältnisse:</strong> ".$arrLicht[$row['ULICHTVERH']]."<br>";
|
||||
|
Loading…
Reference in New Issue
Block a user