loadGeneral(); $this->perPage=10; $this->variablePaginate="pNr"; $this->searchVar="sname,sidcounty,sidcity,sprtyp"; $this->nrLeftRight=2; $this->thisIsSearchForm=false; $this->pathCurrent="/cazare"; $this->orderTab=array("0"=>"-","single"=>"Pret single","double"=>"Pret dubla","stars"=>"Stele"); $this->sortTab=array("asc"=>"Crescator","desc"=>"Descrescator"); } function getTabParam() { $tabP=explode("/",$_SERVER["REQUEST_URI"]); $countTabP=count($tabP); #print_r($tabP); for ($z=0;$z<$countTabP;$z++) if (strlen($tabP[$z])>0) { $tabParam[]=$tabP[$z]; } unset($this->tabParam); $this->tabParam=$tabParam; $this->countTabParam=count($tabParam); } function whatType() { $tabParam=$this->getTabParam(); $countTabP=count($this->tabParam); #print_r($tabParam); #print "
PARAM:".$countTabP; #print "
SKIP:".$this->pathSkip; $step=1; if ($this->getCountyDetails($step)) { $step++; if ($this->getCityDetails($step)) { $step++; if ($this->getBooking($step)) { $step++; } } elseif ($this->getBooking($step)) { $step++; } } elseif ($this->getZoneDetails($step)) { $step++; } #print "
STEP:$step"; if ($this->bookingId==0 && $step<$countTabP) { if ($this->tabParam[$step]==(int)$this->tabParam[$step]) { $this->pNr=(int)$this->tabParam[$step]; if ($this->pNr<2) { print "AAA";exit; $this->r301($this->pathCurrent); exit; } $this->pathCurrent.="/".$this->pNr; $step++; } } if ($step<$countTabP) { #print "
LINK:".$this->pathCurrent.":";exit; $this->r301($this->pathCurrent); exit; } #print "
AM RAMAS LA:".$step; /* if (!$this->getDetailsType($step)) { if ($countTabParam-$this->pathSkip>2) { #print "
GO FOR IR"; if ($this->getObject($step)) $step++; else { $redirectTo="/".$this->countyLink."/".$this->cityLink; $this->r301($redirectTo); #print "
WRONG:$redirectTo"; } } } */ /* print "
".$this->countryName; print "
".$this->countryLink; print "
".$this->countryId; print "
".$this->countyName; print "
".$this->countyLink; print "
".$this->countyId; print "
".$this->cityName; print "
".$this->cityLink; print "
".$this->cityId; print "
".$this->bookingnameName; print "
".$this->bookingnameLink; print "
".$this->bookingnameId; print "
".$this->bookingName; print "
".$this->bookingLink; print "
".$this->bookingId; */ if ($this->bookingnameId>0) { } if ($this->countryId+$this->countyId+$this->cityId+$this->bookingnameId==0 && strlen($_SERVER["REQUEST_URI"])>1) { # print "
OUT OF HERE"; } } function display() { $this->breadCrumbAdd("Cazare","/cazare"); $this->promoObject(); $this->whatType(); if ($this->bookingId>0) { $this->view(); } else { if ($this->countTabParam==2) { $this->db->setsql("select value from param where name like 'HP title'"); $this->db->getresult(); $this->ft->assign(array("TITLE"=>$this->db->result["value"],"PAGETITLE"=>$this->db->result["value"])); $this->db->setsql("select value from param where name like 'HP description'"); $this->db->getresult(); $this->ft->assign(array("PAGEDESCRIPTION"=>$this->db->result["value"])); } $this->listBooking(); } } function listBooking() { $this->ft->define(array("list"=>"booking/list.html")); $this->ft->define_dynamic("objlist","list"); $this->ft->define_dynamic("objmain","list"); $this->ft->define_dynamic("objlistval","list"); if ($this->cityId<>505) { $this->ft->clear_dynamic("objmain"); } if ($this->bookingnameId) { $this->setTitle("Cazare ".$this->getObjectnameName($this->bookingnameId)); } elseif ($this->cityId) { $this->setTitle("Cazare ".$this->getCityName($this->cityId)); } elseif ($this->countyId) { $this->setTitle("Cazare ".$this->getCountyName($this->countyId)); } elseif ($this->countryId) { $this->setTitle($this->getCountryName($this->countryId)); } elseif ($this->zoneId) { $this->setTitle("Cazare ".$this->zoneName); } else { $this->setTitle("Cazare Romania"); # $whereCond=" and 1=2"; } if ($pageNrOrg>1) { $link=substr($this->pathCurrent,0,strrpos($this->pathCurrent,"/")); } else { $link=$this->pathCurrent; } #print_r($this->countyDb); /* print "
CountryID:".$this->countryId; print "
CountyID:".$this->countyId; print "
CityID:".$this->cityId; print "
ObjType:".$this->bookingtypeId; print "
ObjName:".$this->bookingnameId; */ if (strlen($this->sname)>0) $whereCond.=" and booking.name like '%".mysql_escape_string($this->sname)."%'"; if ((int)$this->cityId>0) $whereCond.=" and booking.idcity=".(int)$this->cityId; elseif ((int)$this->countyId>0) $whereCond.=" and booking.idcounty=".(int)$this->countyId; elseif ((int)$this->countryId>0) $whereCond.=" and booking.idcountry=".(int)$this->countryId; if ((int)$this->sidbtype>0) $whereCond.=" and booking.idbookingtype=".(int)$this->sidbtype; if ((int)$this->bookingnameId>0) $whereCond.=" and booking.idbookingname=".(int)$this->bookingnameId; if ((int)$this->bookingtypeId>0) $whereCond.=" and booking.idbookingtype=".(int)$this->bookingtypeId; if ((int)$this->zoneId>0) $innerCond.=" inner join zonedata on booking.idcity=zonedata.idcity and idzone=".(int)$this->zoneId; #print $this->sprtyp; ### SEARCH ORDER TYPE $orderByDefault=", dateupdate"; $this->sol=mysql_escape_string($this->sol); switch ($this->sot) { case "single": $orderBy="ordsingle ".$this->sol.", orddouble, dateadd desc, idbooking desc"; break; case "double": $orderBy="orddouble ".$this->sol.", dateadd desc, idbooking desc"; break; case "stars": $orderBy="stars ".$this->sol; break; default: $orderBy="dateadd desc, idbooking desc"; $orderBy="md5(concat(curdate(),dateadd,curdate())) desc"; break; } $orderBy.=$orderByDefault; $this->db->setsql("select *, if(pricesingle=0,1000000,pricesingle) as ordsingle, if(pricedouble=0,1000000,pricedouble) as orddouble from booking $innerCond where valid=1 $whereCond order by $orderBy"); #print $this->db->sql; if ($this->thisIsSearchForm) { $link="/sb"; } else { $pageNrOrg=$this->pNr; if ($pageNrOrg>1) { $link=substr($this->pathCurrent,0,strrpos($this->pathCurrent,"/")); } else { $link=$this->pathCurrent; } } $this->paginateDb($this->perPage,$this->variablePaginate,$this->searchVar,$this->nrLeftRight,"PAGINATE",$link."/",$this->thisIsSearchForm); if ($this->pNr>1) { if ($this->thisIsSearchForm) $linkPrevious=$link."/?".$this->getMoreVars($this->searchVar)."&pNr=".($this->pNr-1); else $linkPrevious=$link.($this->pNr==2?"":"/".($this->pNr-1)); } if ($this->pNr<$this->paginateTotalPages) { if ($this->thisIsSearchForm) $linkNext=$link."/?".$this->getMoreVars($this->searchVar)."&pNr=".($this->pNr+1); else $linkNext=$link."/".($this->pNr+1); } $this->ft->assign(array("PAGINATEBOOKINGPREVIOUS"=>(strlen($linkPrevious)?"Anterioara":"Anterioara"))); $this->ft->assign(array("PAGINATEBOOKINGNEXT"=>(strlen($linkNext)?"Urmatoare":"Urmatoare"))); #print "
OBJECT LIST SQL:".$this->db->sql; $cont=0; $this->keywordAdd("cazare"); while ($this->db->getresult()) { for ($i=1;$i<=5;$i++) { if ($i<=$this->db->result["stars"]) { $styleStar='style="position:relative;top:-33px;"'; } else { $styleStar=""; } $this->ft->assign(array("STYLESTAR$i"=>$styleStar)); } $bookingLink="/cazare".($this->db->result["idcity"]?$this->getCityLink($this->db->result["idcity"]):$this->getCountyLink($this->db->result["idcounty"])); $this->ft->assign(array("OBJTITLE"=>trim($this->db->result["nametype"]." ".$this->db->result["name"]))); $this->ft->assign(array("BOOKPROPTYPE"=>$this->dictionary["address"],"BOOKPROPVAL"=>trim($this->db->result["address"]." ".$this->getCityName($this->db->result["idcity"]).", ".$this->getCountyName($this->db->result["idcounty"])),"BIMG"=>(strlen($this->db->result["photo"])==0?"d.jpg":$this->db->result["photo"]),"BOOKINGLINK"=>$bookingLink."/".$this->db->result["link"])); $this->ft->parse("OBJLISTVAL",".objlistval"); if (strlen($this->db->result["phone"])) { $this->ft->assign(array("BOOKPROPTYPE"=>$this->dictionary["phone"],"BOOKPROPVAL"=>$this->db->result["phone"])); $this->ft->parse("OBJLISTVAL",".objlistval"); } if (strlen($this->db->result["website"])) { $this->ft->assign(array("BOOKPROPTYPE"=>$this->dictionary["website"],"BOOKPROPVAL"=>"".$this->db->result["website"]."")); $this->ft->parse("OBJLISTVAL",".objlistval"); } /* if ((int)$this->db->result["pricesingle"]+(int)$this->db->result["pricedouble"]) { $this->ft->assign(array("BOOKPROPTYPE"=>"".$this->dictionary["price"]."","BOOKPROPVAL"=>"")); $this->ft->parse("OBJLISTVAL",".objlistval"); } if ((int)$this->db->result["pricesingle"]) { $this->ft->assign(array("BOOKPROPTYPE"=>$this->dictionary["single"],"BOOKPROPVAL"=>$this->db->result["pricesingle"])); $this->ft->parse("OBJLISTVAL",".objlistval"); } if ((int)$this->db->result["pricedouble"]) { $this->ft->assign(array("BOOKPROPTYPE"=>$this->dictionary["double"],"BOOKPROPVAL"=>$this->db->result["pricedouble"])); $this->ft->parse("OBJLISTVAL",".objlistval"); } */ $this->ft->parse("OBJLIST",".objlist"); $this->ft->clear("OBJLISTVAL"); $this->keywordAdd($this->db->result["nametype"]); $this->keywordAdd($this->db->result["name"]); $this->keywordAdd($this->getCityName($this->db->result["idcity"])); $this->keywordAdd($this->getCountyName($this->db->result["idcounty"])); $cont=1; } if ($cont==0) { $this->ft->clear_dynamic("objlist"); } #$this->otherZone(); $this->searchForm(); $this->ft->parse("BODY","list"); } function searchForm($tpl="SEARCHOBJVERTICAL") { if ($this->countyId>0) $this->sidcounty=$this->countyId; if ($this->cityId>0) $this->sidcity=$this->cityId; $listOfLinkVars=$this->getMoreVars(str_replace("sprtyp","",$this->searchVar.",".$this->variablePaginate)); #print $listOfLinkVars; $this->ft->assign(array("SNAME"=>$this->sname,"SEARCHPAGEEN"=>$this->paginateTotalPages,"SEARCHPAGEST"=>$this->pNr,"SEARCHDISPLAYMODE"=>($this->sidcounty?"":"display:none;"))); $this->ft->assign(array("MORESEARCHVAR"=>$listOfLinkVars)); #$this->ft->define(array("searchobj"=>"booking/searchvertical.html")); $this->ft->define(array("searchobj"=>"booking/search.html")); $this->ft->assign(array("SNAME"=>$this->sname)); $this->ft->define_dynamic("btype","searchobj"); $this->db->setsql("select idbookingtype, name from bookingtype order by name"); $this->parseOptionDb($this->sidbtype,"-Alege-","btype"); $this->ft->define_dynamic("county","searchobj"); $this->db->setsql("select idcounty, name from county order by name"); $this->parseOptionDb($this->sidcounty,"-Alege-","county"); $this->ft->define_dynamic("city","searchobj"); $this->db->setsql("select idcity, name from city where idcounty=".(int)$this->sidcounty." order by name"); $this->parseOptionDb($this->sidcity,"-Alege-","city"); $this->ft->define_dynamic("ordtype","searchobj"); $this->parseOptionHash($this->orderTab, $this->sot ,"","ordtype"); $this->ft->define_dynamic("ordlist","searchobj"); $this->parseOptionHash($this->sortTab, $this->sol ,"","ordlist"); $this->ft->parse($tpl,"searchobj"); } function view() { #print "
PATH SKIP:".$this->pathSkip; #print "
TB:";
#print_r($this->tabParam);
#print "
"; #print "
OBJ:".$this->db->sql; #if ($this->bookingId==43) { # $this->ft->assign(array("LOAD_INITIALIZATE"=>' onload="initialize()"',"BIMG"=>'
')); #} if (strlen($this->bookingLat)>0) { # $this->ft->assign(array("STATICMAP"=>"

")); } $this->searchForm(); $this->ft->define(array("view"=>"booking/view.html")); $this->ft->define_dynamic("objlist","view"); $this->ft->define_dynamic("objlistval","view"); $this->ft->define_dynamic("listmoreimg","view"); $this->breadCrumbAdd(trim($this->bookingNameType." ".$this->bookingName)); $titleMore=$this->bookingCityId?$this->getCityName($this->bookingCityId):""; $this->setTitle(trim($this->bookingNameType." ".$this->bookingName)." - ".$titleMore); $this->keywordAdd("cazare"); $this->keywordAdd($this->bookingName); $this->keywordAdd($this->bookingNameType); $this->keywordAdd($this->getCityName($this->bookingCityId)); $this->keywordAdd($this->getCountyName($this->bookingCountyId)); for ($i=1;$i<=5;$i++) { if ($i<=$this->bookingStars) { $styleStar='style="position:relative;top:-33px;"'; } else { $styleStar=""; } $this->ft->assign(array("STYLESTAR$i"=>$styleStar)); } $bookingLink="/cazare".($this->db->result["idcity"]?$this->getCityLink($this->db->result["idcity"]):$this->getCountyLink($this->db->result["idcounty"])); $this->ft->assign(array("OBJTITLE"=>trim($this->bookingNameType." ".$this->bookingName))); $this->ft->assign(array("IDOBJ"=>$this->bookingId,"BOOKPROPTYPE"=>$this->dictionary["address"],"BOOKPROPVAL"=>trim($this->bookingAddress." ".$this->getCityName($this->bookingCityId).", ".$this->getCountyName($this->bookingCountyId)))); #if ($this->bookingId<>43) $this->ft->assign(array("BIMG"=>"")); $this->db->setsql("select * from bookingphoto where idbooking=".$this->bookingId." and url not like '".$this->bookingPhoto."'"); while ($this->db->getresult()) { $this->ft->assign(array("BOOKINGMOREIMG"=>$this->db->result["url"])); $this->ft->parse("LISTMOREIMG",".listmoreimg"); } $this->ft->parse("OBJLISTVAL",".objlistval"); if (strlen($this->bookingPhone)) { $this->ft->assign(array("BOOKPROPTYPE"=>$this->dictionary["phone"],"BOOKPROPVAL"=>$this->bookingPhone)); $this->ft->parse("OBJLISTVAL",".objlistval"); } if (strlen($this->bookingWebsite)) { $this->ft->assign(array("BOOKPROPTYPE"=>$this->dictionary["website"],"BOOKPROPVAL"=>"".$this->bookingWebsite."")); $this->ft->parse("OBJLISTVAL",".objlistval"); } if ((int)$this->bookingPriceSingle+(int)$this->bookingPriceDouble) { $this->ft->assign(array("BOOKPROPTYPE"=>"".$this->dictionary["price"]."","BOOKPROPVAL"=>"")); $this->ft->parse("OBJLISTVAL",".objlistval"); } if ((int)$this->bookingPriceSingle) { $this->ft->assign(array("BOOKPROPTYPE"=>$this->dictionary["single"],"BOOKPROPVAL"=>$this->bookingPriceSingle." ".$this->bookingCoinPrint)); $this->ft->parse("OBJLISTVAL",".objlistval"); } if ((int)$this->bookingPriceDouble) { $this->ft->assign(array("BOOKPROPTYPE"=>$this->dictionary["double"],"BOOKPROPVAL"=>$this->bookingPriceDouble." ".$this->bookingCoinPrint)); $this->ft->parse("OBJLISTVAL",".objlistval"); } #$this->otherZone(); $this->ft->parse("BODY","view"); } function otherZone() { $this->ft->define(array("other"=>"booking/other.html")); $this->ft->define_dynamic("otherbooking","other"); $this->ft->define_dynamic("otherbookinglist","other"); #print $this->pathSkip; if ($this->cityId) { $whereCond=" and idcity=".$this->cityId; $linkLocation=$this->getCityLink($this->cityId); $this->ft->assign(array("OTHEROBJNAME"=>$this->getCityName($this->cityId),"OTHEROBJLINK"=>$this->getCityLink($this->cityId))); $this->ft->parse("OTHEROBJECTLIST",".otherbookinglist"); $this->ft->assign(array("OTHEROBJTITLE"=>$this->dictionary["city"])); $this->ft->parse("OTHEROBJECT",".otherbooking"); $this->ft->clear("OTHEROBJECTLIST"); } elseif ($this->countyId) { $whereCond=" and idcounty=".$this->countyId; $linkLocation=$this->getCountyLink($this->countyId); $this->ft->assign(array("OTHEROBJNAME"=>$this->getCountyName($this->countyId),"OTHEROBJLINK"=>$this->getCountyLink($this->countyId))); $this->ft->parse("OTHEROBJECTLIST",".otherbookinglist"); $this->ft->assign(array("OTHEROBJTITLE"=>$this->dictionary["county"])); $this->ft->parse("OTHEROBJECT",".otherbooking"); $this->ft->clear("OTHEROBJECTLIST"); } elseif ($this->countryId) { $whereCond=" and idcountry=".$this->countryId; $linkLocation=$this->getCountryLink($this->countryId); } else { # $whereCond=" and 1=2"; } #if (strlen($this->countyLink)) # $linkLocation.="/".$this->countyLink; #if (strlen($this->cityLink)) # $linkLocation.="/".$this->cityLink; #print $linkLocation; $this->bookingNamebooking=$this->getObjectnameName($this->bookingnameId); #print "
OID:".$this->bookingnameId; #print "
ONAME:".$this->bookingNamebooking; $this->db->setsql("select idcity, idcounty, idcountry, namebooking, name, link from booking where idbooking<>".(int)$this->bookingId." and idbookingname=".(int)$this->bookingnameId.$whereCond." order by name"); $counter=0; while ($this->db->getresult()) { if ($this->db->result["idcity"]) $link=$this->getCityLink($this->db->result["idcity"]); elseif ($this->db->result["icounty"]) $link=$this->getCountyLink($this->db->result["idcounty"]); elseif ($this->db->result["idcountry"]) $link=$this->getCountryLink($this->db->result["idcountry"]); $this->ft->assign(array("OTHEROBJNAME"=>$this->db->result["name"],"OTHEROBJLINK"=>$link."/".$this->db->result["link"])); $this->ft->parse("OTHEROBJECTLIST",".otherbookinglist"); $counter=1; } if ($counter && strlen($this->bookingNamebooking)){ $this->ft->assign(array("OTHEROBJTITLE"=>$this->bookingNamebooking)); $this->ft->parse("OTHEROBJECT",".otherbooking"); $this->ft->clear("OTHEROBJECTLIST"); } $this->db->setsql("select booking.idcity, bookingname.name, bookingname.link from booking inner join bookingname on bookingname.idbookingname=booking.idbookingname and booking.idbookingname<>".(int)$this->bookingnameId.$whereCond.(strlen($whereCond)==0 && (int)$this->bookingnameId==0?" and main=1":"")." group by booking.idbookingname order by bookingname.name"); #print $this->db->sql; $counter1=0; $link=""; if ($this->cityId) $link=$this->getCityLink($this->cityId); elseif ($this->countyId) $link=$this->getCountyLink($this->countyId); elseif ($this->countryId) $link=$this->getCountryLink($this->countryId); while ($this->db->getresult()) { $this->ft->assign(array("OTHEROBJNAME"=>$this->db->result["name"],"OTHEROBJLINK"=>$link."/".$this->db->result["link"])); $this->ft->parse("OTHEROBJECTLIST",".otherbookinglist"); $counter1=1; } if ($counter1){ $this->ft->assign(array("OTHEROBJTITLE"=>$this->dictionary["other_bookingname"])); $this->ft->parse("OTHEROBJECT",".otherbooking"); } $this->ft->parse("OTHERZONE","other"); } function search() { if ((int)$this->sidcounty>0) { $this->countyId=(int)$this->sidcounty; } if ((int)$this->sidcity>0) { $this->cityId=(int)$this->sidcity; } $this->thisIsSearchForm=true; $this->listBooking(); $this->promoObject(); } } ?>