diff --git a/css/style.css b/css/style.css index 9d972fe..7baa7f9 100644 --- a/css/style.css +++ b/css/style.css @@ -91,4 +91,6 @@ i.wa { display:none; } +h5 {margin-top:15px;} + .statistik td, th {border: 1px solid grey; font-size: smaller;} \ No newline at end of file diff --git a/index.php b/index.php index 401f42f..b296e55 100644 --- a/index.php +++ b/index.php @@ -113,7 +113,7 @@ $strDescription=generate_tooltip_description($row); $strCategory=generate_category($row); $arrMarker[]="marker[".$id."] = [L.marker([".$numLat."," .$numLng."]," - ." { icon: ".$arrMarkerType[$topic]." }),'check_".$strCategory."'];\n" + ." { icon: ".$arrMarkerType[$topic]." }),'".$strCategory."'];\n" ."marker[".$id."][0].addTo(mymap);\n " ."marker[".$id."][0].bindPopup('".$strDescription."');"; $numId++; @@ -311,25 +311,54 @@ if (jQuery(this).prop("checked")) { jQuery.each(marker, function(key, value) { + console.log(value); if (value) { - if (filter.match(value[1])) - { value[0].addTo(mymap); } + if (filter.match(value[1])) { value[0].addTo(mymap); } } }); } else { jQuery.each(marker, function(key, value) { if (value) { - if (filter.match(value[1])) - { value[0].remove(); } + if (filter.match(value[1])) { value[0].remove(); } } }); } }) + $('#check_art').click(function(){ + if (jQuery(this).prop("checked")) { + $('.uart').prop( "checked", true ); + } else { + $('.uart').prop( "checked", false ); + } + }); + + $('#check_kat').click(function(){ + console.log("test"); + if (jQuery(this).prop("checked")) { + $('.ukat').prop( "checked", true ); + } else { + $('.ukat').prop( "checked", false ); + } + }); + + $('#check_typ').click(function(){ + if (jQuery(this).prop("checked")) { + $('.utyp').prop( "checked", true ); + } else { + $('.utyp').prop( "checked", false ); + } + }); + + $('#check_art').click(function(){ + if (jQuery(this).prop("checked")) { + $('.uart').prop( "checked", true ); + } else { + $('.uart').prop( "checked", false ); + } + }); - function myFunction(chosen) { - console.log(chosen); -} + diff --git a/lib/functions.php b/lib/functions.php index 26c67de..a9c3f9f 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -11,7 +11,6 @@ function generate_tooltip_description($row) { global $arrWochentage; global $db; - $strDescription = "

Daten zum Unfall

"; $description = "Unfallkategorie: ".$arrCategory[$row['UKATEGORIE']]."
"; $description .= "Unfallmonat/Jahr: ".$row['UMONAT']."/".$row['UJAHR']."
"; @@ -29,17 +28,19 @@ function generate_tooltip_description($row) { if ($row['IstSonstige']) $description .="mit Beteiligung eines oben nicht genannten Verkehrsmittels"; $strDescription .= nl2br2($description); - return $strDescription; } function generate_category($row) { - return "UART_".$row['UART']."|UKATEGORIE_".$row['UKATEGORIE']; + $strReturn = "UART_".$row['UART']."|UKATEGORIE_".$row['UKATEGORIE']."|UTYP_".$row['UTYP1']; + if ($row['IstRad']) $strReturn .="|UBETEILIGT_RAD"; + if ($row['IstPKW']) $strReturn .="|UBETEILIGT_PKW"; + if ($row['IstFuss']) $strReturn .="|UBETEILIGT_FUSS"; + if ($row['IstKrad']) $strReturn .="|UBETEILIGT_KRAD"; + if ($row['IstGkfz']) $strReturn .="|UBETEILIGT_LKW"; + if ($row['IstSonstige']) $strReturn .="|UBETEILIGT_SONSTIGES"; + return $strReturn; } -/** - * reads gps location form picture data - */ - function read_gps_location($file){ @@ -96,13 +97,13 @@ function nl2br2($string) { global $arrCategory; global $strLocation; - $strTable="
Unfallkategorie
"; + $strTable="
Unfallkategorie
"; $strTable.=""; $strSQL="SELECT UKATEGORIE, count(UKATEGORIE) as anz FROM data WHERE ".$strWhere.$strYear.$strLocation." GROUP BY UKATEGORIE"; $result = $db->query($strSQL); while ($row = $result->fetch(PDO::FETCH_ASSOC)) { - $strTable.="" + $strTable.="" ."\n"; } @@ -121,16 +122,16 @@ function nl2br2($string) { WHERE ".$strWhere.$strYear.$strLocation; $result = $db->query($strSQL); - $strTable.="
Unfallbeteiligte
"; + $strTable.="
Unfallbeteiligte
"; $strTable.="
".$arrCategory[$row['UKATEGORIE']]."".$row['anz']."
"; //$strTable.=""; while ($row = $result->fetch(PDO::FETCH_ASSOC)) { - $strTable.=""; - $strTable.=""; - $strTable.=""; - $strTable.=""; - $strTable.="\n"; - $strTable.="\n"; + $strTable.=""; + $strTable.=""; + $strTable.=""; + $strTable.=""; + $strTable.="\n"; + $strTable.="\n"; } /* @@ -168,32 +169,37 @@ function nl2br2($string) { $result = $db->query($strSQL.$strYear); if ($row = $result->fetch(PDO::FETCH_ASSOC)) { - $strTable.=""; + $strTable.=""; } $strTable.="
UnfallbeteiligteAnzahl
Fahrräder".$row['rad']."
PKWs".$row['pkw']."
Fussgänger".$row['fuss']."
Krafträder".$row['krad']."
LKWs".$row['lkw']."
Sonstiges".$row['sonstiges']."
Fahrräder".$row['rad']."
PKWs".$row['pkw']."
Fussgänger".$row['fuss']."
Krafträder".$row['krad']."
LKWs".$row['lkw']."
Sonstiges".$row['sonstiges']."
Alleinunfälle und Unfälle mit geicher Fahrzeugart".$row['count']."
Alleinunfälle und Unfälle mit geicher Fahrzeugart".$row['count']."
"; + + + //Unfalltyp + + $strSQL="SELECT UTYP1, count(UTYP1) as anz FROM data WHERE ".$strWhere.$strYear.$strLocation." GROUP BY UTYP1"; + $strTable.="
Unfalltyp
"; + $strTable.=""; + $result = $db->query($strSQL); + while ($row = $result->fetch(PDO::FETCH_ASSOC)) { + $strTable.="" + ."\n"; + } + $strTable.="
".$arrUnfalltyp[$row['UTYP1']]."".$row['anz']."
"; + //Unfallart $strSQL="SELECT UART, count(UART) as anz FROM data WHERE ".$strWhere.$strYear.$strLocation." GROUP BY UART"; - $strTable.="
Unfallart
"; + $strTable.="
Unfallart
"; $strTable.=""; $result = $db->query($strSQL); while ($row = $result->fetch(PDO::FETCH_ASSOC)) { - $strTable.=//"" - "\n"; + $strTable.="" + ."\n"; } $strTable.="
".$arrUnfallart[$row['UART']]."".$row['anz']."
".$arrUnfallart[$row['UART']]."".$row['anz']."
"; - //Unfallart - - $strSQL="SELECT UTYP1, count(UTYP1) as anz FROM data WHERE ".$strWhere.$strYear.$strLocation." GROUP BY UTYP1"; - $strTable.="
Unfalltyp
"; - $strTable.=""; - $result = $db->query($strSQL); - while ($row = $result->fetch(PDO::FETCH_ASSOC)) { - $strTable.="\n"; - } - $strTable.="
".$arrUnfalltyp[$row['UTYP1']]."".$row['anz']."
"; + //Erläuterung $strTable.="Unfalltpyen
"; $strTable.="Unfallbeschreibung
";