ALBasic(); $this->NR_NEXTREQUEST=1; // don't change this value!! $this->Customers=""; // set default values $this->GraphFilter=""; $this->AddToMap=false; $this->ShowInfo=true; $this->RowCount=0; $this->Log_to_file("ALNext.ALNext: Constructor passed successfully"); } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // SetOrder // build request string depending on internal values as ACTION and // based on the request as defined by the user function SetOrder() { $this->BPRequest["SERVER"]["ACTION"] = $this->NR_NEXTREQUEST; $this->BPRequest["CLIENT"]["MAPSBYSTREAM"] = (($this->BPMapsByStream) ? "TRUE" : "FALSE"); $this->BPRequest["CLIENT"]["REQUEST"] = "TRUE"; $this->BPRequest["CLIENT"]["CUSTOMERS"] = $this->Customers; $this->BPRequest["CLIENT"]["GRAPHFILTER"] = $this->GraphFilter; if($this->SearchByCoord!="") $this->BPRequest["CLIENT"]["SEARCHBYCOORD"]=$this->SearchByCoord; else $this->BPRequest["CLIENT"]["SEARCHBYTOWN"]=$this->SearchByTown; $this->BPRequest["CLIENT"][$this->Customers."RETURNFIELDS"] = $this->ReturnFields; $this->BPRequest["CLIENT"]["ADDTOMAP"] = (($this->AddToMap) ? "TRUE" : "FALSE");; if($this->Filter1!="") $this->BPRequest["CLIENT"][$this->Customers."FILTER1"]==$this->Filter1; if($this->Filter2!="") $this->BPRequest["CLIENT"][$this->Customers."FILTER2"]==$this->Filter2; if($this->Filter3!="") $this->BPRequest["CLIENT"][$this->Customers."FILTER3"]==$this->Filter3; if($this->Filter4!="") $this->BPRequest["CLIENT"][$this->Customers."FILTER4"]==$this->Filter4; if($this->Filter5!="") $this->BPRequest["CLIENT"][$this->Customers."FILTER5"]==$this->Filter5; $this->BPRequest["CLIENT"]["SHOWINFO"] = (($this->ShowInfo) ? "TRUE" : "FALSE"); $this->Log_to_file("ALNext.SetOrder: Passed successfully"); } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ReadRow // read row with number RowNum into internal object cache // values can be read by FieldValue function ReadRow($RowNum) { if($RowNum<0 || $RowNum>$this->RowCount || !$this->ShowInfo) { $this->Log_to_file("ALNext.ReadRow: row number too large or no CST available "); return ""; } $this->temp_row=$this->BFGetParam(0,"SERVER","CST".$RowNum,""); return $this->temp_row; } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // FieldValue // read from current row (defined by ReadRow) the content of the // column with the name fName. The list of fName was defined by ReturnFields function FieldValue($fName) { if($fName=="" || !$this->ShowInfo || $this->temp_row=="") { $this->Log_to_file("ALNext.FieldValue: field name is empty or no CST available or no row read by ReadRow() "); return ""; } $temp_col=explode(",",$this->ReturnFields); $i=0; $col_num=-1; foreach($temp_col as $key => $value) if($key==$fName) $col_num=$i; else $i++; if ($col_num==-1) return ""; else { $temp_row_content=explode(",",$temp_row); return $temp_row_content[$col_num]; } return ""; } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // CheckRes // check how many hits were found and build answer accordingly function CheckRes() { if ($this->BFGetParam(0,strtoupper($this->Customers),"NUMCST",$this->BFGetParam(0,"SERVER","NUMCST",""))=="" ) { $this->Response = "Next search error"; $this->Log_to_file("ALNext.NextRequest: no NUMCST in result "); return $this->BPStat_Error; } else return $this->BPStat_Success; } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Execute // send next search request to server. the next search is based on an // address layer known by the server function NextSearch() { return $this->Execute(); } function Execute() { // check parameter if (($this->BPStat_Error == $this->BFCheckParam($this->NR_NEXTREQUEST)) || ($this->BPMapsByStream && $this->BPStreamDirectory=='')) { $this->Log_to_file("ALNext.NextRequest: Too less parameters "); return $this->BPStat_Error; } // set request type $this->SetOrder(); // build request $reqerr=$request = $this->BFBuildOrder(); // send request to server $answerlength=$this->BFWriteOrder($request); // if length is less than 45 byte, we had an error if($answerlength>45) { // receive answer $reqerr=$this->BFReadALSAnswer($this->NR_NEXTREQUEST); $this->RowCount=intval($this->BFGetParam(0,strtoupper($this->Customers),"NUMCST",$this->BFGetParam(0,"SERVER","NUMCST","0"))); $this->Logicalrect=$this->BFGetParam(0,"SERVER","LOGICALRECT",""); // return result code // count number of hits return $this->CheckRes(); } else return $this->BPStat_Error; } } //end of class definition ?>