Filter für UKATEGORIE

This commit is contained in:
Walter Hupfeld 2023-07-28 07:45:47 +02:00
parent d5f68e275a
commit b48d66479f
2 changed files with 24 additions and 8 deletions

View File

@ -95,9 +95,11 @@
$arrMarker = array(); $arrMarker = array();
$arrDescription = array(); $arrDescription = array();
$description=""; $description="";
$numId=0;
while ($row = $result->fetch(PDO::FETCH_ASSOC)) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
//print_r($row);echo "<hr>"; //print_r($row);echo "<hr>";
$id = $row['OBJECTID']; //$id = $row['OBJECTID'];
$id=$numId;
$numLng = $row['XGCSWGS84']; $numLng = $row['XGCSWGS84'];
$numLat = $row['YGCSWGS84']; $numLat = $row['YGCSWGS84'];
if ($row['IstRad']) $description .="mit Fahrradbeteiligung, "; if ($row['IstRad']) $description .="mit Fahrradbeteiligung, ";
@ -109,12 +111,14 @@
$strDescription=generate_tooltip_description($row); $strDescription=generate_tooltip_description($row);
$strCategory=generate_category($row);
$arrMarker[]="marker[".$id."] = [L.marker([".$numLat."," .$numLng."]," $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].addTo(mymap);\n "
."marker[".$id."][0].bindPopup('".$strDescription."');"; ."marker[".$id."][0].bindPopup('".$strDescription."');";
$numId++;
} }
$markerid=$id+1; $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]; 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 ---------------------------------------- // Hide and show marker form checkbox ----------------------------------------
$('.check').click(function() { $('.check').click(function() {
bereich = this.name; filter = this.name;
console.log(filter);
if (jQuery(this).prop("checked")) { if (jQuery(this).prop("checked")) {
jQuery.each(marker, function(key, value) { jQuery.each(marker, function(key, value) {
if (value) { if (value) {
if (value[1] == bereich) { value[0].addTo(mymap); } if (filter.match(value[1]))
{ value[0].addTo(mymap); }
} }
}); });
} else { } else {
jQuery.each(marker, function(key, value) { jQuery.each(marker, function(key, value) {
if (value) { if (value) {
if (value[1] == bereich) { value[0].remove(); } if (filter.match(value[1]))
{ value[0].remove(); }
} }
}); });
} }

View File

@ -33,9 +33,15 @@ function generate_tooltip_description($row) {
return $strDescription; return $strDescription;
} }
function generate_category($row) {
return "UART_".$row['UART']."|UKATEGORIE_".$row['UKATEGORIE'];
}
/** /**
* reads gps location form picture data * reads gps location form picture data
*/ */
function read_gps_location($file){ function read_gps_location($file){
if (is_file($file)) { if (is_file($file)) {
$info = exif_read_data($file); $info = exif_read_data($file);
@ -96,7 +102,8 @@ function nl2br2($string) {
$result = $db->query($strSQL); $result = $db->query($strSQL);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="<tr><td>".$arrCategory[$row['UKATEGORIE']]."</td><td>".$row['anz']."</td></tr>\n"; $strTable.="<tr><td><input type='checkbox' name='check_UKATEGORIE_".$row['UKATEGORIE']."' id='check_UKATEGORIE_".$row['UKATEGORIE']."' class='check' checked='checked' ></td>"
."<td>".$arrCategory[$row['UKATEGORIE']]."</td><td>".$row['anz']."</td></tr>\n";
} }
$strTable.="</table>"; $strTable.="</table>";
@ -172,7 +179,8 @@ function nl2br2($string) {
$strTable.="<table class='statistik'>"; $strTable.="<table class='statistik'>";
$result = $db->query($strSQL); $result = $db->query($strSQL);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$strTable.="<tr><td>".$arrUnfallart[$row['UART']]."</td><td>".$row['anz']."</td></tr>\n"; $strTable.=//"<tr><td><input type='checkbox' name='check_UART_".$row['UART']."' id='check_URT_".$row['UART']."' class='check' checked='checked' ></td>"
"<td>".$arrUnfallart[$row['UART']]."</td><td>".$row['anz']."</td></tr>\n";
} }
$strTable.="</table>"; $strTable.="</table>";