| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354 |
- <?php
- class map_model extends Model {
- public function get_map_results($lat_min,$lat_max,$lon_min,$lon_max,$search) {
- //die(print_r($search));
- $lat_min = $this->escapeString($lat_min);
- $lon_min = $this->escapeString($lon_min);
- $lat_max = $this->escapeString($lat_max);
- $lon_max = $this->escapeString($lon_max);
- $_SESSION['lat_min'] = $lat_min;
- $_SESSION['lat_max'] = $lat_max;
- $_SESSION['lon_min'] = $lon_min;
- $_SESSION['lon_max'] = $lon_max;
- if ($_SESSION['storedOrderField']=='') $_SESSION['storedOrderField'] = 'letrehozva';
- if ($_SESSION['storedOrderDirection']=='') $_SESSION['storedOrderDirection'] = 'DESC';
- $queryPostfix = $this->getInactiveOffices()." ORDER BY ".$_SESSION['storedOrderField']." ".$_SESSION['storedOrderDirection'];
- if ($_SESSION['lat_min']!='' && $_SESSION['lat_max']!='' && $_SESSION['lon_min']!='' && $_SESSION['lon_max']!='') {
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- googlelat>='".$_SESSION['lat_min']."' AND
- googlelat<='".$_SESSION['lat_max']."' AND
- googlelon>='".$_SESSION['lon_min']."' AND
- googlelon<='".$_SESSION['lon_max']."' AND
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- }
- else {
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- }
- 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']!='') $tempSQL.= " AND ertekesites='".$search['ertekesites']."'";
- //if ($search['jelleg']!='') $tempSQL.= " AND jelleg='".$search['jelleg']."'";
- if ($_SESSION['wtf']!='') $tempSQL.= " AND jelleg='".$_SESSION['wtf']."'";
- if ($search['tipus']!='') $tempSQL.= " AND tipus='".$search['tipus']."'";
- 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'";
- //die($tempSQL." ".$queryPostfix.$this->lazy_loader());
- $result = $this->query($tempSQL." ".$queryPostfix.$this->lazy_loader());
- $all = $this->query($tempSQL." ".$queryPostfix);
- 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 ($all as $row) {
- if ($this->isArcsokkent($row->regszam)) {
- $return[] = $row;
- }
- }
- $result = $return;
- }
- return $result;
- }
- 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 get_map_results_circle($search) {
- if ($_SESSION['storedOrderField']=='') $_SESSION['storedOrderField'] = 'letrehozva';
- if ($_SESSION['storedOrderDirection']=='') $_SESSION['storedOrderDirection'] = 'DESC';
- $queryPostfix = $this->getInactiveOffices()." ORDER BY ".$_SESSION['storedOrderField']." ".$_SESSION['storedOrderDirection'];
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- if ($search['ertekesites']!='') $tempSQL.= " AND ertekesites='".$search['ertekesites']."'";
- //if ($search['jelleg']!='') $tempSQL.= " AND jelleg='".$search['jelleg']."'";
- if ($_SESSION['wtf']!='') $tempSQL.= " AND jelleg='".$_SESSION['wtf']."'";
- if ($search['tipus']!='') $tempSQL.= " AND tipus='".$search['tipus']."'";
- 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 ($_SESSION['statusz_switch']=='uj') $tempSQL.= " AND jogi_statusz='uj'";
- if ($_SESSION['statusz_switch']=='legujabb') $tempSQL.= " AND letrehozva >= DATE(NOW()) - INTERVAL 14 DAY";
- 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'";
- $result = $this->query($tempSQL." ".$queryPostfix);
- 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;
- }
- return $result;
- }
- public function get_map_results_all($lat_min,$lat_max,$lon_min,$lon_max,$search) {
- $lat_min = $this->escapeString($lat_min);
- $lon_min = $this->escapeString($lon_min);
- $lat_max = $this->escapeString($lat_max);
- $lon_max = $this->escapeString($lon_max);
- $_SESSION['lat_min'] = $lat_min;
- $_SESSION['lat_max'] = $lat_max;
- $_SESSION['lon_min'] = $lon_min;
- $_SESSION['lon_max'] = $lon_max;
- if ($_SESSION['storedOrderField']=='') $_SESSION['storedOrderField'] = 'letrehozva';
- if ($_SESSION['storedOrderDirection']=='') $_SESSION['storedOrderDirection'] = 'DESC';
- $queryPostfix = $this->getInactiveOffices()." ORDER BY ".$_SESSION['storedOrderField']." ".$_SESSION['storedOrderDirection'];
- if ($_SESSION['lat_min']!='' && $_SESSION['lat_max']!='' && $_SESSION['lon_min']!='' && $_SESSION['lon_max']!='') {
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- googlelat>='".$_SESSION['lat_min']."' AND
- googlelat<='".$_SESSION['lat_max']."' AND
- googlelon>='".$_SESSION['lon_min']."' AND
- googlelon<='".$_SESSION['lon_max']."' AND
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- }
- else {
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- }
- if ($search['ertekesites']!='') $tempSQL.= " AND ertekesites='".$search['ertekesites']."'";
- //if ($search['jelleg']!='') $tempSQL.= " AND jelleg='".$search['jelleg']."'";
- if ($_SESSION['wtf']!='') $tempSQL.= " AND jelleg='".$_SESSION['wtf']."'";
- if ($search['tipus']!='') $tempSQL.= " AND tipus='".$search['tipus']."'";
- 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'";
- $result = $this->query($tempSQL." ".$queryPostfix);
- 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;
- }
- return $result;
- }
- public function lazy_loader() {
- if ($_SESSION['storedPager']=='') $_SESSION['storedPager'] = '0';
- return " LIMIT ".$_SESSION['storedPager'].",5;";
- }
- public function lazy_has_more($search) {
- if ($_SESSION['lat_min']!='' && $_SESSION['lat_max']!='' && $_SESSION['lon_min']!='' && $_SESSION['lon_max']!='') {
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- googlelat>='".$_SESSION['lat_min']."' AND
- googlelat<='".$_SESSION['lat_max']."' AND
- googlelon>='".$_SESSION['lon_min']."' AND
- googlelon<='".$_SESSION['lon_max']."' AND
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- }
- else {
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- }
- if ($search['ertekesites']!='') $tempSQL.= " AND ertekesites='".$search['ertekesites']."'";
- //if ($search['jelleg']!='') $tempSQL.= " AND jelleg='".$search['jelleg']."'";
- if ($_SESSION['wtf']!='') $tempSQL.= " AND jelleg='".$_SESSION['wtf']."'";
- if ($search['tipus']!='') $tempSQL.= " AND tipus='".$search['tipus']."'";
- 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'";
- if ($_SESSION['storedPager']=='') $_SESSION['storedPager'] = '0';
- $testPager = $_SESSION['storedPager']+5;
- $queryPostfix = $tempSQL.$this->getInactiveOffices()." ORDER BY ".$_SESSION['storedOrderField']." ".$_SESSION['storedOrderDirection'];
- $result = $this->query($queryPostfix." LIMIT ".$testPager.",5;");
- $all = $this->query($queryPostfix.";");
- //die($queryPostfix." LIMIT ".$testPager.",5;");
- 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 ($all 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']+5;
- return true;
- }
- public function reload_stored_query($search,$nolimit=false) {
- $tempSQL = '';
- if ($_SESSION['lat_min']!='' && $_SESSION['lat_max']!='' && $_SESSION['lon_min']!='' && $_SESSION['lon_max']!='') {
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- googlelat>='".$_SESSION['lat_min']."' AND
- googlelat<='".$_SESSION['lat_max']."' AND
- googlelon>='".$_SESSION['lon_min']."' AND
- googlelon<='".$_SESSION['lon_max']."' AND
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- }
- else {
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- }
- if ($search['ertekesites']!='') $tempSQL.= " AND ertekesites='".$search['ertekesites']."'";
- //if ($search['jelleg']!='') $tempSQL.= " AND jelleg='".$search['jelleg']."'";
- if ($_SESSION['wtf']!='') $tempSQL.= " AND jelleg='".$_SESSION['wtf']."'";
- if ($search['tipus']!='') $tempSQL.= " AND tipus='".$search['tipus']."'";
- 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['city']!='') {
- $list = explode(",",$search['city']);
- $cities = "";
- foreach ($list as $city) {
- if ($city!='Budapest' && stristr($city," (")==false) {
- $cities.= "'".$city."',";
- }
- }
- $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 ";
- }
- }
- $tempSQL.= ")";
- $utcaSQL = rtrim($utcaSQL," OR ");
- if ($utcaSQL!='') {
- $utcaSQL.= ")";
- }
- $tempSQL.= $utcaSQL;
- }
- if ($search['jogi_statusz']!='') $tempSQL.= " AND jogi_statusz='".$search['jogi_statusz']."'";
-
- //if ($search['szoba_min']!='') $tempSQL.= " AND szoba_egesz>='".$search['szoba_min']."'";
- //if ($search['szoba_max']!='') $tempSQL.= " AND szoba_egesz<='".$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'";
- if ($_SESSION['storedOrderField']=='') $_SESSION['storedOrderField'] = 'letrehozva';
- if ($_SESSION['storedOrderDirection']=='') $_SESSION['storedOrderDirection'] = 'DESC';
- $queryPostfix = $this->getInactiveOffices()." ORDER BY ".$_SESSION['storedOrderField']." ".$_SESSION['storedOrderDirection'];
- //die($tempSQL." ".$queryPostfix);
- $tempSQL = str_replace("' OR megye='budapest')","' AND megye='budapest'",$tempSQL);
- if ($nolimit) {
- $result = $this->query($tempSQL." ".$queryPostfix);
- }
- else {
- $result = $this->query($tempSQL." ".$queryPostfix.$this->lazy_loader());
- }
- $all = $this->query($tempSQL." ".$queryPostfix);
- 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 ($all as $row) {
- if ($this->isArcsokkent($row->regszam)) {
- $return[] = $row;
- }
- }
- $result = $return;
- }
- return $result;
- }
- public function get_map_all_results($search) {
- $tempSQL = '';
- if ($_SESSION['lat_min']!='' && $_SESSION['lat_max']!='' && $_SESSION['lon_min']!='' && $_SESSION['lon_max']!='') {
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- googlelat>='".$_SESSION['lat_min']."' AND
- googlelat<='".$_SESSION['lat_max']."' AND
- googlelon>='".$_SESSION['lon_min']."' AND
- googlelon<='".$_SESSION['lon_max']."' AND
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- }
- else {
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- }
- if ($search['ertekesites']!='') $tempSQL.= " AND ertekesites='".$search['ertekesites']."'";
- //if ($search['jelleg']!='') $tempSQL.= " AND jelleg='".$search['jelleg']."'";
- if ($_SESSION['wtf']!='') $tempSQL.= " AND jelleg='".$_SESSION['wtf']."'";
- if ($search['tipus']!='') $tempSQL.= " AND tipus='".$search['tipus']."'";
- 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'";
- $_SESSION['storedPager'] = 0;
- if ($_SESSION['storedOrderField']=='') $_SESSION['storedOrderField'] = 'letrehozva';
- if ($_SESSION['storedOrderDirection']=='') $_SESSION['storedOrderDirection'] = 'DESC';
- //die($tempSQL);
- $queryPostfix = $tempSQL.$this->getInactiveOffices()." ORDER BY ".$_SESSION['storedOrderField']." ".$_SESSION['storedOrderDirection'];
- $result = $this->query($queryPostfix." ".$this->lazy_loader());
- $all = $this->query($queryPostfix.";");
- //die('debug: '.count($all));
- 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 ($all as $row) {
- if ($this->isArcsokkent($row->regszam)) {
- $return[] = $row;
- }
- }
- $result = $return;
- }
- return $result;
- }
- public function get_map_all_results_count($search) {
- $tempSQL = '';
- if ($_SESSION['lat_min']!='' && $_SESSION['lat_max']!='' && $_SESSION['lon_min']!='' && $_SESSION['lon_max']!='') {
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- googlelat>='".$_SESSION['lat_min']."' AND
- googlelat<='".$_SESSION['lat_max']."' AND
- googlelon>='".$_SESSION['lon_min']."' AND
- googlelon<='".$_SESSION['lon_max']."' AND
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- }
- else {
- $tempSQL = "SELECT *,
- CONCAT(iranyitoszam,'.',telepules,',<br> (',korzet,') ',utcanev) AS name,
- googlelat AS lat,
- googlelon AS lng FROM
- hiper_ingatlan WHERE
- statusz='aktualis' AND (rockhomera_mehet='1' OR rockhomera_mehet='0')";
- }
- if ($search['ertekesites']!='') $tempSQL.= " AND ertekesites='".$search['ertekesites']."'";
- //if ($search['jelleg']!='') $tempSQL.= " AND jelleg='".$search['jelleg']."'";
- if ($_SESSION['wtf']!='') $tempSQL.= " AND jelleg='".$_SESSION['wtf']."'";
- if ($search['tipus']!='') $tempSQL.= " AND tipus='".$search['tipus']."'";
- 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'";
- if ($_SESSION['storedOrderField']=='') $_SESSION['storedOrderField'] = 'letrehozva';
- if ($_SESSION['storedOrderDirection']=='') $_SESSION['storedOrderDirection'] = 'DESC';
- $queryPostfix = $this->getInactiveOffices()." ORDER BY ".$_SESSION['storedOrderField']." ".$_SESSION['storedOrderDirection'];
-
- $result = $this->query($tempSQL." ".$queryPostfix);
- 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;
- }
- 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) {
- 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 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 getSearchString() {
- if ($_SESSION['search']['ertekesites']=='elado') {
- $string = 'Eladó';
- }
- else {
- $string = 'Kiadó';
- }
- 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']['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")) {
- $string.= $item.'. kerület, ';
- }
- else {
- $string.= $item.', ';
- }
- }
- $string = trim($string,", ");
- return $string;
- }
- }
|