From b48d66479f8329447f550ef11a7244d81236da44 Mon Sep 17 00:00:00 2001 From: Walter Hupfeld Date: Fri, 28 Jul 2023 07:45:47 +0200 Subject: [PATCH] =?UTF-8?q?Filter=20f=C3=BCr=20UKATEGORIE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 20 ++++++++++++++------ lib/functions.php | 12 ++++++++++-- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/index.php b/index.php index 84dd0fa..401f42f 100644 --- a/index.php +++ b/index.php @@ -95,9 +95,11 @@ $arrMarker = array(); $arrDescription = array(); $description=""; + $numId=0; while ($row = $result->fetch(PDO::FETCH_ASSOC)) { //print_r($row);echo "
"; - $id = $row['OBJECTID']; + //$id = $row['OBJECTID']; + $id=$numId; $numLng = $row['XGCSWGS84']; $numLat = $row['YGCSWGS84']; if ($row['IstRad']) $description .="mit Fahrradbeteiligung, "; @@ -109,12 +111,14 @@ $strDescription=generate_tooltip_description($row); - + $strCategory=generate_category($row); $arrMarker[]="marker[".$id."] = [L.marker([".$numLat."," .$numLng."]," - ." { icon: ".$arrMarkerType[$topic]." }),'check_".$topic."'];\n" + ." { icon: ".$arrMarkerType[$topic]." }),'check_".$strCategory."'];\n" ."marker[".$id."][0].addTo(mymap);\n " ."marker[".$id."][0].bindPopup('".$strDescription."');"; + $numId++; } + $markerid=$id+1; /* marker[val.id] = [L.marker([val.lat, val.lng], { "icon": L.MakiMarkers.icon({ "color": color, "size": "m", "icon": "circle" }) }).bindPopup(html), val.membertype]; @@ -302,17 +306,21 @@ // Hide and show marker form checkbox ---------------------------------------- $('.check').click(function() { - bereich = this.name; + filter = this.name; + console.log(filter); + if (jQuery(this).prop("checked")) { jQuery.each(marker, function(key, value) { if (value) { - if (value[1] == bereich) { value[0].addTo(mymap); } + if (filter.match(value[1])) + { value[0].addTo(mymap); } } }); } else { jQuery.each(marker, function(key, value) { if (value) { - if (value[1] == bereich) { value[0].remove(); } + if (filter.match(value[1])) + { value[0].remove(); } } }); } diff --git a/lib/functions.php b/lib/functions.php index c012a61..26c67de 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -33,9 +33,15 @@ function generate_tooltip_description($row) { return $strDescription; } +function generate_category($row) { + return "UART_".$row['UART']."|UKATEGORIE_".$row['UKATEGORIE']; +} /** * reads gps location form picture data */ + + + function read_gps_location($file){ if (is_file($file)) { $info = exif_read_data($file); @@ -96,7 +102,8 @@ function nl2br2($string) { $result = $db->query($strSQL); while ($row = $result->fetch(PDO::FETCH_ASSOC)) { - $strTable.="".$arrCategory[$row['UKATEGORIE']]."".$row['anz']."\n"; + $strTable.="" + ."".$arrCategory[$row['UKATEGORIE']]."".$row['anz']."\n"; } $strTable.=""; @@ -172,7 +179,8 @@ function nl2br2($string) { $strTable.=""; $result = $db->query($strSQL); while ($row = $result->fetch(PDO::FETCH_ASSOC)) { - $strTable.="\n"; + $strTable.=//"" + "\n"; } $strTable.="
".$arrUnfallart[$row['UART']]."".$row['anz']."
".$arrUnfallart[$row['UART']]."".$row['anz']."
";