This commit is contained in:
Walter Hupfeld 2023-10-06 12:01:06 +02:00
commit 31d531d8bd
3 changed files with 54 additions and 75 deletions

View File

@ -91,6 +91,7 @@ i.wa {
display:none;
}
h5 {margin-top:15px;}
h5 {margin-top:8px;}
.statistik td, th {border: 1px solid grey; font-size: smaller;}
.statistik td, th {border: 1px solid grey; font-size: smaller;}

View File

@ -225,6 +225,7 @@
<script>
// Map ----------------------------------------------------------------------
var mymap = L.map('mapid').setView([<?=$numInfoLat ?>, <?=$numInfoLng ?>], <?=$numZoom ?>);
var mapLink = '<a href="http://openstreetmap.org">OpenStreetMap</a>';
@ -307,8 +308,6 @@
$('.check').click(function() {
filter = this.name;
console.log(filter);
if (jQuery(this).prop("checked")) {
jQuery.each(marker, function(key, value) {
if (value) {
@ -326,7 +325,6 @@
function check_all(){
jQuery.each(marker, function(key, value) {
console.log(value);
if (value) { value[0].addTo(mymap); }
});
};
@ -334,56 +332,39 @@
function uncheck_all()
{
jQuery.each(marker, function(key, value) {
console.log(value);
if (value) { value[0].remove(); }
});
};
$('#check_art').click(function(){
if (jQuery(this).prop("checked")) {
$('.uart').prop( "checked", true );
check_all();
} else {
$('.uart').prop( "checked", false );
uncheck_all();
}
});
$('#check_kat').click(function(){
console.log("test");
if (jQuery(this).prop("checked")) {
$('.ukat').prop( "checked", true );
check_all();
} else {
$('.ukat').prop( "checked", false );
uncheck_all();
}
});
$('#check_typ').click(function(){
if (jQuery(this).prop("checked")) {
$('.utyp').prop( "checked", true );
check_all();
} else {
$('.utyp').prop( "checked", false );
uncheck_all();
}
});
$('#check_art').click(function(){
if (jQuery(this).prop("checked")) {
$('.uart').prop( "checked", true );
check_all();
} else {
$('.uart').prop( "checked", false );
uncheck_all();
}
});
$('input[type=radio][name=kategorie]').on('change', function() {
$('.td_ubet').hide();
$('.td_utyp').hide();
$('.td_uart').hide();
$('.td_ukat').hide();
check_all();
$("input[type=checkbox]").prop('checked', $(this).prop('checked'));
switch ($(this).val()) {
case 'UART':
$('.td_uart').show();
break;
case 'UKAT':
$('.td_ukat').show();
break;
case 'UTYP':
$('.td_utyp').show();
break;
case 'UBET':
$('.td_ubet').show();
$('.veh_<?=$numVehicle?>').hide();
break;
}
});
$('.td_ubet').hide();
$('.td_utyp').hide();
$('.td_uart').hide();
$('.td_ukat').show();
$('input:radio[name=kategorie]').val(['UKAT']);
</script>
</body>
</html>

View File

@ -39,6 +39,7 @@ function generate_category($row) {
if ($row['IstKrad']) $strReturn .="|UBETEILIGT_KRAD";
if ($row['IstGkfz']) $strReturn .="|UBETEILIGT_LKW";
if ($row['IstSonstige']) $strReturn .="|UBETEILIGT_SONSTIGES";
if (substr_count($strReturn, '|')==3) $strReturn.="|UBETEILIGT_SELBST";
return $strReturn;
}
@ -97,17 +98,21 @@ function nl2br2($string) {
global $arrCategory;
global $strLocation;
$strTable="<h5><input type='checkbox' id='check_kat' class='check_header' checked='checked'>Unfallkategorie</h5>";
// Unfallkategorie
$strTable="<h5><input type='radio' value='UKAT' name='kategorie' id='kategorie1' class='radio_header' checked='checked'>";
$strTable.="<label for='kategorie1'>Unfallkategorie</label></h5>";
$strTable.="<table class='statistik'>";
$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.="<tr><td><input type='checkbox' name='UKATEGORIE_".$row['UKATEGORIE']."' id='UKATEGORIE_".$row['UKATEGORIE']."' class='check ukat' checked='checked' ></td>"
$strTable.="<tr><td class='td_ukat'><input type='checkbox' name='UKATEGORIE_".$row['UKATEGORIE']."' id='UKATEGORIE_".$row['UKATEGORIE']."' class='check ukat' checked='checked' ></td>"
."<td>".$arrCategory[$row['UKATEGORIE']]."</td><td>".$row['anz']."</td></tr>\n";
}
$strTable.="</table>";
//Unfallbeteilgte
$strSQL="SELECT
sum(IstRad) as rad,
@ -121,22 +126,17 @@ function nl2br2($string) {
WHERE ".$strWhere.$strYear.$strLocation;
$result = $db->query($strSQL);
$strTable.="<h5><input type='checkbox' id='check_beteiligt' class='check_header' checked='checked'>Unfallbeteiligte</h5>";
$strTable.="<h5><input type='radio' value='UBET' name='kategorie' id='kategorie2' class='radio_header'>";
$strTable.="<label for='kategorie2'>Unfallbeteiligte</label></h5>";
$strTable.="<table class='statistik'>";
//$strTable.="<tr><th>Unfallbeteiligte</th><th>Anzahl</th></tr>";
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="<tr><td><input type='checkbox' name='UBETEILIGT_RAD' id='BETEILIGT_RAD' class='check' checked='checked' ></td><td>Fahrräder</td><td>".$row['rad']."</td></tr>";
$strTable.="<tr><td><input type='checkbox' name='UBETEILIGT_PKW' id='BETEILIGT_PKW' class='check' checked='checked' ></td><td>PKWs</td><td>".$row['pkw']."</td></tr>";
$strTable.="<tr><td><input type='checkbox' name='UBETEILIGT_FUSS' id='BETEILIGT_FUSS' class='check' checked='checked' ></td><td>Fussgänger</td><td>".$row['fuss']."</td></tr>";
$strTable.="<tr><td><input type='checkbox' name='UBETEILIGT_KRAD' id='BETEILIGT_KRAD' class='check' checked='checked' ></td><td>Krafträder</td><td>".$row['krad']."</td></tr>";
$strTable.="<tr><td><input type='checkbox' name='UBETEILIGT_LKW' id='BETEILIGT_LKW' class='check' checked='checked' ></td><td>LKWs</td><td>".$row['lkw']."</td></tr>\n";
$strTable.="<tr><td><input type='checkbox' name='UBETEILIGT_SONSTIGES' id='BETEILIGT_SONSTIGES' class='check' checked='checked' ></td><td>Sonstiges</td><td>".$row['sonstiges']."</td></tr>\n";
$strTable.="<tr><td class='td_ubet'><input type='checkbox' name='UBETEILIGT_RAD' id='BETEILIGT_RAD' class='check veh_1' checked='checked' ></td><td>Fahrräder</td><td>".$row['rad']."</td></tr>";
$strTable.="<tr><td class='td_ubet'><input type='checkbox' name='UBETEILIGT_PKW' id='BETEILIGT_PKW' class='check veh_2' checked='checked' ></td><td>PKWs</td><td>".$row['pkw']."</td></tr>";
$strTable.="<tr><td class='td_ubet'><input type='checkbox' name='UBETEILIGT_FUSS' id='BETEILIGT_FUSS' class='check veh_3' checked='checked' ></td><td>Fussgänger</td><td>".$row['fuss']."</td></tr>";
$strTable.="<tr><td class='td_ubet'><input type='checkbox' name='UBETEILIGT_KRAD' id='BETEILIGT_KRAD' class='check veh_4' checked='checked' ></td><td>Krafträder</td><td>".$row['krad']."</td></tr>";
$strTable.="<tr><td class='td_ubet'><input type='checkbox' name='UBETEILIGT_LKW' id='BETEILIGT_LKW' class='check veh_5' checked='checked' ></td><td>LKWs</td><td>".$row['lkw']."</td></tr>\n";
$strTable.="<tr><td class='td_ubet'><input type='checkbox' name='UBETEILIGT_SONSTIGES' id='BETEILIGT_SONSTIGES' class='check veh_6' checked='checked' ></td><td>Sonstiges</td><td>".$row['sonstiges']."</td></tr>\n";
}
/*
$strSQL="SELECT count(*) as count
FROM data
WHERE IstRad=0 and IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0";
*/
switch ($numVehicle) {
case 1:
case 0:
@ -167,20 +167,19 @@ function nl2br2($string) {
$result = $db->query($strSQL.$strYear);
if ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="<tr><td></td><td>Alleinunfälle und Unfälle mit geicher Fahrzeugart</td><td>".$row['count']."</td></tr>";
$strTable.="<tr><td class='td_ubet'><input type='checkbox' name='UBETEILIGT_SELBST' id='BETEILIGT_SELBST' class='check' checked='checked' ></td><td>Alleinunfälle und Unfälle mit geicher Fahrzeugart</td><td>".$row['count']."</td></tr>";
}
$strTable.="</table>";
//Unfalltyp
$strSQL="SELECT UTYP1, count(UTYP1) as anz FROM data WHERE ".$strWhere.$strYear.$strLocation." GROUP BY UTYP1";
$strTable.="<h5><input type='checkbox' id='check_typ' class='check_header' checked='checked'>Unfalltyp</h5>";
$strTable.="<h5><input type='radio' value='UTYP' name='kategorie' id='kategorie3' class='radio_header'>";
$strTable.="<label for='kategorie3'>Unfalltyp</label></h5>";
$strTable.="<table class='statistik'>";
$result = $db->query($strSQL);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="<tr><td><input type='checkbox' name='UTYP_".$row['UTYP1']."' id='UTYP_".$row['UTYP1']."' class='check utyp' checked='checked' ></td>"
$strTable.="<tr><td class='td_utyp'><input type='checkbox' name='UTYP_".$row['UTYP1']."' id='UTYP_".$row['UTYP1']."' class='check utyp' checked='checked' ></td>"
."<td>".$arrUnfalltyp[$row['UTYP1']]."</td><td>".$row['anz']."</td></tr>\n";
}
$strTable.="</table>";
@ -188,11 +187,12 @@ function nl2br2($string) {
//Unfallart
$strSQL="SELECT UART, count(UART) as anz FROM data WHERE ".$strWhere.$strYear.$strLocation." GROUP BY UART";
$strTable.="<h5><input type='checkbox' id='check_art' class='check_header' checked='checked'>Unfallart</h5>";
$strTable.="<h5><input type='radio' value='UART' name='kategorie' id='kategorie4' class='radio_header'>";
$strTable.="<label for='kategorie4'>Unfallart<label></h5>";
$strTable.="<table class='statistik'>";
$result = $db->query($strSQL);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="<tr><td><input type='checkbox' name='UART_".$row['UART']."' id='UART_".$row['UART']."' class='check uart' checked='checked' ></td>"
$strTable.="<tr><td class='td_uart'><input type='checkbox' name='UART_".$row['UART']."' id='UART_".$row['UART']."' class='check uart' checked='checked' ></td>"
."<td>".$arrUnfallart[$row['UART']]."</td><td>".$row['anz']."</td></tr>\n";
}
$strTable.="</table>";
@ -201,8 +201,5 @@ function nl2br2($string) {
$strTable.="<a href='https://recht.nrw.de/lmi/owa/br_vbl_show_pdf?p_id=12225' target='_blank'>Unfalltpyen</a><br>";
$strTable.="<a href='https://www.destatis.de/DE/Themen/Gesellschaft-Umwelt/Verkehrsunfaelle/Methoden/verkehrsunfaelle-grundbegriffe.pdf?__blob=publicationFile' target='_blank'>Unfallbeschreibung</a><br>";
return $strTable;
}