This commit is contained in:
Walter Hupfeld 2023-07-30 16:58:10 +02:00
parent e18ee929a6
commit b2ad23bd97
3 changed files with 45 additions and 69 deletions

View File

@ -94,3 +94,5 @@ i.wa {
h5 {margin-top:15px;}
.statistik td, th {border: 1px solid grey; font-size: smaller;}
.radio_header {margin-right:7px;}

View File

@ -224,6 +224,7 @@
<script>
// Map ----------------------------------------------------------------------
var mymap = L.map('mapid').setView([<?=$numInfoLat ?>, <?=$numInfoLng ?>], <?=$numZoom ?>);
var mapLink = '<a href="http://openstreetmap.org">OpenStreetMap</a>';
@ -306,8 +307,6 @@
$('.check').click(function() {
filter = this.name;
console.log(filter);
if (jQuery(this).prop("checked")) {
jQuery.each(marker, function(key, value) {
if (value) {
@ -325,7 +324,6 @@
function check_all(){
jQuery.each(marker, function(key, value) {
console.log(value);
if (value) { value[0].addTo(mymap); }
});
};
@ -333,56 +331,38 @@
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 );
$('input[type=radio][name=kategorie]').on('change', function() {
$('.td_ubet').hide();
$('.td_utyp').hide();
$('.td_uart').hide();
$('.td_ukat').hide();
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=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();
break;
}
});
$('.td_ubet').hide();
$('.td_utyp').hide();
$('.td_uart').hide();
$('.td_ukat').show();
$('input:radio[name=kategorie]').val(['UKAT']);
</script>
</body>
</html>

View File

@ -97,13 +97,13 @@ function nl2br2($string) {
global $arrCategory;
global $strLocation;
$strTable="<h5><input type='checkbox' id='check_kat' class='check_header' checked='checked'>Unfallkategorie</h5>";
$strTable="<h5><input type='radio' value='UKAT' name='kategorie' class='radio_header' checked='checked'>Unfallkategorie</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>";
@ -121,22 +121,16 @@ 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' class='radio_header'>Unfallbeteiligte</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' 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' 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' 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' 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' 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' 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,7 +161,7 @@ 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'></td><td>Alleinunfälle und Unfälle mit geicher Fahrzeugart</td><td>".$row['count']."</td></tr>";
}
$strTable.="</table>";
@ -176,11 +170,11 @@ function nl2br2($string) {
//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' class='radio_header'>Unfalltyp</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 +182,11 @@ 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' class='radio_header'>Unfallart</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>";