You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
5.3 KiB

<?php
require_once("../config.php");
require_once("../lib/attributes.php");
require_once("functions.php");
$numLand=5; // NRW
$strName="NRW";
$numJahr=$numLatestYear;
$strLocation=" AND ULAND=$numLand ";
// Name, Population und Fläche der Gemeinde
$result= $db->prepare("SELECT sum(Flaeche) as Flaeche, sum(Einwohner) as Einwohner FROM community WHERE ULAND=:land");
$result->bindParam(":land",$numLand);
$result->execute();
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$numFlaeche=round($row['Flaeche'],0);
$numPopulation=$row['Einwohner'];
} else {exit;}
$resultUnfallzahlen = get_unfallzahlen($numJahr,$strLocation);
$resultUnfallart = get_unfallart($numJahr,$strLocation);
$resultUnfalltyp = get_unfalltyp($numJahr,$strLocation);
$resultBeteiligte = get_beteiligte($numJahr,$strLocation);
$resultVerlauf = get_verlauf($strLocation);
$numGesamt=0;
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Fahrrad-Unfallstatistik NRW</title>
<link rel="stylesheet" href="../css/bootstrap.min.css"/>
<script src="../js/jquery.min.js"></script>
<script src="../js/highcharts.js"></script>
<script src="../js/bootstrap.min.js"></script>
<style>
.rechts {text-align:right;background-color:#eee;}
.l {border-left: 1px solid black; }
</style>
</head>
<body>
<?php include("navbar.php"); ?>
<div class="container" style="margin-top:4em;">
<h1>Fahrradunfälle in <?=$strName?></h2>
<p>Einwohnerzahl: <?=number_format($numPopulation,0,",",".")?>&nbsp;&nbsp; Fläche: <?=number_format($numFlaeche,2,",",".")?> km<sup>2</sup></p>
<!-- Unfallverlauf -->
<div class="row">
<div class="col-5">
<h4>Unfallverlauf von <?=$numLatestYear?> bis <?=$numStartYear?></h4>
<table class='table table-sm'>
<tr><th></th><th>2022</th><th>2021</th><th>2020</th><th>2019</th></tr>
<tr><td><?= $arrCategory[1]?></td><?= get_row($resultVerlauf,1) ?></tr>
<tr><td><?= $arrCategory[2]?></td><?= get_row($resultVerlauf,2) ?></tr>
<tr><td><?= $arrCategory[3]?></td><?= get_row($resultVerlauf,3) ?></tr>
<tr><th>Gesamt</th><?= get_row($resultVerlauf,0) ?></tr>
</table>
</div>
<div class="col-7">
<div id="c_unfallverlauf"></div>
</div>
</div>
<!-- Unfallzahlen -->
<div class="row">
<div class="col-5">
<h4>Unfallzahlen <?=$numJahr?></h4>
<table class="table table-sm">
<?php
//DEBUG echo "<pre>"; print_r($resultUnfallzahlen);echo "</pre>";
$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>
</table>
<table class="table table-sm">
<tr><th>Quote pro Tausend Einwohner</th><td><?= round($numGesamt/$numPopulation*1000,2) ?></td></tr>
<tr><th>Quote pro Fläche</th><td><?= number_format($numGesamt/$numFlaeche,2,",",".") ?> /km<sup>2</sup></td></tr>
</table>
</div>
<div class="col-7">
<div id="c_unfallzahlen"></div>
</div>
</div>
<!-- Unfallbeteilgte -->
<div class="row">
<div class="col-5">
<h4>Unfallbeteiligte</h4>
<table class='table table-sm'>
<?php
// 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 class="col-7">
<div id="c_unfallbeteiligte"></div>
</div>
</div>
<!-- Unfalltyp -->
<div class="row">
<div class="col-5">
<h4>Unfalltyp</h4>
<table class='table table-sm'>
<?php
foreach ($resultUnfalltyp as $row) {
echo "<tr><td>".$arrUnfalltyp[$row['UTYP1']]."</td><td>".$row['anz']."</td></tr>\n";
}
?>
</table>
</div>
<div class="col-7">
<div id="c_unfalltyp"></div>
</div>
</div>
<!-- Unfallarten -->
<div class="row">
<div class="col-5">
<h4>Unfallart</h4>
<table class='table table-sm'>
<?php
foreach ($resultUnfallart as $row) {
echo "<tr><td>".$arrUnfallart[$row['UART']]."</td><td>".$row['anz']."</td></tr>\n";
}
?>
</table>
</div>
<div class="col-7">
<div id="c_unfallarten"></div>
</div>
</div>
</div>
</body>
<?php include("highchart.php"); ?>
</html>