| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867 |
- <?php
- class property_model extends Model {
- public function get_property($id) {
- $id = $this->escapeString($id);
- //die("SELECT *, alap.regszam AS uniqazonosito FROM hiper_ingatlan as alap LEFT JOIN hiper_ingatlan_other ON hiper_ingatlan_other.id_ingatlan=alap.id WHERE alap.id='".$id."' AND rockhomera_mehet='1';");
- $result = $this->query("SELECT *, alap.regszam AS uniqazonosito FROM hiper_ingatlan as alap LEFT JOIN hiper_ingatlan_other ON hiper_ingatlan_other.id_ingatlan=alap.id WHERE alap.id='".$id."';");
- if (sizeof($result)>0) {
- return $result[0];
- }
- else {
- return false;
- }
- }
- public function get_propertybyreg($regnum) {
- $regnum = $this->escapeString($regnum);
- $result = $this->query("SELECT * FROM hiper_ingatlan as alap LEFT JOIN hiper_ingatlan_other ON hiper_ingatlan_other.id_ingatlan=alap.id WHERE alap.regszam='".$regnum."' AND rockhomera_mehet='1';");
- if (sizeof($result)>0) {
- return $result[0];
- }
- else {
- return false;
- }
- }
- public function getPropertyID($code) {
- $result = $this->query("SELECT * FROM hiper_ingatlan WHERE regszam='".$code."' AND rockhomera_mehet='1';");
- if (sizeof($result)>0) {
- return $result[0]->id;
- }
- else {
- return false;
- }
- }
- public function get_property_description($id) {
- $id = $this->escapeString($id);
- $result = $this->query("SELECT * FROM hiper_ingatlan_text WHERE regszam='".$id."';");
- if (sizeof($result)>0) {
- return $result[0]->leiras;
- }
- else {
- return false;
- }
- }
- public function get_property_szlogen($id) {
- $id = $this->escapeString($id);
- $result = $this->query("SELECT * FROM hiper_ingatlan_text WHERE regszam='".$id."';");
- if (sizeof($result)>0) {
- return $result[0]->szlogen;
- }
- else {
- return false;
- }
- }
- public function get_property_sales($user) {
- $user = $this->escapeString($user);
- $result = $this->query("SELECT * FROM hiper_munkatars WHERE felhasznalonev='".$user."';");
- if (sizeof($result)>0) {
- return $result[0];
- }
- else {
- return false;
- }
- }
- public function get_property_images($id) {
- $id = $this->escapeString($id);
- $result = $this->query("SELECT *,getimgurl(fajlnev,'ingatlan') AS fajlnev FROM hiper_ingatlan_kep WHERE regszam='".$id."' AND webremehet='1' ORDER BY sorrend ASC;");
- if (sizeof($result)>0) {
- return $result;
- }
- else {
- return false;
- }
- }
- public function get_property_alaprajz($id) {
- $id = $this->escapeString($id);
- $result = $this->query("SELECT *,getimgurl(fajlnev,'ingatlan') AS fajlnev FROM hiper_ingatlan_kep WHERE tipus='0' AND regszam='".$id."' AND webremehet='1' ORDER BY sorrend ASC;");
- if (sizeof($result)>0) {
- return $result;
- }
- else {
- return false;
- }
- }
- public function getAgentName($id) {
- $id = $this->escapeString($id);
- if ($id!='') {
- $agent = $this->query("SELECT * FROM hiper_munkatars WHERE felhasznalonev='".$id."';");
- if (sizeof($agent)>0) {
- return $agent[0]->nev;
- }
- else {
- return false;
- }
- }
- else {
- return false;
- }
- }
- public function get_office($id) {
- $id = $this->escapeString($id);
- if ($id!='') {
- $office = $this->query("SELECT * FROM hiper_iroda WHERE azonosito='".$id."';");
- if (sizeof($office)>0) {
- return $office[0];
- }
- else {
- return false;
- }
- }
- 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 iroda 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 get_property_list($search) {
- if ($search['jelleg']=='' && $search['jellegorig']!='') $search['jelleg'] = $search['jellegorig'];
- if ($search['jelleg'] == 'Beruházást igénylő') $search['jelleg'] = 'beruhazasi';
- $search = $this->escapeArray($search);
- $tempSQL = "SELECT *,getimgurl(indexkep,'ingatlan') AS indexkep FROM hiper_ingatlan WHERE statusz='aktualis' AND rockhomera_mehet='1'".$this->getInactiveOffices();
- if ($_SESSION['storedOrderField']=='') $_SESSION['storedOrderField'] = 'letrehozva';
- if ($_SESSION['storedOrderDirection']=='') $_SESSION['storedOrderDirection'] = 'DESC';
- if ($search['agent']!='') {
- $tempSQL.= " AND tanacsado='".$search['agent']."'";
- $title = $this->getAgentName($search['agent']).' tanácsadó ingatlanjai';
- }
- elseif ($search['office']!='') {
- $tempSQL.= " AND iroda='".$search['office']."'";
- }
- elseif ($search['from']!='') {
- if ($search['ertekesites']!='') $tempSQL.= " AND ertekesites='".$search['ertekesites']."'";
- if ($search['jelleg']!='nyaralo') {
- if ($search['jelleg']!='') $tempSQL.= " AND jelleg='".$search['jelleg']."'";
- if ($search['tipus']!='') $tempSQL.= " AND tipus='".$search['tipus']."'";
- }
- else {
- $tempSQL.= " AND nyaralo='1'";
- }
- if ($search['city']!='') {
- $list = explode(",",$search['city']);
- $cities = "";
- $megyek = "";
- foreach ($list as $city) {
- if ($city!='Budapest' && stristr($city," (")==false && $city!='Bács-Kiskun' && $city!='Nográd' && $city!='Borsod-Abaúj-Zemplén' && $city!='Pest' && $city!='Győr-Moson-Sopron' && $city!='Baranya' && $city!='Békés' && $city!='Somogy' && $city!='Jász-Nagykun-Szolnok' && $city!='Csongrád' && $city!='Tolna' && $city!='Komárom-Esztergom' && $city!='Fejér' && $city!='Vas' && $city!='Szabolcs-Szatmár-Bereg' && $city!='Hajdú-Bihar' && $city!='Veszprém' && $city!='Heves' && $city!='Zala') {
- $cities.= "'".$city."',";
- }
- elseif ($city=='Bács-Kiskun' || $city=='Nográd' || $city=='Borsod-Abaúj-Zemplén' || $city=='Pest' || $city=='Győr-Moson-Sopron' || $city=='Baranya' || $city=='Békés' || $city=='Somogy' || $city=='Jász-Nagykun-Szolnok' || $city=='Csongrád' || $city=='Tolna' || $city=='Komárom-Esztergom' || $city=='Fejér' || $city=='Vas' || $city=='Szabolcs-Szatmár-Bereg' || $city=='Hajdú-Bihar' || $city=='Veszprém' || $city=='Heves' || $city=='Zala') {
- $city = strtolower($city);
- $megyek.= "'".$city."',";
- }
- }
- $megyek = rtrim($megyek,',');
- if ($megyek!='') {
- $tempSQL.= " AND (megye IN (".$megyek.")";
- }
- $cities = rtrim($cities,',');
- if ($cities!='') {
- $tempSQL.= " AND (telepules IN (".$cities.")";
- }
- }
-
- if ($search['city']!='') {
- $list = explode(",",$search['city']);
- $cities = "";
- $hasStreet = false;
- $utcaSQL = "";
- foreach ($list as $city) {
- if ($city=='Budapest') {
- $tempSQL.= " OR megye='budapest'";
- }
- elseif (stristr($city," (")) {
- if ($hasStreet==false) {
- $utcaSQL.= " AND (";
- }
- $hasStreet = true;
- $dtemp = explode(" (",$city);
- $varosTemp = str_replace(")","",$dtemp[1]);
- $utcaTemp = $dtemp[0];
- $utcaSQL.= "(utcanev='".$utcaTemp."' AND telepules='".$varosTemp."') OR ";
- }
- }
- if ($hasStreet==false) {
- $tempSQL.= ")";
- }
- $utcaSQL = rtrim($utcaSQL," OR ");
- if ($utcaSQL!='') {
- $utcaSQL.= ")";
- }
- $tempSQL.= $utcaSQL;
- //die($tempSQL);
- }
- if ($_SESSION['statusz_switch']=='uj') $tempSQL.= " AND jogi_statusz='uj'";
- if ($_SESSION['statusz_switch']=='legujabb') $tempSQL.= " AND letrehozva >= DATE(NOW()) - INTERVAL 14 DAY";
-
- if ($search['ertekesites']=='elado') {
- if ($search['iranyar_min']!='') $tempSQL.= " AND iranyar>='".$search['iranyar_min']."000000'";
- if ($search['iranyar_max']!='') $tempSQL.= " AND iranyar<='".$search['iranyar_max']."000000'";
- }
- else {
- if ($search['iranyar_min']!='') $tempSQL.= " AND iranyar>='".$search['iranyar_min']."000'";
- if ($search['iranyar_max']!='') $tempSQL.= " AND iranyar<='".$search['iranyar_max']."000'";
- }
-
- if ($search['meret_netto_min']!='') $tempSQL.= " AND meret_brutto>='".$search['meret_netto_min']."'";
- if ($search['meret_netto_max']!='') $tempSQL.= " AND meret_brutto<='".$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']!='') $tempSQL.= " AND szoba>='".$search['szoba_min']."'";
- //if ($search['szoba_max']!='') $tempSQL.= " 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'";
- $title = "Találatok";
- }
- else {
- $title = "Ingatlanok";
- }
- $tempSQL = str_replace("' OR megye='budapest')","' AND megye='budapest'",$tempSQL);
- //print_r($search);
- //die($tempSQL);
- $allSQL = $tempSQL." ORDER BY ".$_SESSION['storedOrderField']." ".$_SESSION['storedOrderDirection'].";";
- $tempSQL.= " ORDER BY ".$_SESSION['storedOrderField']." ".$_SESSION['storedOrderDirection'].$this->lazy_loader().";";
- $querySQL = $tempSQL;
- $_SESSION['storedQuery'] = $querySQL;
- //$_SESSION['storedQuery'] = "";
- //print_r($search);
- //die($_SESSION['storedQuery']);
-
- $result = $this->query($querySQL);
- $count = $this->query($allSQL);
- if (($search['szoba_min']!='' || $search['szoba_max']!='') && ($search['szoba_min']!='1' && $search['szoba_max']!='100')) {
- foreach ($count as $row) {
- if ($row->tipus=='') $row->tipus = $row->jelleg;
- $szoba = $row->szoba_fel+$row->szoba_egesz;
- if ($szoba>=$search['szoba_min'] && $szoba<=$search['szoba_max'] && $search['jelleg']!='telek') {
- $return[] = $row;
- }
- elseif ($search['jelleg']=='telek') {
- $return[] = $row;
- }
- }
- $result = $return;
- }
- elseif (($search['szoba_min']!='' || $search['szoba_max']!='') && ($search['szoba_min']!='1' && $search['szoba_max']=='100')) {
- foreach ($count as $row) {
- if ($row->tipus=='') $row->tipus = $row->jelleg;
- $szoba = $row->szoba_fel+$row->szoba_egesz;
- if ($szoba>=$search['szoba_min'] && $szoba<=$search['szoba_max'] && $search['jelleg']!='telek') {
- $return[] = $row;
- }
- elseif ($search['jelleg']=='telek') {
- $return[] = $row;
- }
- }
- $result = $return;
- }
- elseif (($search['szoba_min']!='' || $search['szoba_max']!='') && ($search['szoba_min']=='1' && $search['szoba_max']!='100' && $search['szoba_max']!='')) {
- foreach ($count as $row) {
- if ($row->tipus=='') $row->tipus = $row->jelleg;
- $szoba = $row->szoba_fel+$row->szoba_egesz;
- if ($szoba>=$search['szoba_min'] && $szoba<=$search['szoba_max'] && $search['jelleg']!='telek') {
- $return[] = $row;
- }
- elseif ($search['jelleg']=='telek') {
- $return[] = $row;
- }
- }
- $result = $return;
- }
- elseif ($search['szoba_min']=='1' && $search['szoba_max']=='100') {
- foreach ($count as $row) {
- $return[] = $row;
- }
- $result = $return;
- }
- if ($_SESSION['statusz_switch']=='arcsokkent') {
- $return = null;
- foreach ($count as $row) {
- if ($this->isArcsokkent($row->regszam)) {
- $return[] = $row;
- }
- }
- $result = $return;
- $count = $return;
- }
- if (sizeof($result)>0) {
- $response['error'] = false;
- $response['errorMessage'] = 'ok';
- $response['title'] = $title;
- $response['list'] = $result;
- $response['count'] = sizeof($count);
- }
- else {
- $response['error'] = true;
- $response['errorMessage'] = 'empty';
- }
- return $response;
- }
- public function isArcsokkent($code) {
- if ($code!='') {
- $check = $this->query("SELECT * FROM hiper_ingatlan_ertekesites WHERE regszam='".$code."' AND arcsokkenes='1';");
- if ($check[0]->arcsokkenes=='1') {
- return true;
- }
- else {
- return false;
- }
- }
- else {
- return false;
- }
- }
- public function lazy_loader() {
- if ($_SESSION['storedPager']=='') $_SESSION['storedPager'] = '0';
- return " LIMIT ".$_SESSION['storedPager'].",8;";
- }
- public function lazy_has_more($search) {
- if ($_SESSION['storedPager']=='') $_SESSION['storedPager'] = '0';
- $search = $this->escapeArray($search);
- $tempSQL = "SELECT *,getimgurl(indexkep,'ingatlan') AS indexkep FROM hiper_ingatlan WHERE statusz='aktualis' AND rockhomera_mehet='1'";
- if ($_SESSION['storedOrderField']=='') $_SESSION['storedOrderField'] = 'letrehozva';
- if ($_SESSION['storedOrderDirection']=='') $_SESSION['storedOrderDirection'] = 'DESC';
- if ($search['agent']!='') {
- $tempSQL.= " AND tanacsado='".$search['agent']."'";
- $title = $this->getAgentName($search['agent']).' tanácsadó ingatlanjai';
- }
- elseif ($search['from']!='') {
- if ($search['ertekesites']!='') $tempSQL.= " AND ertekesites='".$search['ertekesites']."'";
- if ($search['jelleg']!='nyaralo') {
- if ($search['jelleg']!='') $tempSQL.= " AND jelleg='".$search['jelleg']."'";
- if ($search['tipus']!='') $tempSQL.= " AND tipus='".$search['tipus']."'";
- }
- else {
- $tempSQL.= " AND nyaralo='1'";
- }
- if ($search['city']!='') {
- $list = explode(",",$search['city']);
- $cities = "";
- $megyek = "";
- foreach ($list as $city) {
- if ($city!='Budapest' && stristr($city," (")==false && $city!='Bács-Kiskun' && $city!='Nográd' && $city!='Borsod-Abaúj-Zemplén' && $city!='Pest' && $city!='Győr-Moson-Sopron' && $city!='Baranya' && $city!='Békés' && $city!='Somogy' && $city!='Jász-Nagykun-Szolnok' && $city!='Csongrád' && $city!='Tolna' && $city!='Komárom-Esztergom' && $city!='Fejér' && $city!='Vas' && $city!='Szabolcs-Szatmár-Bereg' && $city!='Hajdú-Bihar' && $city!='Veszprém' && $city!='Heves' && $city!='Zala') {
- $cities.= "'".$city."',";
- }
- elseif ($city=='Bács-Kiskun' || $city=='Nográd' || $city=='Borsod-Abaúj-Zemplén' || $city=='Pest' || $city=='Győr-Moson-Sopron' || $city=='Baranya' || $city=='Békés' || $city=='Somogy' || $city=='Jász-Nagykun-Szolnok' || $city=='Csongrád' || $city=='Tolna' || $city=='Komárom-Esztergom' || $city=='Fejér' || $city=='Vas' || $city=='Szabolcs-Szatmár-Bereg' || $city=='Hajdú-Bihar' || $city=='Veszprém' || $city=='Heves' || $city=='Zala') {
- $city = strtolower($city);
- $megyek.= "'".$city."',";
- }
- }
- $megyek = rtrim($megyek,',');
- if ($megyek!='') {
- $tempSQL.= " AND (megye IN (".$megyek.")";
- }
- $cities = rtrim($cities,',');
- if ($cities!='') {
- $tempSQL.= " AND (telepules IN (".$cities.")";
- }
- }
-
- if ($search['city']!='') {
- $list = explode(",",$search['city']);
- $cities = "";
- $hasStreet = false;
- $utcaSQL = "";
- foreach ($list as $city) {
- if ($city=='Budapest') {
- $tempSQL.= " OR megye='budapest'";
- }
- elseif (stristr($city," (")) {
- if ($hasStreet==false) {
- $utcaSQL.= " AND (";
- }
- $hasStreet = true;
- $dtemp = explode(" (",$city);
- $varosTemp = str_replace(")","",$dtemp[1]);
- $utcaTemp = $dtemp[0];
- $utcaSQL.= "(utcanev='".$utcaTemp."' AND telepules='".$varosTemp."') OR ";
- }
- }
- if ($hasStreet==false) {
- $tempSQL.= ")";
- }
- $utcaSQL = rtrim($utcaSQL," OR ");
- if ($utcaSQL!='') {
- $utcaSQL.= ")";
- }
- $tempSQL.= $utcaSQL;
- //die($tempSQL);
- }
- if ($_SESSION['statusz_switch']=='uj') $tempSQL.= " AND jogi_statusz='uj'";
- if ($_SESSION['statusz_switch']=='legujabb') $tempSQL.= " AND letrehozva >= DATE(NOW()) - INTERVAL 14 DAY";
-
- if ($search['ertekesites']=='elado') {
- if ($search['iranyar_min']!='') $tempSQL.= " AND iranyar>='".$search['iranyar_min']."000000'";
- if ($search['iranyar_max']!='') $tempSQL.= " AND iranyar<='".$search['iranyar_max']."000000'";
- }
- else {
- if ($search['iranyar_min']!='') $tempSQL.= " AND iranyar>='".$search['iranyar_min']."000'";
- if ($search['iranyar_max']!='') $tempSQL.= " AND iranyar<='".$search['iranyar_max']."000'";
- }
-
- if ($search['meret_netto_min']!='') $tempSQL.= " AND meret_brutto>='".$search['meret_netto_min']."'";
- if ($search['meret_netto_max']!='') $tempSQL.= " AND meret_brutto<='".$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']!='') $tempSQL.= " AND szoba>='".$search['szoba_min']."'";
- //if ($search['szoba_max']!='') $tempSQL.= " 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['ovezet']!='') {
- $list = explode(",",$search['ovezet']);
- $ovezetek = "";
- foreach ($list as $ovezet) {
- $ovezetek.= "'".$ovezet."',";
- }
- $ovezetek = rtrim($ovezetek,',');
- $tempSQL.= " AND ovezeti_besorolas IN (".$ovezetek.")";
- }
- 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'";
- $title = "Találatok";
- }
- else {
- $title = "Ingatlanok";
- }
- $tempSQL.= " ORDER BY ".$_SESSION['storedOrderField']." ".$_SESSION['storedOrderDirection']."";
- $tempSQL = str_replace("' OR megye='budapest')","' AND megye='budapest'",$tempSQL);
- $querySQL = $tempSQL;
- $_SESSION['storedQuery'] = $querySQL;
-
- $testPager = $_SESSION['storedPager']+8;
- $queryPostfix = $tempSQL;
- //die($queryPostfix." LIMIT ".$testPager.",8;");
- $result = $this->query($queryPostfix." LIMIT ".$testPager.",8;");
-
- if ($search['szoba_min']!='' || $search['szoba_max']!='') {
- foreach ($result as $row) {
- $szoba = $row->szoba_fel+$row->szoba_egesz;
- if ($szoba>=$search['szoba_min'] && $szoba<=$search['szoba_max']) {
- $return[] = $row;
- }
- }
- $result = $return;
- }
- if ($_SESSION['statusz_switch']=='arcsokkent') {
- $return = null;
- foreach ($result as $row) {
- if ($this->isArcsokkent($row->regszam)) {
- $return[] = $row;
- }
- }
- $result = $return;
- }
- if (sizeof($result)>0) {
- return true;
- }
- else {
- return false;
- }
- }
- public function lazy_jumper() {
- $_SESSION['storedPager'] = $_SESSION['storedPager']+8;
- return true;
- }
- public function get_ertekesites_tipusok() {
- $result = $this->query("SELECT ertekesites FROM hiper_ingatlan WHERE ertekesites<>'' AND (rockhomera_mehet='1' OR rockhomera_mehet='0') AND statusz='aktualis' 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) {
- if ($row->tipus=='tarsashazi') {
- $row->jelleg = 'Lakóingatlan - '.$row->tipus;
- $result[] = $row;
- }
- }
- foreach ($resultx as $row) {
- if ($row->tipus!='tarsashazi') {
- $row->jelleg = 'Lakóingatlan - '.$row->tipus;
- $result[] = $row;
- }
- }
- foreach ($resulty as $row) {
- $result[] = $row;
- }
- return $result;
- }
- public function get_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 get_altipusok($tipus='') {
- if ($tipus!='') {
- $result = $this->query("SELECT altipus FROM hiper_ingatlan WHERE altipus<>'' AND tipus='".$tipus."' AND statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0') GROUP BY altipus ORDER BY altipus ASC;");
- }
- else {
- $result = $this->query("SELECT altipus FROM hiper_ingatlan WHERE altipus<>'' AND statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0') GROUP BY altipus ORDER BY altipus ASC;");
- }
- return $result;
- }
- public function get_jog() {
- $result = $this->query("SELECT jogi_statusz FROM hiper_ingatlan WHERE jogi_statusz<>'' AND statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0') GROUP BY jogi_statusz ORDER BY jogi_statusz ASC;");
- return $result;
- }
- public function get_kilatas() {
- $result = $this->query("SELECT kilatas FROM hiper_ingatlan WHERE kilatas<>'' AND statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0') GROUP BY kilatas ORDER BY kilatas ASC;");
- return $result;
- }
- public function get_futes() {
- $result = $this->query("SELECT futes FROM hiper_ingatlan WHERE futes<>'' AND statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0') GROUP BY futes ORDER BY futes ASC;");
- return $result;
- }
- public function get_ovezet() {
- $result = $this->query("SELECT ovezeti_besorolas AS ovezet FROM hiper_ingatlan WHERE ovezeti_besorolas<>'' AND statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0') GROUP BY ovezeti_besorolas ORDER BY ovezeti_besorolas ASC;");
- return $result;
- }
- public function getSearchObject($id) {
- $id = $this->escapeString($id);
- $result = $this->query("SELECT * FROM saved_search WHERE sch_id='".$id."';");
- return unserialize($result[0]->sch_query);
- }
- public function getSearchString() {
- if ($_SESSION['search']['ertekesites']=='elado') {
- $string = 'Eladó';
- }
- elseif ($_SESSION['search']['ertekesites']=='kiado') {
- $string = 'Kiadó';
- }
- else {
- $string = '';
- }
- if ($_SESSION['search']['tipus']=='tarsashazi') {
- $string.= ' lakás';
- }
- elseif ($_SESSION['search']['tipus']=='csaladihaz') {
- $string.= ' családi ház';
- }
- elseif ($_SESSION['search']['tipus']=='epuletresz') {
- $string.= ' épületrész';
- }
- elseif ($_SESSION['search']['tipus']=='hazresz') {
- $string.= ' házrész';
- }
- elseif ($_SESSION['search']['tipus']=='ikerhaz') {
- $string.= ' ikerház';
- }
- elseif ($_SESSION['search']['tipus']=='onalloepulet') {
- $string.= ' önálló épület';
- }
- elseif ($_SESSION['search']['tipus']=='teljesepulet') {
- $string.= ' teljes épület';
- }
- elseif ($_SESSION['search']['tipus']=='beruhazasi') {
- $string.= ' beruházás';
- }
- elseif ($_SESSION['search']['tipus']=='garazs') {
- $string.= ' garázs';
- }
- elseif ($_SESSION['search']['jelleg']=='nyaralo') {
- $string.= ' nyaraló';
- }
- elseif ($_SESSION['search']['tipus']=='kereskedelmi') {
- $string.= ' kereskedelmi';
- }
- elseif ($_SESSION['search']['tipus']=='mezogazdasagi') {
- $string.= ' mezőgazdasági';
- }
- elseif ($_SESSION['search']['tipus']=='tarolo') {
- $string.= ' tároló';
- }
- elseif ($_SESSION['search']['tipus']=='telek') {
- $string.= ' telek';
- }
- $string.= ', ';
- $actives = explode(",",$_SESSION['search']['city']);
- foreach ($actives as $item) {
- if (stristr($item,"Budapest") && $item!='Budapest') {
- $string.= $item.'. kerület, ';
- }
- else {
- $string.= $item.', ';
- }
- }
- $string = trim($string,", ");
- return $string;
- }
- }
|