Daten zum Unfall"; $description = "Unfallkategorie: ".$arrCategory[$row['UKATEGORIE']]."
"; $description .= "Unfallmonat/Jahr: ".$row['UMONAT']."/".$row['UJAHR']."
"; $description .= "Tag/Stunde: ".$arrWochentage[$row['UWOCHENTAG']]." ".$row['USTUNDE']." Uhr
"; $description .= "Unfallart: ".$arrUnfallart[$row['UART']]."
"; $description .= "Unfalltyp: ".$arrUnfalltyp[$row['UTYP1']]."
"; $description .= "Lichtverhältnisse: ".$arrLicht[$row['ULICHTVERH']]."
"; $description .= "Straßenzustand: ".$arrStrassenzustand[$row['STRZUSTAND']]."
"; $description .= "Unfallbeteiligte: "; 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 .= nl2br2($description); return $strDescription; } /** * reads gps location form picture data */ function read_gps_location($file){ if (is_file($file)) { $info = exif_read_data($file); if (isset($info['GPSLatitude']) && isset($info['GPSLongitude']) && isset($info['GPSLatitudeRef']) && isset($info['GPSLongitudeRef']) && in_array($info['GPSLatitudeRef'], array('E','W','N','S')) && in_array($info['GPSLongitudeRef'], array('E','W','N','S'))) { $GPSLatitudeRef = strtolower(trim($info['GPSLatitudeRef'])); $GPSLongitudeRef = strtolower(trim($info['GPSLongitudeRef'])); $lat_degrees_a = explode('/',$info['GPSLatitude'][0]); $lat_minutes_a = explode('/',$info['GPSLatitude'][1]); $lat_seconds_a = explode('/',$info['GPSLatitude'][2]); $lng_degrees_a = explode('/',$info['GPSLongitude'][0]); $lng_minutes_a = explode('/',$info['GPSLongitude'][1]); $lng_seconds_a = explode('/',$info['GPSLongitude'][2]); $lat_degrees = $lat_degrees_a[0] / $lat_degrees_a[1]; $lat_minutes = $lat_minutes_a[0] / $lat_minutes_a[1]; $lat_seconds = $lat_seconds_a[0] / $lat_seconds_a[1]; $lng_degrees = $lng_degrees_a[0] / $lng_degrees_a[1]; $lng_minutes = $lng_minutes_a[0] / $lng_minutes_a[1]; $lng_seconds = $lng_seconds_a[0] / $lng_seconds_a[1]; $lat = (float) $lat_degrees+((($lat_minutes*60)+($lat_seconds))/3600); $lng = (float) $lng_degrees+((($lng_minutes*60)+($lng_seconds))/3600); //If the latitude is South, make it negative. //If the longitude is west, make it negative $GPSLatitudeRef == 's' ? $lat *= -1 : ''; $GPSLongitudeRef == 'w' ? $lng *= -1 : ''; return array( 'lat' => $lat, 'lng' => $lng ); } } return false; } function nl2br2($string) { $string = str_replace(array("\r\n", "\r", "\n"), "
", $string); return $string; } function get_statistics($numVehicle,$strWhere,$strYear) { global $db; global $arrUnfallart; global $arrUnfalltyp; global $arrCategory; $strTable="
Unfallkategorie
"; $strTable.=""; $strSQL="SELECT UKATEGORIE, count(UKATEGORIE) as anz FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear." GROUP BY UKATEGORIE"; $result = $db->query($strSQL); while ($row = $result->fetchArray()) { $strTable.="\n"; } $strTable.="
".$arrCategory[$row['UKATEGORIE']]."".$row['anz']."
"; $strSQL="SELECT sum(IstRad) as rad, sum(IstPKW) as pkw, sum(IstFuss) as fuss, sum(IstKrad) as krad, sum(IstGkfz) as lkw, sum(IstSonstige) as sonstiges, count(*) as summe FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear; $result = $db->query($strSQL); $strTable.="
Unfallbeteiligte
"; $strTable.=""; //$strTable.=""; while ($row = $result->fetchArray()) { $strTable.=""; $strTable.=""; $strTable.=""; $strTable.=""; $strTable.="\n"; $strTable.="\n"; } /* $strSQL="SELECT count(*) as count FROM Unfallorte_Hamm WHERE IstRad=0 and IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0"; */ switch ($numVehicle) { case 1: case 0: $strSQL="SELECT count(*) as count FROM Unfallorte_Hamm WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0"; break; case 2: $strSQL="SELECT count(*) as count FROM Unfallorte_Hamm WHERE IstRad=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstSonstige=0"; break; case 3: $strSQL="SELECT count(*) as count FROM Unfallorte_Hamm WHERE IstPKW=0 and IstRad=0 and IstKrad and IstGkfz=0 and IstSonstige=0"; break; case 4: $strSQL="SELECT count(*) as count FROM Unfallorte_Hamm WHERE IstPKW=0 and IstFuss=0 and IstRad=0 and IstGkfz=0 and IstSonstige=0"; break; case 5: $strSQL="SELECT count(*) as count FROM Unfallorte_Hamm WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstRad=0 and IstSonstige=0"; break; case 6: $strSQL="SELECT count(*) as count FROM Unfallorte_Hamm WHERE IstPKW=0 and IstFuss=0 and IstKrad=0 and IstGkfz=0 and IstRad=0"; break; } $result = $db->query($strSQL.$strYear); if ($row = $result->fetchArray()) { $strTable.=""; } $strTable.="
UnfallbeteiligteAnzahl
Fahrräder".$row['rad']."
PKWs".$row['pkw']."
Fussgänger".$row['fuss']."
Krafträder".$row['krad']."
LKWs".$row['lkw']."
Sonstiges".$row['sonstiges']."
Alleinunfälle und Unfälle mit geicher Fahrzeugart".$row['count']."
"; //Unfallart $strSQL="SELECT UART, count(UART) as anz FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear." GROUP BY UART"; $strTable.="
Unfallart
"; $strTable.=""; $result = $db->query($strSQL); while ($row = $result->fetchArray()) { $strTable.="\n"; } $strTable.="
".$arrUnfallart[$row['UART']]."".$row['anz']."
"; //Unfallart $strSQL="SELECT UTYP1, count(UTYP1) as anz FROM Unfallorte_Hamm WHERE ".$strWhere.$strYear." GROUP BY UTYP1"; $strTable.="
Unfalltyp
"; $strTable.=""; $result = $db->query($strSQL); while ($row = $result->fetchArray()) { $strTable.="\n"; } $strTable.="
".$arrUnfalltyp[$row['UTYP1']]."".$row['anz']."
"; $strTable.="Unfalltpyen
"; $strTable.="Unfallbeschreibung
"; return $strTable; }