datatable
This commit is contained in:
120
index.php
120
index.php
@@ -6,126 +6,11 @@
|
||||
|
||||
$numYear=$numLatestYear;
|
||||
|
||||
|
||||
$strDistrict = (isset($_GET['d'])) ? $_GET['d'] : "Hamm";
|
||||
$numVehicle = (isset($_GET['v'])) ? (int) $_GET['v'] : 1;
|
||||
$numYear = (isset($_GET['year'])) ? (int) $_GET['year'] : $numYear;
|
||||
|
||||
|
||||
|
||||
$result= $db->prepare("SELECT count(*) FROM district WHERE district=:district");
|
||||
$result->bindParam(":district",$strDistrict);
|
||||
$result->execute();
|
||||
if ($row=$result->fetch(PDO::FETCH_NUM)) {
|
||||
if ($row[0]==0) $strDistrict="hamm";
|
||||
}
|
||||
|
||||
//$result = $db->query($strSQL);
|
||||
$result= $db->prepare("SELECT * FROM district WHERE district=:district");
|
||||
$result->bindParam(":district",$strDistrict);
|
||||
$result->execute();
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$strDistrict = $row['district'];
|
||||
$strTitle = $row['title'];
|
||||
$strGeojson = $row['geojson'];
|
||||
|
||||
$numULAND=$row['ULAND'];
|
||||
$numUREGBEZ=$row['UREGBEZ'];
|
||||
$numUKREIS=$row['UKREIS'];
|
||||
$numUGEMEINDE=$row['UGEMEINDE'];
|
||||
|
||||
$numInfoLat=$row['lat'];
|
||||
$numInfoLng=$row['lng'];
|
||||
$numZoom=$row['zoom'];
|
||||
|
||||
$strTitle = "Unfallkarte $strTitle ";
|
||||
$strIntroText = "$strTitle basierend auf den Daten des Statistischen Bundesamtes.";
|
||||
|
||||
$fileGeojson ="geojson/$strGeojson";
|
||||
$strLocation = " AND ULAND=$numULAND AND UREGBEZ=$numUREGBEZ AND UKREIS=$numUKREIS ";
|
||||
if ($numUGEMEINDE>0) {
|
||||
$strLocation .= "AND UGEMEINDE=$numUGEMEINDE";
|
||||
}
|
||||
}
|
||||
$arrDisctrict = array ();
|
||||
|
||||
$strSQL = "SELECT district,title FROM district ORDER BY title ASC";
|
||||
$result=$db->query($strSQL);
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
$arrDistrict[$row['district']]=$row['title'];
|
||||
}
|
||||
|
||||
$strIntro ="<h4>".$strTitle."</h4>";
|
||||
$strIntro .= nl2br2($strIntroText);
|
||||
|
||||
switch ($numVehicle) {
|
||||
case 1:
|
||||
case 0:
|
||||
$strWhere ="IstRad = 1";
|
||||
$topic=2;
|
||||
break;
|
||||
case 2:
|
||||
$strWhere = "IstPKW = 1";
|
||||
$topic=4;
|
||||
break;
|
||||
case 3:
|
||||
$strWhere = "IstFuss = 1";
|
||||
$topic=1;
|
||||
break;
|
||||
case 4:
|
||||
$strWhere = "IstKrad = 1";
|
||||
$topic=0;
|
||||
break;
|
||||
case 5:
|
||||
$strWhere = "IstGkfz = 1";
|
||||
$topic=5;
|
||||
break;
|
||||
case 6:
|
||||
$strWhere = "IstSonstige = 1";
|
||||
$topic=3;
|
||||
break;
|
||||
default: $strWhere ="IstRad = 1";
|
||||
$topic=2;
|
||||
}
|
||||
|
||||
$strYear = " AND UJAHR='".$numYear."' ";
|
||||
|
||||
$strSQL="SELECT * FROM data WHERE ".$strWhere.$strYear.$strLocation;
|
||||
|
||||
|
||||
$result = $db->query($strSQL);
|
||||
$arrMarker = array();
|
||||
$arrDescription = array();
|
||||
$description="";
|
||||
$numId=0;
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
//print_r($row);echo "<hr>";
|
||||
//$id = $row['OBJECTID'];
|
||||
$id=$numId;
|
||||
$numLng = $row['XGCSWGS84'];
|
||||
$numLat = $row['YGCSWGS84'];
|
||||
if ($row['IstRad']) $description .="mit Fahrradbeteiligung, ";
|
||||
if ($row['IstPKW']) $description .="mit PKW-Beteiligung, ";
|
||||
if ($row['IstFuss']) $description .="mit Fußgängerbeteiligung, ";
|
||||
if ($row['IstKrad']) $description .="mit Kraftradbeteiligung, ";
|
||||
if ($row['IstGkfz']) $description .="mit Güterkraftzeugbeteiligung, ";
|
||||
if ($row['IstSonstige']) $description .="mit Beteiligung eines oben nicht genannten Verkehrsmittels";
|
||||
|
||||
|
||||
$strDescription=generate_tooltip_description($row);
|
||||
$strCategory=generate_category($row);
|
||||
$arrMarker[]="marker[".$id."] = [L.marker([".$numLat."," .$numLng."],"
|
||||
." { icon: ".$arrMarkerType[$topic]." }),'".$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];
|
||||
marker[val.id][0].addTo(map);
|
||||
*/
|
||||
require_once("lib/init.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
@@ -189,6 +74,9 @@
|
||||
</select>
|
||||
</form>
|
||||
<ul class="navbar-nav mr-auto right">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="statistics/">Statistik</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="impressum.php">Impressum</a>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user