ALBasic(); $this->ParaMap=false; $this->ShowDistrict=false; $this->MaxNumNearest=1000; $this->NR_GEOREQUEST=7; // don't change this value!! $this->Log_to_file("ALGeo.ALGeo: Constructor passed successfully"); $this->BPGeoServiceNum=1099; // base number for internal service } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // SetOrder // build request string depending on internal values as ACTION and // based on the request as defined by the user function SetOrder() { $this->BPRequest["CLIENT"]["MAP"] = (($this->ParaMap) ? "TRUE" : "FALSE"); $this->BPRequest["CLIENT"]["SHOWDISTRICT"] = (($this->ShowDistrict) ? "TRUE" : "FALSE"); $this->BPRequest["CLIENT"]["MAPSBYSTREAM"] = (($this->BPMapsByStream) ? "TRUE" : "FALSE");; if ($this->ShowDistrict && $this->MaxNumNearest) $this->BPRequest["CLIENT"]["MAXNUMNEAREST"] = $this->MaxNumNearest; $this->BPRequest["CLIENT"]["SEARCH"] = $this->GeoCountry . $this->GeoZIP . "," . $this->GeoTown .",". $this->GeoDistrict .",". $this->GeoStreet ." ". $this->GeoHousenumber .",,"; $this->BPRequest["CLIENT"]["SUBACTION"] = 1; $this->BPRequest["SERVER"]["ACTION"] = 7; $this->BPRequest["CLIENT"]["REQUEST"] = "TRUE"; $this->Log_to_file("ALGeo.SetOrder: Passed successfully"); } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Res_town_0 // no hits found, answer with error code function res_town_0() { $this->GeoResponse = "Error: Your geocoding request could not be handled."; $this->Log_to_file("ALGeo.res_town_0: Passed successfully. No results found for geocoding"); return $this->BPStat_Error; } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Res_town_1 // exactly one hit found, answer is presented at object properties and // not as a string in one property function res_town_1($res_array_) { $errco = $this->BFGetParam(0,"SERVER","ERRORCODE","0"); if($errco=="0") { $temp = explode(",", $this->BFGetParam(0,"VORSCHLAG1","ORTE1",",")); // fill public variables with values (list()=array(values)) list($this->GeoZIP,$this->GeoTown,$this->GeoDistrict,$this->GeoStreet,$this->GeoTownID,$this->GeoCoordinateX,$this->GeoCoordinateY)=$temp; $this->GeoCoordinate = $this->GeoCoordinateX ."/" . $this->GeoCoordinateY; } // build a list as known for multiple results (in HTML format = 1) $this->res_town_2($res_array_,1); $this->Log_to_file("ALGeo.res_town_1: Passed successfully. One hit found for geocoding"); return $this->BPStat_Success; } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Res_town_2 // more than one hit found, build result string according to prefered format function res_town_2($res_array_, $countorte_) { $pararequest_jc = 0; $pararequest_html = 1; $pararequest_full = 2; $pararequest_coord = 3; $pararequest_id_coord = 4; $split = "~"; $num = 2; $begin = 1; $end = 0; switch ($this->ParaRequestType) { // +++++++++++++++++++++++++++ $pararequest_jc = 0 case $pararequest_jc : { // for every hit for($i=$begin; $i<=$countorte_+$end ; $i++) { $temp = explode($split, $res_array_[$i]); // build answer string if(substr($temp[1],0,4)=="ORTE") { $temp = explode(",", $temp[$num]); $erg .= "$temp[0] $temp[1] $temp[2] $temp[3] $temp[4] $temp[5] $temp[6]
"; } } // for $this->GeoResponse = $erg; $this->Log_to_file("ALGeo.res_town_2: Passed successfully: pararequest_jc "); return $this->BPGeoStat_Select; break; } // +++++++++++++++++++++++++++ $pararequest_html = 1 case $pararequest_html : { // for every hit found for($i=$begin; $i<=$countorte_+$end ; $i++) { $temp = explode($split, $res_array_[$i]); if(substr($temp[1],0,4)=="ORTE") { $temp = explode(",", $temp[$num]); // build option tag which can be used directly in // HTML select statements. Use fpr values only the // town id if ($i == $begin) { $select_tag = "