refine
This commit is contained in:
parent
6a550d2fb8
commit
a98f0769bc
@ -83,6 +83,18 @@ $arrTopic = array (
|
|||||||
5 => "Lkw-Verkehr"
|
5 => "Lkw-Verkehr"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$arrBeteiligte = array (
|
||||||
|
"rad" => "Fahrräder",
|
||||||
|
"pkw" => "PKW",
|
||||||
|
"fuss" => "Fussgänger",
|
||||||
|
"krad" => "Krafträder",
|
||||||
|
"lkw" => "LKW",
|
||||||
|
"sonstiges" => "Sonstiges",
|
||||||
|
"gleich" => "Alleinunfälle und Unfälle mit geicher Fahrzeugart"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$arrMarkerType = array (
|
$arrMarkerType = array (
|
||||||
0=>"infoMarker",
|
0=>"infoMarker",
|
||||||
1=>"pedestrianMarker",
|
1=>"pedestrianMarker",
|
||||||
|
@ -19,35 +19,18 @@
|
|||||||
$strName=$row['Name'];
|
$strName=$row['Name'];
|
||||||
$numFlaeche=$row['Flaeche'];
|
$numFlaeche=$row['Flaeche'];
|
||||||
$numPopulation=$row['Einwohner'];
|
$numPopulation=$row['Einwohner'];
|
||||||
}
|
$numRegbez=$row['UREGBEZ'];
|
||||||
|
$numKreis=$row['UKREIS'];
|
||||||
|
$numGemeinde=$row['UGEMEINDE'];
|
||||||
|
} else {exit;}
|
||||||
|
|
||||||
$strLocation=" AND ULAND=$numLand AND UREGBEZ=$numRegbez AND UKREIS=$numKreis AND UGEMEINDE=$numGemeinde ";
|
$strLocation=" AND ULAND=$numLand AND UREGBEZ=$numRegbez AND UKREIS=$numKreis AND UGEMEINDE=$numGemeinde ";
|
||||||
|
$resultUnfallzahlen = get_unfallzahlen($numJahr,$strLocation);
|
||||||
|
$resultUnfallart = get_unfallart($numJahr,$strLocation);
|
||||||
|
$resultUnfalltyp = get_unfalltyp($numJahr,$strLocation);
|
||||||
|
$resultBeteiligte = get_beteiligte($numJahr,$strLocation);
|
||||||
|
$numGesamt=0;
|
||||||
|
|
||||||
//Unfallzahlen
|
|
||||||
|
|
||||||
$strWhat=" SUM(UKATEGORIE=1) as Tote,
|
|
||||||
SUM(UKATEGORIE=2) as Schwerverletzte,
|
|
||||||
SUM(UKATEGORIE=3) as Leichtverletzte,
|
|
||||||
COUNT(*) as gesamt";
|
|
||||||
$strWhere= " IstRad=1 ";
|
|
||||||
$strSQL="SELECT $strWhat FROM data
|
|
||||||
WHERE $strWhere
|
|
||||||
AND ULAND=:land AND UREGBEZ=:regbez AND UKREIS=:kreis
|
|
||||||
AND UGEMEINDE=:gemeinde AND UJAHR=:jahr";
|
|
||||||
|
|
||||||
$result= $db->prepare($strSQL);
|
|
||||||
$result->bindParam(":land",$numLand);
|
|
||||||
$result->bindParam(":regbez",$numRegbez);
|
|
||||||
$result->bindParam(":kreis",$numKreis);
|
|
||||||
$result->bindParam(":gemeinde",$numGemeinde);
|
|
||||||
$result->bindParam(":jahr",$numJahr);
|
|
||||||
$result->execute();
|
|
||||||
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
|
||||||
$numTote=$row['Tote'];
|
|
||||||
$numSchwerverletzte=$row['Schwerverletzte'];
|
|
||||||
$numLeichtverletzte=$row['Leichtverletzte'];
|
|
||||||
$numGesamt=$row['gesamt'];
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
@ -105,9 +88,14 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
<table class="table table-sm">
|
<table class="table table-sm">
|
||||||
<tr><th>Unfall mit Getöteten</th><td><?=$numTote?></td></tr>
|
<?php
|
||||||
<tr><th>Unfall mit Schwerverletztem</th><td><?=$numSchwerverletzte?></td></tr>
|
//DEBUG echo "<pre>"; print_r($resultUnfallzahlen);echo "</pre>";
|
||||||
<tr><th>Unfall mit Leichtverletztem</th><td><?=$numLeichtverletzte?></td></tr>
|
$numGesamt=0;
|
||||||
|
foreach ($resultUnfallzahlen as $row) {
|
||||||
|
echo "<tr><td>".$arrCategory[$row['UKATEGORIE']]."</td><td>".$row['anz']."</td></tr>\n";
|
||||||
|
$numGesamt+=$row['anz'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
<tr><th>Gesamt</th><td><strong><?=$numGesamt?></strong></td></tr>
|
<tr><th>Gesamt</th><td><strong><?=$numGesamt?></strong></td></tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -122,14 +110,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
<h4>Unfallbeteiligte</h4>
|
<h4>Unfallbeteiligte</h4>
|
||||||
|
<table class='table table-sm'>
|
||||||
<?php
|
<?php
|
||||||
echo get_beteiligte("",2022,$strLocation)
|
// DEBUG: echo "<pre>"; print_r($resultBeteiligte);echo "</pre>";
|
||||||
|
foreach ($resultBeteiligte as $key => $numCount) {
|
||||||
|
echo "<tr><td>".$arrBeteiligte[$key]."</td><td>".$numCount."</td></tr>\n";
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -137,18 +128,26 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
<h4>Unfalltyp</h4>
|
<h4>Unfalltyp</h4>
|
||||||
|
<table class='table table-sm'>
|
||||||
<?php
|
<?php
|
||||||
echo get_unfalltyp("",2022,$strLocation);
|
foreach ($resultUnfalltyp as $row) {
|
||||||
|
echo "<tr><td>".$arrUnfalltyp[$row['UTYP1']]."</td><td>".$row['anz']."</td></tr>\n";
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
<h4>Unfallart</h4>
|
<h4>Unfallart</h4>
|
||||||
|
<table class='table table-sm'>
|
||||||
<?php
|
<?php
|
||||||
echo get_unfallart("",2022,$strLocation);
|
foreach ($resultUnfallart as $row) {
|
||||||
|
echo "<tr><td>".$arrUnfallart[$row['UART']]."</td><td>".$row['anz']."</td></tr>\n";
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,65 +1,55 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function get_beteiligte($strWhere,$strYear,$strLocation) {
|
function get_unfallzahlen($numYear,$strLocation) {
|
||||||
|
global $db;
|
||||||
|
$strSQL="SELECT
|
||||||
|
UKATEGORIE, count(UKATEGORIE) as anz
|
||||||
|
FROM data
|
||||||
|
WHERE IstRad=1 AND UJAHR=$numYear $strLocation
|
||||||
|
GROUP BY UKATEGORIE";
|
||||||
|
$result = $db->query($strSQL);
|
||||||
|
$arrResult = $result->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
return $arrResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_beteiligte($numYear,$strLocation) {
|
||||||
global $db;
|
global $db;
|
||||||
$numVehicle=1;
|
|
||||||
$strSQL="SELECT
|
$strSQL="SELECT
|
||||||
sum(IstRad) as rad,
|
sum(IstRad) as rad,
|
||||||
sum(IstPKW) as pkw,
|
sum(IstPKW) as pkw,
|
||||||
sum(IstFuss) as fuss,
|
sum(IstFuss) as fuss,
|
||||||
sum(IstKrad) as krad,
|
sum(IstKrad) as krad,
|
||||||
sum(IstGkfz) as lkw,
|
sum(IstGkfz) as lkw,
|
||||||
sum(IstSonstige) as sonstiges,
|
sum(IstSonstige) as sonstiges
|
||||||
count(*) as summe
|
|
||||||
FROM data
|
FROM data
|
||||||
WHERE istRad=1 AND UJAHR =".$strYear.$strLocation;
|
WHERE istRad=1 AND UJAHR =".$numYear.$strLocation;
|
||||||
$result = $db->query($strSQL);
|
$result = $db->query($strSQL);
|
||||||
|
if ($row = $result->fetch(PDO::FETCH_ASSOC)) { $arrResult = $row; }
|
||||||
|
|
||||||
$strTable="<table class='table table-sm'>";
|
|
||||||
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
|
||||||
$strTable.="<tr><td>Fahrräder</td><td>".$row['rad']."</td></tr>";
|
|
||||||
$strTable.="<tr><td>PKW</td><td>".$row['pkw']."</td></tr>";
|
|
||||||
$strTable.="<tr><td>Fussgänger</td><td>".$row['fuss']."</td></tr>";
|
|
||||||
$strTable.="<tr><td>Krafträder</td><td>".$row['krad']."</td></tr>";
|
|
||||||
$strTable.="<tr><td>LKW</td><td>".$row['lkw']."</td></tr>\n";
|
|
||||||
$strTable.="<tr><td>Sonstiges</td><td>".$row['sonstiges']."</td></tr>\n";
|
|
||||||
}
|
|
||||||
$strSQL="SELECT count(*) as count FROM data
|
$strSQL="SELECT count(*) as count FROM data
|
||||||
WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0".$strLocation;
|
WHERE UJAHR=".$numYear." AND IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0
|
||||||
|
and IstSonstige=0 ".$strLocation;
|
||||||
$result = $db->query($strSQL." AND UJAHR=".$strYear);
|
$result = $db->query($strSQL);
|
||||||
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$strTable.="<tr><td>Alleinunfälle und Unfälle mit geicher Fahrzeugart</td><td>".$row['count']."</td></tr>";
|
$arrResult["gleich"]=$row['count'];
|
||||||
}
|
}
|
||||||
$strTable.="</table>";
|
return $arrResult;
|
||||||
return $strTable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_unfalltyp($strWhere,$strYear,$strLocation){
|
function get_unfalltyp($numYear,$strLocation){
|
||||||
global $db;
|
global $db;
|
||||||
global $arrUnfalltyp;
|
$strSQL="SELECT UTYP1, count(UTYP1) as anz FROM data WHERE istRad=1 AND UJAHR=".$numYear.$strLocation." GROUP BY UTYP1";
|
||||||
$numVehicle=1;
|
|
||||||
$strSQL="SELECT UTYP1, count(UTYP1) as anz FROM data WHERE istRad=1 AND UJAHR=".$strYear.$strLocation." GROUP BY UTYP1";
|
|
||||||
$strTable="<table class='table table-sm'>";
|
|
||||||
$result = $db->query($strSQL);
|
$result = $db->query($strSQL);
|
||||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
$arrResult = $result->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$strTable.="<tr><td>".$arrUnfalltyp[$row['UTYP1']]."</td><td>".$row['anz']."</td></tr>\n";
|
return $arrResult;
|
||||||
}
|
|
||||||
$strTable.="</table>";
|
|
||||||
return $strTable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_unfallart($strWhere,$strYear,$strLocation){
|
function get_unfallart($numYear,$strLocation){
|
||||||
global $db;
|
global $db;
|
||||||
global $arrUnfallart;
|
$strSQL="SELECT UART, count(UART) as anz FROM data WHERE istRad=1 AND UJAHR=".$numYear.$strLocation." GROUP BY UART";
|
||||||
$numVehicle=1;
|
|
||||||
$strSQL="SELECT UART, count(UART) as anz FROM data WHERE istRad=1 AND UJAHR=".$strYear.$strLocation." GROUP BY UART";
|
|
||||||
$strTable="<table class='table table-sm'>";
|
|
||||||
$result = $db->query($strSQL);
|
$result = $db->query($strSQL);
|
||||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
$arrResult = $result->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$strTable.="<tr><td>".$arrUnfallart[$row['UART']]."</td><td>".$row['anz']."</td></tr>\n";
|
return $arrResult;
|
||||||
}
|
|
||||||
$strTable.="</table>";
|
|
||||||
return $strTable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user