Daten 2020

This commit is contained in:
Walter Hupfeld 2021-07-31 20:56:13 +02:00
parent bb56a1fb57
commit 592e8514da
5 changed files with 26 additions and 22 deletions

View File

@ -1,5 +1,5 @@
php_value upload_max_filesize 10M
php_value post_max_size 10M
#php_value upload_max_filesize 10M
#php_value post_max_size 10M
RedirectMatch 404 /\.git
RedirectMatch 404 /db

View File

@ -4,7 +4,7 @@ date_default_timezone_set('UTC');
$dbFilename = "db/unfallorte";
$db = new SQLite3($dbFilename);
$strTitle = "Unfallkarte Hamm 2019";
$strTitle = "Unfallkarte Hamm ";
$strIntroText = "Unfallkarte für die Stadt Hamm basierend auf den Daten des Statistischen Bundesamtes.";
$numInfoLat =51.66;
$numInfoLng =7.825;

Binary file not shown.

View File

@ -5,8 +5,10 @@
$strIntro ="<h4>".$strTitle."</h4>";
$strIntro .= nl2br2($strIntroText);
$numYear=2020;
$numVehicle = (isset($_GET['v'])) ? (int) $_GET['v'] : 1;
$numYear = (isset($_GET['year'])) ? (int) $_GET['year'] : $numYear;
switch ($numVehicle) {
case 1:
@ -38,7 +40,9 @@
$topic=2;
}
$strSQL="SELECT * FROM Unfallorte2019_Hamm WHERE ".$strWhere;
$strYear = " AND UJAHR='".$numYear."' ";
$strSQL="SELECT * FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear;
$result = $db->query($strSQL);
@ -96,6 +100,8 @@
<!-- Navbar -->
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#"><?= $strTitle ?></a>
<a class="navbar-brand" href="index.php?year=2019&v=<?=$numVehicle?>">2019</a>
<a class="navbar-brand" href="index.php?year=2020&v=<?=$numVehicle?>">2020</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbars" aria-controls="navbars" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
@ -108,7 +114,7 @@
?>
<li class="nav-item <?=$strActive?>">
<a class="nav-link" href="index.php?v=<?=$key?>"><?=$strVehicle?>
<a class="nav-link" href="index.php?v=<?=$key?>&year=<?=$numYear?>"><?=$strVehicle?>
<span class="sr-only">(current)</span> </a>
<?php endforeach; ?>
@ -133,10 +139,10 @@
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
<div class="sidebar-sticky">
<h1>Jahr <?= $numYear?></h2>
<h2>Unfälle mit <?= $arrVehicles_pl[$numVehicle]; ?> </h2>
<ul class="nav flex-column">
<?php echo get_statistics($numVehicle,$strWhere); ?>
<?php echo get_statistics($numVehicle,$strWhere,$strYear); ?>
</ul>
</div>

View File

@ -11,8 +11,6 @@ function generate_tooltip_description($row) {
global $arrWochentage;
global $db;
$strDescription = "<h3>Daten zum Unfall</h3>";
$description = "<strong>Unfallkategorie:</strong> ".$arrCategory[$row['UKATEGORIE']]."<br>";
@ -85,7 +83,7 @@ function nl2br2($string) {
}
function get_statistics($numVehicle,$strWhere) {
function get_statistics($numVehicle,$strWhere,$strYear) {
global $db;
global $arrUnfallart;
global $arrUnfalltyp;
@ -97,8 +95,8 @@ function nl2br2($string) {
sum(IstGkfz) as lkw,
sum(IstSonstige) as sonstiges,
count(*) as summe
FROM Unfallorte2019_Hamm
WHERE ".$strWhere;
FROM Unfallorte_Hamm
WHERE ".$strWhere.$strYear;
$result = $db->query($strSQL);
@ -115,38 +113,38 @@ function nl2br2($string) {
}
/*
$strSQL="SELECT count(*) as count
FROM Unfallorte2019_Hamm
FROM Unfallorte_Hamm
WHERE IstRad=0 and IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0";
*/
switch ($numVehicle) {
case 1:
case 0:
$strSQL="SELECT count(*) as count FROM Unfallorte2019_Hamm
$strSQL="SELECT count(*) as count FROM Unfallorte_Hamm
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0";
break;
case 2:
$strSQL="SELECT count(*) as count FROM Unfallorte2019_Hamm
$strSQL="SELECT count(*) as count FROM Unfallorte_Hamm
WHERE IstRad=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0";
break;
case 3:
$strSQL="SELECT count(*) as count FROM Unfallorte2019_Hamm
$strSQL="SELECT count(*) as count FROM Unfallorte_Hamm
WHERE IstPKW=0 and IstRad=0 and IstKrad and IstGkfz=0 and IstSonstige=0";
break;
case 4:
$strSQL="SELECT count(*) as count FROM Unfallorte2019_Hamm
$strSQL="SELECT count(*) as count FROM Unfallorte_Hamm
WHERE IstPKW=0 and IstFuss=0 and IstRad=0 and IstGkfz=0 and IstSonstige=0";
break;
case 5:
$strSQL="SELECT count(*) as count FROM Unfallorte2019_Hamm
$strSQL="SELECT count(*) as count FROM Unfallorte_Hamm
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstRad=0 and IstSonstige=0";
break;
case 6:
$strSQL="SELECT count(*) as count FROM Unfallorte2019_Hamm
$strSQL="SELECT count(*) as count FROM Unfallorte_Hamm
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstRad=0";
break;
}
$result = $db->query($strSQL);
$result = $db->query($strSQL.$strYear);
if ($row = $result->fetchArray()) {
$strTable.="<tr><td>Alleinunfälle und Unfälle mit geicher Fahrzeugart</td><td>".$row['count']."</td></tr>";
}
@ -154,7 +152,7 @@ function nl2br2($string) {
//Unfallart
$strSQL="SELECT UART, count(UART) as anz FROM Unfallorte2019_Hamm WHERE ".$strWhere." GROUP BY UART";
$strSQL="SELECT UART, count(UART) as anz FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear." GROUP BY UART";
$strTable.="<h5>Unfallart</h5>";
$strTable.="<table class='statistik'>";
$result = $db->query($strSQL);
@ -165,7 +163,7 @@ function nl2br2($string) {
//Unfallart
$strSQL="SELECT UTYP1, count(UTYP1) as anz FROM Unfallorte2019_Hamm WHERE ".$strWhere." GROUP BY UTYP1";
$strSQL="SELECT UTYP1, count(UTYP1) as anz FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear." GROUP BY UTYP1";
$strTable.="<h5>Unfalltyp</h5>";
$strTable.="<table class='statistik'>";
$result = $db->query($strSQL);