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 upload_max_filesize 10M
php_value post_max_size 10M #php_value post_max_size 10M
RedirectMatch 404 /\.git RedirectMatch 404 /\.git
RedirectMatch 404 /db RedirectMatch 404 /db

View File

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

Binary file not shown.

View File

@ -5,8 +5,10 @@
$strIntro ="<h4>".$strTitle."</h4>"; $strIntro ="<h4>".$strTitle."</h4>";
$strIntro .= nl2br2($strIntroText); $strIntro .= nl2br2($strIntroText);
$numYear=2020;
$numVehicle = (isset($_GET['v'])) ? (int) $_GET['v'] : 1; $numVehicle = (isset($_GET['v'])) ? (int) $_GET['v'] : 1;
$numYear = (isset($_GET['year'])) ? (int) $_GET['year'] : $numYear;
switch ($numVehicle) { switch ($numVehicle) {
case 1: case 1:
@ -38,7 +40,9 @@
$topic=2; $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); $result = $db->query($strSQL);
@ -96,6 +100,8 @@
<!-- Navbar --> <!-- Navbar -->
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"> <nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#"><?= $strTitle ?></a> <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"> <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> <span class="navbar-toggler-icon"></span>
</button> </button>
@ -108,7 +114,7 @@
?> ?>
<li class="nav-item <?=$strActive?>"> <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> <span class="sr-only">(current)</span> </a>
<?php endforeach; ?> <?php endforeach; ?>
@ -133,10 +139,10 @@
<nav class="col-md-2 d-none d-md-block bg-light sidebar"> <nav class="col-md-2 d-none d-md-block bg-light sidebar">
<div class="sidebar-sticky"> <div class="sidebar-sticky">
<h1>Jahr <?= $numYear?></h2>
<h2>Unfälle mit <?= $arrVehicles_pl[$numVehicle]; ?> </h2> <h2>Unfälle mit <?= $arrVehicles_pl[$numVehicle]; ?> </h2>
<ul class="nav flex-column"> <ul class="nav flex-column">
<?php echo get_statistics($numVehicle,$strWhere); ?> <?php echo get_statistics($numVehicle,$strWhere,$strYear); ?>
</ul> </ul>
</div> </div>

View File

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