query("SELECT * FROM hiper_iroda WHERE aktiv='1'".$this->getInactiveOffices()." ORDER BY ".$_SESSION['storedOfficeOrderField']." ".$_SESSION['storedOfficeOrderDirection'].";"); return sizeof($res); } public function getOfficesList() { if ($_SESSION['storedOfficeOrderField']=='') $_SESSION['storedOfficeOrderField'] = 'nev'; if ($_SESSION['storedOfficeOrderDirection']=='') $_SESSION['storedOfficeOrderDirection'] = 'ASC'; $res = $this->query("SELECT * FROM hiper_iroda WHERE aktiv='1'".$this->getInactiveOffices()." ORDER BY ".$_SESSION['storedOfficeOrderField']." ".$_SESSION['storedOfficeOrderDirection'].";"); if (sizeof($res)>0) { return $res; } else { return false; } } public function getInactiveOffices() { $check = $this->query("SELECT * FROM irodak where active='0';"); foreach ($check as $row) { $temp[] = $row->office_id; } if (count($temp)>0) { return ' AND azonosito NOT IN (\''.implode('\',\'',$temp).'\')'; } else { return ''; } } public function checkOffice($id) { $check = $this->query("SELECT * FROM irodak where office_id='".$id."';"); if ($check[0]->active=='1') { return true; } else if ($check[0]->active=='0') { return false; } else { return true; } } public function getOfficeNames() { $result = $this->query("SELECT nev FROM hiper_iroda WHERE nev<>'' AND aktiv='1'".$this->getInactiveOffices()." ORDER BY nev ASC;"); return $result; } public function get_bemutatkozas($id) { $result = $this->query("SELECT * FROM irodak WHERE office_id='".$id."';"); return $result[0]->description; } public function get_pixelid($id) { $result = $this->query("SELECT * FROM irodak WHERE office_id='".$id."';"); return $result[0]->pixelid; } public function getOffice($id) { $id = $this->escapeString($id); if ($id!=='') { $result = $this->query("SELECT * FROM hiper_iroda WHERE id='".$id."';"); if (sizeof($result)>0) { return $result[0]; } else { return false; } } else { return false; } } public function getOfficeAgents($id) { $id = $this->escapeString($id); if ($id!=='') { $result = $this->query("SELECT * FROM hiper_munkatars WHERE iroda='".$id."';"); if (sizeof($result)>0) { return $result; } else { return false; } } else { return false; } } public function getOfficePropertiesCount($office_code) { $office_code = $this->escapeString($office_code); if ($office_code!=='') { $result = $this->query("SELECT * FROM hiper_ingatlan WHERE iroda='".$office_code."' AND statusz='aktualis' AND rockhomera_mehet='1' ORDER BY letrehozva DESC;"); return sizeof($result); } else { return false; } } public function getOfficePropertiesList($office_code) { $office_code = $this->escapeString($office_code); if ($office_code!=='') { $result = $this->query("SELECT *,getimgurl(indexkep,'ingatlan') AS indexkep FROM hiper_ingatlan WHERE iroda='".$office_code."' AND statusz='aktualis' AND rockhomera_mehet='1' ORDER BY letrehozva DESC;"); if (sizeof($result)>0) { return $result; } else { return false; } } else { return false; } } public function getOfficePropertiesListShort($office_code) { $office_code = $this->escapeString($office_code); if ($office_code!=='') { $result = $this->query("SELECT *,getimgurl(indexkep,'ingatlan') AS indexkep FROM hiper_ingatlan WHERE iroda='".$office_code."' AND statusz='aktualis' AND rockhomera_mehet='1' ORDER BY letrehozva DESC LIMIT 0,3;"); if (sizeof($result)>0) { return $result; } else { return false; } } else { return false; } } public function addRate($data) { $data = $this->escapeArray($data); if ($data['id']!=='' && $data['rate']!=='' && $_SESSION['userid']!=='') { $check = $this->query("SELECT * FROM iroda_ratings WHERE iroda='".$data['id']."' AND statusz='1' AND userid='".$_SESSION['userid']."';"); if (sizeof($check)>0) { return 'error'; } else { $this->execute("INSERT INTO iroda_ratings SET iroda='".$data['id']."', rate='".$data['rate']."', userid='".$_SESSION['userid']."';"); return 'ok'; } } else { return 'error'; } } public function getOfficesListSearch($search) { if ($_SESSION['storedOfficeOrderField']=='') $_SESSION['storedOfficeOrderField'] = 'nev'; if ($_SESSION['storedOfficeOrderDirection']=='') $_SESSION['storedOfficeOrderDirection'] = 'ASC'; $tempSQL = ''; if ($search['city']!='') { $list = explode(",",$search['city']); $cities = ""; foreach ($list as $city) { $cities.= "'".$city."',"; } $cities = rtrim($cities,','); $tempSQL.= " AND varos IN (".$cities.")"; } if ($search['officename']!='') { $list = explode(",",$search['officename']); $names = ""; foreach ($list as $name) { $names.= "'".$name."',"; } $names = rtrim($names,','); $tempSQL.= " AND nev IN (".$names.")"; } $result = $this->query("SELECT * FROM hiper_iroda WHERE aktiv='1'".$this->getInactiveOffices()."".$tempSQL." ORDER BY ".$_SESSION['storedOfficeOrderField']." ".$_SESSION['storedOfficeOrderDirection'].";"); if (sizeof($result)>0) { return $result; } else { return false; } } public function getOfficesCountSearch($resultset) { return sizeof($resultset); } public function get_telepulesek() { $result = $this->query("SELECT varos FROM hiper_iroda WHERE varos<>'' AND aktiv='1' GROUP BY varos ORDER BY varos ASC;"); return $result; } public function get_ertekesites_tipusok() { $result = $this->query("SELECT ertekesites FROM hiper_ingatlan WHERE ertekesites<>'' AND statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0') GROUP BY ertekesites ORDER BY ertekesites ASC;"); return $result; } public function get_jelleg_tipusok() { $resultx = $this->query("SELECT tipus FROM hiper_ingatlan WHERE tipus<>'' AND statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0') GROUP BY tipus ORDER BY tipus ASC;"); $resulty = $this->query("SELECT jelleg FROM hiper_ingatlan WHERE jelleg<>'lakoingatlan' AND statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0') GROUP BY jelleg ORDER BY jelleg ASC;"); foreach ($resultx as $row) { $row->jelleg = 'Lakóingatlan - '.$row->tipus; $result[] = $row; } foreach ($resulty as $row) { $result[] = $row; } return $result; } public function get_properties_telepulesek() { $result = $this->query("SELECT telepules FROM hiper_ingatlan WHERE telepules<>'' AND statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0') GROUP BY telepules ORDER BY telepules ASC;"); return $result; } public function getOfficeUserName($id) { $id = $this->escapeString($id); if ($id!=='') { $office = $this->query("SELECT * FROM hiper_iroda WHERE id='".$id."';"); if (sizeof($office)>0) { return $office[0]->azonosito; } else { return false; } } else { return false; } } public function get_property_list_by_filter($search) { $search = $this->escapeArray($search); $tempSQL = "SELECT *,getimgurl(indexkep,'ingatlan') AS indexkep, szoba_egesz+szoba_fel AS szoba FROM hiper_ingatlan WHERE statusz='aktualis' AND rockhomera_mehet='1'"; if ($_SESSION['storedOrderField']=='') $_SESSION['storedOrderField'] = 'letrehozva'; if ($_SESSION['storedOrderDirection']=='') $_SESSION['storedOrderDirection'] = 'DESC'; if ($search['from']!='') { $tempSQL.= " AND iroda='".$search['office']."'"; if ($search['ertekesites']!='') $tempSQL.= " AND ertekesites='".$search['ertekesites']."'"; if ($search['jelleg']!='') $tempSQL.= " AND jelleg='".$search['jelleg']."'"; if ($search['tipus']!='') $tempSQL.= " AND tipus='".$search['tipus']."'"; if ($search['city']!='') { $list = explode(",",$search['city']); $cities = ""; foreach ($list as $city) { $cities.= "'".$city."',"; } $cities = rtrim($cities,','); $tempSQL.= " AND telepules IN (".$cities.")"; } $pmin = $search['iranyar_min']*1000000; $pmax = $search['iranyar_max']*1000000; if ($search['iranyar_min']!='') $tempSQL.= " AND iranyar>='".$pmin."'"; if ($search['iranyar_max']!='') $tempSQL.= " AND iranyar<='".$pmax."'"; if ($search['meret_netto_min']!='') $tempSQL.= " AND meret_netto>='".$search['meret_netto_min']."'"; if ($search['meret_netto_max']!='') $tempSQL.= " AND meret_netto<='".$search['meret_netto_max']."'"; if ($search['altipus']!='') { $list = explode(",",$search['altipus']); $altipusok = ""; foreach ($list as $altipus) { $altipusok.= "'".$altipus."',"; } $altipusok = rtrim($altipusok,','); $tempSQL.= " AND altipus IN (".$altipusok.")"; } if ($search['jogi_statusz']!='') $tempSQL.= " AND jogi_statusz='".$search['jogi_statusz']."'"; if ($search['szoba_min']!='' && $search['szoba_max']=='') $tempSQL.= " HAVING szoba>='".$search['szoba_min']."'"; if ($search['szoba_max']!='' && $search['szoba_min']=='') $tempSQL.= " HAVING szoba<='".$search['szoba_max']."'"; if ($search['szoba_max']!='' && $search['szoba_min']!='') $tempSQL.= " HAVING szoba>='".$search['szoba_min']."' AND szoba<='".$search['szoba_max']."'"; if ($search['kilatas']!='') { $list = explode(",",$search['kilatas']); $kilatasok = ""; foreach ($list as $kilatas) { $kilatasok.= "'".$kilatas."',"; } $kilatasok = rtrim($kilatasok,','); $tempSQL.= " AND kilatas IN (".$kilatasok.")"; } if ($search['futes']!='') { $list = explode(",",$search['futes']); $futesek = ""; foreach ($list as $futes) { $futesek.= "'".$futes."',"; } $futesek = rtrim($futesek,','); $tempSQL.= " AND futes IN (".$futesek.")"; } if ($search['tajolas']!='') { $list = explode(",",$search['tajolas']); $tajolasok = ""; foreach ($list as $tajolas) { $tajolasok.= "'".$tajolas."',"; } $tajolasok = rtrim($tajolasok,','); $tempSQL.= " AND tajolas IN (".$tajolasok.")"; } if ($search['allapot']!='') { $list = explode(",",$search['allapot']); $allapotok = ""; foreach ($list as $allapot) { $allapotok.= "'".$allapot."',"; } $allapotok = rtrim($allapotok,','); $tempSQL.= " AND ingatlan_allapota IN (".$allapotok.")"; } if ($search['kornyek']!='') { $list = explode(",",$search['kornyek']); $kornyekek = ""; foreach ($list as $kornyek) { $kornyekek.= "'".$kornyek."',"; } $kornyekek = rtrim($kornyekek,','); $tempSQL.= " AND kornyek IN (".$kornyekek.")"; } if ($search['epites_eve_min']!='') $tempSQL.= " AND epites_eve>='".$search['epites_eve_min']."'"; if ($search['epites_eve_max']!='') $tempSQL.= " AND epites_eve<='".$search['epites_eve_max']."'"; if ($search['telek_min']!='') $tempSQL.= " AND meret_telek>='".$search['telek_min']."'"; if ($search['telek_max']!='') $tempSQL.= " AND meret_telek<='".$search['telek_max']."'"; if ($search['ferohely_garazs_min']!='') $tempSQL.= " AND ferohely_garazs>='".$search['ferohely_garazs_min']."'"; if ($search['ferohely_garazs_max']!='') $tempSQL.= " AND ferohely_garazs<='".$search['ferohely_garazs_max']."'"; if ($search['kulon_nyilo_szobak']=='1') $tempSQL.= " AND kulon_nyilo_szobak='1'"; if ($search['terasz']=='1') $tempSQL.= " AND terasz='1'"; if ($search['erkely']=='1') $tempSQL.= " AND erkely='1'"; if ($search['pince']=='1') $tempSQL.= " AND pince='1'"; if ($search['tarolo']=='1') $tempSQL.= " AND tarolo='1'"; if ($search['garazs']=='1') $tempSQL.= " AND garazs='1'"; if ($search['ferohely_fedettbeallo']=='1') $tempSQL.= " AND ferohely_fedettbeallo='1'"; if ($search['kertkapcsolatos']=='1') $tempSQL.= " AND kertkapcsolatos='1'"; if ($search['viz']=='1') $tempSQL.= " AND viz='1'"; if ($search['gaz']=='1') $tempSQL.= " AND gaz='1'"; if ($search['villany']=='1') $tempSQL.= " AND villany='1'"; if ($search['csatorna']=='1') $tempSQL.= " AND csatorna='1'"; if ($search['lift']=='1') $tempSQL.= " AND lift='1'"; } $tempSQL.= " ORDER BY ".$_SESSION['storedOrderField']." ".$_SESSION['storedOrderDirection'].";"; $querySQL = $tempSQL; //die($querySQL); $_SESSION['storedQuery'] = $querySQL; //echo($querySQL); $result = $this->query($querySQL); return $result; } public function get_teruletek($partnerid) { $partnerid = $this->escapeString($partnerid); $res = $this->query("SELECT * FROM hiper_terulet WHERE id_partner='".$partnerid."' AND aktiv='1' ORDER BY nev ASC;"); return $res; } }