mlTabsPerLine=$tabsPerLine; $this->mlTabIndex=$lTabindexStart; $this->oSystem=&$oSystem; $this->msDBAccessKey=$dbAccessKey; $this->msViewSource=$viewSource; $this->asSearchInFields=$asSearchInFields; $this->gsEmpty(); } function setErrorHTML($sHTML) { $this->errorHTML=$sHTML; } function gsEmpty() { $this->masEmpty["__all__"]=""; if(is_array($this->asSearchInFields)) foreach($this->asSearchInFields as $sKey) $this->masEmpty[$sKey]=""; } function gbContainsData($asData) { if(is_array($asData)) foreach($asData as $sKey=>$sValue) { if($sValue!="") return true; } return false; } function goLoadViewTPLParser($sView,$lError,$asAdditionalURLData=array(),$asAdditionalConditionData=array(),$oEnrichData=false,$sStandardOrderBy="",$bRefresh=false,$sStandardOrderDir="ASC") { if($bRefresh===true) { unset($_SESSION[$sView.".order"]); $asSearchData=false; $_SESSION[$sView.".search"]["searchData"]=false; unset($_SESSION[$sView.".order"]["dir"]); unset($_SESSION[$sView.".order"]["field"]); unset($_SESSION[$sView.".offset"]["offset"]); } if(sizeof($asAdditionalURLData)>0) { if($sAdditional=$this->oSystem->oSiteNavi->gsGetURLData($asAdditionalURLData)) { $sAdditional.="&"; } } $lOffset=false; $asSearchData=$this->oSystem->oClientData->gvGetVariable("__searchData",false); $bContains=$this->gbContainsData($asSearchData); if($bContains===true) { $lOffset=0; } else { if(isset($_SESSION[$sView.".search"]["searchData"])) { $asSearchData=$_SESSION[$sView.".search"]["searchData"]; } } $asSearchQuery=array(); $asAdditionalConditionData["SEARCHDATA"]=1; if($this->oSystem->oClientData->gvGetVariable("DROPLIST",false)=="TRUE") { $asSearchData=false; $_SESSION[$sView.".search"]["searchData"]=false; unset($_SESSION[$sView.".order"]["dir"]); unset($_SESSION[$sView.".order"]["field"]); unset($_SESSION[$sView.".offset"]["offset"]); } else { $asSearchQuery=array(); if($asSearchData!==false) { $_SESSION[$sView.".search"]["searchData"]=$asSearchData; $this->bSearch=true; if(isset($asSearchData["__all__"])&&$asSearchData["__all__"]!="") { if($this->asSearchInFields!==false) { $asSearchInData=explode(",",$asSearchData["__all__"]); foreach($asSearchInData as $sValue) { $asSingle=array(); foreach($this->asSearchInFields as $sFieldName) { $asSingle[]="(".$sFieldName." LIKE ('%".$sValue."%')".")"; } $asSearchQuery[]="(".join(" OR \n",$asSingle).")"; } } unset($asSearchData["__all__"]); } } $asAdditionalConditionData["SEARCHDATA"]=1; if(sizeof($asSearchQuery)>0) { $asAdditionalConditionData["SEARCHDATA"]="(".join(" AND \n",$asSearchQuery).")"; } } $lReadOffset=$this->oSystem->oClientData->gvGetVariable("offset",false); if($lReadOffset===false) { if($lOffset===false) { if(isset($_SESSION[$sView.".offset"]["offset"])) $lOffset=$_SESSION[$sView.".offset"]["offset"]; } } else $lOffset=$lReadOffset; $lOffset=$lOffset===false||empty($lOffset)?0:$lOffset; $sOrderBy=false; if($sOrderBy=$this->oSystem->oClientData->gvGetVariable("orderby",false)) { } else { if(isset($_SESSION[$sView.".order"]["field"])) { $sOrderNew=$sOrderBy!==false; $sOrderBy=$_SESSION[$sView.".order"]["field"]===""?false:$_SESSION[$sView.".order"]["field"];; } } $sOrderNew=$sOrderBy!==false; $sOrderBy=$sOrderBy===false?$sStandardOrderBy:$sOrderBy; $sOrderDir=false; if(isset($_SESSION[$sView.".order"]["dir"])&&$this->oSystem->oClientData->gvGetVariable("orderby",false)===false) $sOrderDir=$_SESSION[$sView.".order"]["dir"]; else { if($sOrderNew===true) { $sOrderDir=$sStandardOrderDir; if(isset($_SESSION[$sView.".order"]["dir"])) { $sOrderDir=$_SESSION[$sView.".order"]["dir"]; if($sOrderDir=="ASC") $sOrderDir="DESC"; else $sOrderDir="ASC"; } } } if($sOrderDir=="") $sOrderDir=$sStandardOrderDir; $_SESSION[$sView.".order"]["dir"]=$sOrderDir; $_SESSION[$sView.".order"]["field"]=$sOrderBy; $_SESSION[$sView.".offset"]["offset"]=$lOffset; $sOrderedBy=$sOrderBy." ".$sOrderDir; $lCount=18; $asCondition=$asAdditionalConditionData+array("Offset"=>$lOffset,"Count"=>$lCount,"Order"=>$sOrderedBy); $this->asCondition=$asCondition; $oDB=&$this->oSystem->oDB; if($this->msViewSource!==false) $oDB=new CDatabase($this->msViewSource); if($oView=$oDB->goGetView($sView,$asCondition,$this->msDBAccessKey)) { $lCount=$oView->mlShowPerPage; $oPageListGen=new CMGMListGenerator($lOffset,$lCount,$oView->mlGesamt); $sFile=PATHQS."views/view.".$sView.".tpl"; $this->mlTabsPerLine; $oTPL=$this->oSystem->goGetTPLParser($sFile,true,$this->mlTabIndex,$this->mlTabsPerLine); $oTPL->gbSetValArray($this->masEmpty); $oTPL->gbSetValArray($_SESSION[$sView.".search"]["searchData"]); $asData=$oView->moResult->gaaGetAllRecords(); if(sizeof($asData)==0) { $oTPL->gbSetBlock("liste",array()); $oTPL->gbSetBlock("error",array("0"=>"nichtunterwegs")); $asButton["list"]=false; $asButton["error"]["ANZEIGE"]=$this->errorHTML; } else { if($oEnrichData!==false) { if(is_object($oEnrichData)&&method_exists($oEnrichData,"gasEnrich")) { foreach($asData as $sKey=>$asRecord) { $asData[$sKey]=$oEnrichData->gasEnrich($asRecord); } } } $oTPL->gbSetBlock("liste",$asData,"rowLow","rowHi"); $oTPL->gbSetBlock("error",array()); $asButton["list"]=true; $asButton["error"]=false; } $oTPL->gbSetButtons($asButton); $sHTML=$oTPL->gsParse(); $lMaxTabindex=$oTPL->getLastTabIndex(); unset($oTPL); $oTPL=new CTemplateParser($sHTML); $oTPL->gbSetValue("GESAMTDS",$oView->mlGesamt); $oTPL->gbSetValue("GESAMTSEITEN",$oPageListGen->mlGesamtSeiten); $oTPL->gbSetValue("FIRSTPAGE",$oPageListGen->mlFirstPage); $asButton["firstpage"]["FIRSTPAGE"]=$oPageListGen->mlFirstPage; $asButton["firstpage"]["FPTABINDEX"]=$lMaxTabindex; $asButton["prevpage"]["PREVPAGE"]=$oPageListGen->mlPrevPage; $asButton["prevpage"]["PPTABINDEX"]=$lMaxTabindex+1; $asButton["nextpage"]["NPTABINDEX"]=$lMaxTabindex+$oPageListGen->gesamtPageLinks+2; $asButton["nextpage"]["NEXTPAGE"]=$oPageListGen->mlNextPage; $asButton["lastpage"]["LPTABINDEX"]=$lMaxTabindex+$oPageListGen->gesamtPageLinks+3; $asButton["lastpage"]["LASTPAGE"]=$oPageListGen->mlMaxOffset; if($oView->mlGesamt==0 || $oPageListGen->mlGesamtSeiten==1) { $asButton["firstpage"]=false; $asButton["prevpage"]=false; $asButton["nextpage"]=false; $asButton["lastpage"]=false; } elseif($oPageListGen->mlOffset==$oPageListGen->mlFirstPage) { $asButton["firstpage"]=false; $asButton["prevpage"]=false; } elseif($oPageListGen->mlOffset==$oPageListGen->mlMaxOffset) { $asButton["lastpage"]=false; $asButton["nextpage"]=false; } $oTPL->gbSetButtons($asButton); $oTPL->gbSetValue("FPTABINDEX",$lMaxTabindex); $oTPL->gbSetValue("PPTABINDEX",$lMaxTabindex+1); $oTPL->gbSetValue("LASTPAGE",$oPageListGen->mlMaxOffset); $oTPL->gbSetValue("NEXTPAGE",$oPageListGen->mlNextPage); $oTPL->gbSetValue("PREVPAGE",$oPageListGen->mlPrevPage); $oTPL->gbSetValue("CURRENTPAGE",$oPageListGen->mlCurrentPage); $oTPL->gbSetValue("ADDITIONALURLDATA",$sAdditional); $oTPL->gbSetBlock("PAGESNAVI",$oPageListGen->gasGetOffsetList($sAdditional,$lMaxTabindex)); $oTPL->gbSetValue("NPTABINDEX",$lMaxTabindex+$oPageListGen->gesamtPageLinks+2); $oTPL->gbSetValue("LPTABINDEX",$lMaxTabindex+$oPageListGen->gesamtPageLinks+3); $oTPL->gbSetValue("CURRENTOFFSET",$lOffset); $sFile=PATHQS."views/navi.js"; if(file_exists($sFile)) { $oJS=$this->oSystem->goGetTPLParser($sFile); $oJS->gbSetValue("CURRENTOFFSET",$lOffset); $oJS->gbSetValue("OrderedBy",$sOrderBy); $oJS->gbSetValue("OrderDir",$sOrderDir); $oJS->gbSetValue("OrderDirSmall",strtolower($sOrderDir)); $sHTML=$oTPL->gsParse().$oJS->gsParse(); } else $sHTML=$oTPL->gsParse(); $oNewTPL=$this->oSystem->goGetTPLParser($sHTML,false); return $oNewTPL; } else { @mail("thorsten.k@kk-gbr.de","View:".$sView,"VIEW".mysql_error()); return new CError(1000); } } function gasGetPageOffsets($lGesamt,$lPP) { } function getCondition() { return $this->asCondition; } } ?>