public function pagesAction() { global $mySession; $db = new Db(); $slug = $this->getRequest()->getParam("slug"); $userArr = $db->runQuery("select * from " . USERS . " where user_id = '" . $mySession->LoggedUserId . "' "); $sql = "select * from " . PAGES1 . " where synonyms = '{$slug}'"; $staticArr = $db->runQuery($sql); $strContent = str_replace("[SITEURL]", APPLICATION_URL, $staticArr[0]['page_content']); $strContent = str_replace("[FULLNAME]", $userArr[0]['email_address'], $strContent); if (!isLogged()) { $strContent = str_replace("[LOGINMSG]", "<a href='" . APPLICATION_URL . "/signin'>click here</a> to Login", $strContent); } else { $strContent = str_replace("[LOGINMSG]", "", $strContent); } $this->view->pageContent = $strContent; $this->view->pageTitle = $staticArr[0]['page_title']; $this->view->page_id = $staticArr[0]['page_id']; if ($staticArr[0]['page_id'] == '12' || $staticArr[0]['page_id'] == '63') { $myform = new Form_Contact(); $this->view->myform = $myform; } if ($staticArr[0]['page_id'] == '80') { $myform = new Form_Ocontact(); $this->view->myform = $myform; } $varsuccess = 0; if ($this->getRequest()->isPost()) { $request = $this->getRequest(); $dataForm = $myform->getValues(); if ($myform->isValid($request->getPost())) { $dataForm = $myform->getValues(); //prd($dataForm); if ($dataForm['captcha'] == $_SESSION['captcha']) { $myObj = new Users(); if ($staticArr[0]['page_id'] == '80') { $Result = $myObj->ownercontactus($dataForm); } else { $Result = $myObj->contactus($dataForm); } $mySession->sucessMsg = "Thank you, You will soon be contacted"; $varsuccess = 1; } else { $mySession->errorMsg = "Human Verification code is wrong"; } } } $this->view->myform = $myform; $this->view->varsuccess = $varsuccess; }
public function previewAction() { global $mySession; $db = new Db(); $varsuccess = '0'; $tab = $this->getRequest()->getParam("property"); $ppty_id = $this->getRequest()->getParam("ppty"); $this->view->ppty_id = $ppty_id; $propertyArr = $db->runQuery("select * from " . PROPERTY . " \n\t\t\t\t\t\t\t\t\t inner join " . COUNTRIES . " on " . COUNTRIES . ".country_id = " . PROPERTY . ".country_id\n\t\t\t\t\t\t\t\t\t inner join " . PROPERTY_TYPE . " on " . PROPERTY . ".property_type = " . PROPERTY_TYPE . ".ptyle_id\n\t\t\t\t\t\t\t\t\t left join " . STATE . " on " . STATE . ".state_id = " . PROPERTY . ".state_id\n \t\t\t\t\t\t\t left join " . CITIES . " on " . CITIES . ".city_id = " . PROPERTY . ".city_id\n\t\t\t\t\t\t\t\t\t left join " . SUB_AREA . " on " . SUB_AREA . ".sub_area_id = " . PROPERTY . ".sub_area_id\n\t\t\t\t\t\t\t\t\t left join " . LOCAL_AREA . " on " . LOCAL_AREA . ".local_area_id = " . PROPERTY . ".local_area_id\n\t\t\t\t\t\t\t\t\t left join " . GALLERY . " on " . GALLERY . ".property_id = " . PROPERTY . ".id \n\t\t\t\t\t\t\t\t\t where " . PROPERTY . ".id = '" . $ppty_id . "' "); //========== Fetching Meta Information ===========================// $metaArr = $db->runQuery("select meta_title, meta_keyword, meta_description from " . META_INFO . " where meta_id = 4"); $Title = str_replace('[PAGE_NAME]', $staticArr[0]['page_title'], $metaArr[0]['meta_title']); $Description = $metaArr[0]['meta_title']; $Description = str_replace('[BREADCRUMB]', $Breadcrumb, $Description); $Description = str_replace('[BED]', $propertyArr[0]['bedrooms'] > 1 ? $propertyArr[0]['bedrooms'] . ' beds' : $propertyArr[0]['bedrooms'] . ' bed', $Description); $Description = str_replace('[PROPERTY_TYPE]', $propertyArr[0]['ptyle_name'], $Description); $Description = str_replace('[PROPERTY_NO]', $propertyArr[0]['propertycode'], $Description); $this->view->headTitle($Title)->offsetUnset(0); $this->view->headMeta('description', $Description); //code to check tab switch ($tab) { case '': case 'overview': $this->view->tab = '1'; $this->view->property = "overview"; $this->view->ppty_tab1 = 'class="active"'; //AMENITIES $amenityData = $db->runQuery("select * from " . AMENITY . " as a inner join " . AMENITY_ANS . " as aa on a.amenity_id = aa.amenity_id where aa.property_id = '" . $ppty_id . "' and aa.amenity_value ='1' and a.amenity_status = '1' "); $this->view->amenityData = $amenityData; break; case 'specification': $this->view->tab = '2'; $this->view->property = "specification"; $this->view->ppty_tab2 = 'class="active"'; $specArr = $db->runQuery("select * from " . SPECIFICATION . " as s inner join " . PROPERTY_SPEC_CAT . " as psc on s.cat_id = psc.cat_id \n\t\t\t\t\t\t\t\t\t where psc.cat_status = '1' \n\t\t\t\t\t\t\t\t\t and s.status = '1' order by psc.cat_id, s.spec_order asc\n\t\t\t\t\t\t\t\t\t "); $category_temp = ""; $i = 0; $t = 0; $finalArr[0]['category'][0] = ""; $cat_counter = 0; $bathroom_counter = 0; $xcounter = 0; $max = 0; foreach ($specArr as $key => $value) { if ($finalArr[$cat_counter]['category'] != $value['cat_name']) { if ($i > 0) { $cat_counter++; } $finalArr[$cat_counter]['category'] = $value['cat_name']; $t = 0; } $selectOptionArr = $db->runQuery("select * from " . SPEC_CHILD . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t inner join " . SPEC_ANS . " on " . SPEC_ANS . ".answer = " . SPEC_CHILD . ".cid\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t where " . SPEC_ANS . ".spec_id = '" . $value['spec_id'] . "' and " . SPEC_ANS . ".property_id = '" . $ppty_id . "' "); if ($value['spec_id'] == '22' || $value['spec_id'] == '23' || $value['spec_id'] == '24') { foreach ($selectOptionArr as $key1 => $value1) { $array1 = explode('|||', $value1['answer']); $max = count($array1) > $max ? count($array1) : $max; $x = 0; foreach ($array1 as $keybath => $bath) { /* echo "select ".SPEC_CHILD.".option from ".SPEC_CHILD." where cid = '".$bath."' "; exit; */ $bathArr = $db->runQuery("select " . SPEC_CHILD . ".option from " . SPEC_CHILD . " where cid = '" . $bath . "' "); //pr($bathArr); /* if(count($bathArr) == 0) $bathroom[$keybath][] = ""; */ foreach ($bathArr as $ckey => $calue) { if ($value['spec_id'] == '24') { //echo $xcounter; $bathroom[$xcounter][] = $calue['option']; } else { $bathroom[$keybath][] = $calue['option']; } } $x++; } foreach ($array1 as $keybath => $bath) { $finalArr[$cat_counter]['ques'][$keybath] = $value['spec_display'] . " " . ($keybath + 1); } $finalArr[$cat_counter]['answer'] = $bathroom; $j++; if ($value['spec_id'] == '24') { $xcounter++; } } $bathroom_counter++; } else { if ($max != 0) { $t = $t + $max; } $max = 0; if ($value['spec_type'] == '2' || $value['spec_type'] == '3') { $selectOptionArr = $db->runQuery("select * from " . SPEC_ANS . " where " . SPEC_ANS . ".spec_id = '" . $value['spec_id'] . "' and " . SPEC_ANS . ".property_id = '" . $ppty_id . "' "); /* prd($selectOptionArr); */ if ($selectOptionArr[0]['answer'] != "") { $j = 0; $finalArr[$cat_counter]['ques'][$t] = $value['spec_display']; $finalArr[$cat_counter]['ticklist'][$t] = '0'; $finalArr[$cat_counter]['answer'][$t][0] = $selectOptionArr[0]['answer']; $selectOptionArr = array(); } else { $t--; } } elseif ($value['preview_display'] == '1' || count($selectOptionArr) > 0) { $finalArr[$cat_counter]['ques'][$t] = $value['spec_display']; if ($value['spec_type'] == '4') { $finalArr[$cat_counter]['ticklist'][$t] = '1'; } else { $finalArr[$cat_counter]['ticklist'][$t] = '0'; } } else { $t--; } $j = 0; if (count($selectOptionArr) > 0) { foreach ($selectOptionArr as $key1 => $value1) { $finalArr[$cat_counter]['answer'][$t][$j] = $value1['option']; $j++; } } $t++; } $i++; } /* prd($finalArr); */ /* $specArr = $db->runQuery("select * from ".SPECIFICATION." inner join ".SPEC_CHILD." on ".SPEC_CHILD.".spec_id = ".SPECIFICATION.".spec_id inner join ".SPEC_ANS." on ".SPEC_ANS.".answer = ".SPEC_CHILD.".cid where ".SPEC_ANS.".property_id = ".$ppty_id." "); */ $this->view->specArr = $finalArr; break; case 'location': $this->view->tab = '3'; $this->view->property = "location"; $this->view->ppty_tab3 = 'class="active"'; break; case 'availability': $this->view->tab = '4'; $this->view->property = "availability"; $this->view->cal_default = $propertyArr[0]['cal_default']; $this->view->ppty_tab4 = 'class="active"'; $calArr = $db->runQuery("select * from " . CAL_AVAIL . " where property_id = '" . $ppty_id . "' "); $this->view->calArr = $calArr; $next = $this->getRequest()->getParam("cal"); if ($next != "") { $this->view->nexts = $next; } else { $this->view->nexts = 0; } break; case 'rental': $this->view->tab = '5'; $this->view->property = "rental"; $this->view->ppty_tab5 = 'class="active"'; $option_extra = $db->runQuery("select ename, (select exchange_rate from " . CURRENCY . " where " . CURRENCY . ".currency_code = (select currency_code from " . PROPERTY . " where id = '" . $ppty_id . "' ))*eprice as eprice,etype,stay_type from " . EXTRAS . " where property_id = '" . $ppty_id . "' "); $this->view->option_extra = $option_extra; $calArr = $db->runQuery("select (select exchange_rate from " . CURRENCY . " where " . CURRENCY . ".currency_code = (select currency_code from " . PROPERTY . " where id = '" . $ppty_id . "') )*prate as prate,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t nights,date_to,date_from from " . CAL_RATE . " \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t where property_id = " . $ppty_id . " order by date_from asc "); $this->view->calData = $calArr; $spclArr = $db->runQuery("select *, " . SPCL_OFFER_TYPES . ".min_nights as MIN_NIGHTS from " . SPCL_OFFERS . " \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t inner join " . SPCL_OFFER_TYPES . " on " . SPCL_OFFERS . ".offer_id = " . SPCL_OFFER_TYPES . ".id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t where " . SPCL_OFFERS . ".property_id = '" . $ppty_id . "' \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t and " . SPCL_OFFERS . ".activate = '1' and " . SPCL_OFFERS . ".book_by >= curdate() "); $this->view->spclData = $spclArr; break; case 'gallery': $this->view->tab = '6'; $this->view->property = "gallery"; $this->view->ppty_tab6 = 'class="active"'; $galleryArr = $db->runQuery("select * from " . GALLERY . " where property_id = " . $ppty_id); $this->view->galleryArr = $galleryArr; break; case 'reviews': $this->view->tab = '7'; $this->view->property = "review"; $this->view->ppty_tab7 = 'class="active"'; $reviewArr = $db->runQuery("select * from " . OWNER_REVIEW . " as r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinner join " . PROPERTY . " as p on p.id = r.property_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinner join " . USERS . " as u on u.user_id = p.user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere r.property_id = '" . $ppty_id . "' and r.review_status = '1' order by r.review_id desc "); //prd($reviewArr); $i = 0; foreach ($reviewArr as $val) { if ($val['parent_id'] == 0) { $childArr = $db->runQuery("select * from " . OWNER_REVIEW . " where parent_id = '" . $val['review_id'] . "' "); $reviewData[$i]['review_id'] = $val['review_id']; $reviewData[$i]['uType'] = $val['uType']; $reviewData[$i]['guest_name'] = $val['guest_name']; $reviewData[$i]['owner_image'] = $val['guest_image']; $reviewData[$i]['headline'] = $val['headline']; $reviewData[$i]['review'] = $val['review']; $reviewData[$i]['comment'] = $val['comment']; $reviewData[$i]['location'] = $val['location']; $reviewData[$i]['image'] = $val['image']; $reviewData[$i]['review_date'] = $val['review_date']; $reviewData[$i]['check_in'] = $val['check_in']; $reviewData[$i]['rating'] = $val['rating']; $k = 0; foreach ($childArr as $val1) { $reviewData[$i]['child'][$k]['guest_name'] = $val1['guest_name']; $reviewData[$i]['child'][$k]['owner_image'] = $val1['guest_image']; $reviewData[$i]['child'][$k]['comment'] = $val1['comment']; $reviewData[$i]['child'][$k]['review_date'] = $val1['review_date']; $k++; } } $i++; } //prd($reviewData); //code for finding that the owner has the same property $this->view->reviewArr = $reviewData; /** review form dissplay code ends * */ break; case 'question': $this->view->tab = '8'; $this->view->property = "question"; $this->view->ppty_tab8 = 'class="active"'; //contact us $myform = new Form_Ocontact($ppty_id); $this->view->myform = $myform; break; } //rate query /* echo "select case when date_from <= CURDATE() and date_to >= CURDATE() then prate as RATE,nights from ".CAL_RATE." when date_from <= CURDATE() then min(prate) as RATE,nights from ".CAL_RATE." else prate as RATE, nights from ".CAL_RATE." end where property_id = '".$ppty_id."' "; exit; */ /* $rateArr = $db->runQuery(" SELECT * FROM ( select prate as RATE,nights,id from ".CAL_RATE." where property_id = '".$ppty_id."' and date_from <= CURDATE() and date_to >= CURDATE() union select min(prate) as RATE,nights,id from ".CAL_RATE." where property_id = '".$ppty_id."' ) AS a1 WHERE a1.RATE IS NOT NULL group by a1.id"); */ $rateArr = $db->runQuery("select round(prate*" . CURRENCY . ".exchange_rate) as RATE,nights,prate," . PROPERTY . ".id from " . CAL_RATE . " \n\t\t\t\t\t\t\t\t inner join " . PROPERTY . " on " . PROPERTY . ".id = " . CAL_RATE . ".property_id\n\t\t\t\t\t\t\t\t inner join " . CURRENCY . " on " . PROPERTY . ".currency_code = " . CURRENCY . ".currency_code\n\t\t where " . CAL_RATE . ".property_id = '" . $ppty_id . "' and prate = (select min(prate) from " . CAL_RATE . " where property_id = '" . $ppty_id . "' \n\t\t\t\t\t\t\t\t ) order by prate asc\n\t\t\t\t\t\t\t\t "); $tmp = $rateArr[0]['RATE']; /* $actcurrArr = $db->runQuery("select exchange_rate*".($tmp[0] != "" ? $tmp[0]:0)." as mul from ".CURRENCY." inner join ".PROPERTY." on ".CURRENCY.".currency_code = ".PROPERTY.".currency_code where ".PROPERTY.".id = '".$ppty_id."' "); */ /* $tmp[0] = $actcurrArr[0]['mul']; */ $this->view->prate = $tmp != "" ? $tmp * $rateArr[0]['nights'] : "Unknown"; $this->view->nights = $rateArr[0]['nights'] != "" ? $rateArr[0]['nights'] : ""; //cal Query /* gadd $calAvailArr = $db->runQuery("select * from ".CAL_AVAIL." inner join ".PROPERTY." on ".CAL_AVAIL.".property_id = ".PROPERTY.".id where ".CAL_AVAIL.".property_id = '".$ppty_id."' "); */ $this->view->propertyData = $propertyArr; // property images $galleryData = $db->runQuery("select * from " . GALLERY . " where property_id = '" . $ppty_id . "' "); $this->view->galleryData = $galleryData; if ($this->getRequest()->isPost() && !isset($_REQUEST['review'])) { $myform = new Form_Ocontact($ppty_id); $request = $this->getRequest(); if ($myform->isValid($request->getPost())) { $dataForm = $myform->getValues(); $myObj = new Users(); $Result = $myObj->ownercontactus($dataForm); $mySession->sucessMsg = "Thank you, You will soon be contacted"; $varsuccess = 1; } else { $mySession->errorMsg = "Enter Proper details first"; } } $this->view->varsuccess = $varsuccess; }
public function pagesAction() { global $mySession; $db = new Db(); $slug = $this->getRequest()->getParam("slug"); $userArr = $db->runQuery("select * from " . USERS . " where user_id = '" . $mySession->LoggedUserId . "' "); $sql = "select * from " . PAGES1 . " where synonyms = '{$slug}'"; $staticArr = $db->runQuery($sql); if (count($staticArr) == 0) { $this->render("error/error"); } //========== Fetching Meta Information ===========================// $metaArr = $db->runQuery("select meta_title, meta_keyword, meta_description from " . META_INFO . " where meta_id = 3"); $Title = str_replace('[PAGE_NAME]', $staticArr[0]['page_title'], $metaArr[0]['meta_title']); $Description = str_replace('[PAGE_NAME]', $staticArr[0]['page_description'], $metaArr[0]['meta_title']); $this->view->headTitle($Title)->offsetUnset(0); // $this->view->headMeta('description', $Description); $this->view->headMeta($staticArr[0]['meta_description'], 'description'); $this->view->headMeta($staticArr[0]['meta_keywords'], 'keywords'); $strContent = str_replace("[SITEURL]", APPLICATION_URL, $staticArr[0]['page_content']); $strContent = str_replace("[FULLNAME]", $userArr[0]['email_address'], $strContent); if (!isLogged()) { $strContent = str_replace("[LOGINMSG]", "<a href='" . APPLICATION_URL . "/signin'>click here</a> to Login", $strContent); } else { $strContent = str_replace("[LOGINMSG]", "", $strContent); } $this->view->pageContent = $strContent; $this->view->pageTitle = $staticArr[0]['page_title']; $this->view->page_id = $staticArr[0]['page_id']; if ($staticArr[0]['page_id'] == '12' || $staticArr[0]['page_id'] == '63') { $myform = new Form_Contact(); $this->view->myform = $myform; } if ($staticArr[0]['page_id'] == '80') { $myform = new Form_Ocontact(); $this->view->myform = $myform; } //location keywords for destination page if ($staticArr[0]['page_id'] == '25') { $this->view->countryArr = $countryArr = $db->runQuery("select country_name from " . PROPERTY . " \n inner join " . COUNTRIES . " on " . COUNTRIES . ".country_id = " . PROPERTY . ".country_id\n where status = '3'\n group by country_name\n "); $this->view->statesArr = $statesArr = $db->runQuery("select country_name, state_name from " . PROPERTY . "\n inner join " . COUNTRIES . " on " . COUNTRIES . ".country_id = " . PROPERTY . ".country_id\n inner join " . STATE . " on " . STATE . ".state_id = " . PROPERTY . ".state_id\n where status = '3'\n group by state_name\n "); $this->view->citiesArr = $citiesArr = $db->runQuery("select country_name, state_name, city_name from " . PROPERTY . " \n inner join " . COUNTRIES . " on " . COUNTRIES . ".country_id = " . PROPERTY . ".country_id\n inner join " . STATE . " on " . STATE . ".state_id = " . PROPERTY . ".state_id\n inner join " . CITIES . " on " . CITIES . ".city_id = " . PROPERTY . ".city_id\n where status = '3'\n group by city_name\n "); $this->view->subareasArr = $subareasArr = $db->runQuery("select country_name, state_name, city_name,sub_area_name from " . PROPERTY . " \n inner join " . COUNTRIES . " on " . COUNTRIES . ".country_id = " . PROPERTY . ".country_id\n inner join " . STATE . " on " . STATE . ".state_id = " . PROPERTY . ".state_id\n inner join " . CITIES . " on " . CITIES . ".city_id = " . PROPERTY . ".city_id\n inner join " . SUB_AREA . " on " . SUB_AREA . ".sub_area_id = " . PROPERTY . ".sub_area_id\n where status = '3'\n group by sub_area_name\n "); $this->view->localareasArr = $localareasArr = $db->runQuery("select country_name, state_name, city_name,sub_area_name, local_area_name from " . PROPERTY . " \n inner join " . COUNTRIES . " on " . COUNTRIES . ".country_id = " . PROPERTY . ".country_id\n inner join " . STATE . " on " . STATE . ".state_id = " . PROPERTY . ".state_id\n inner join " . CITIES . " on " . CITIES . ".city_id = " . PROPERTY . ".city_id\n inner join " . SUB_AREA . " on " . SUB_AREA . ".sub_area_id = " . PROPERTY . ".sub_area_id\n inner join " . LOCAL_AREA . " on " . LOCAL_AREA . ".local_area_id = " . PROPERTY . ".local_area_id\n where status = '3'\n group by local_area_name\n "); } $varsuccess = 0; # the response from reCAPTCHA $resp = null; # the error code from reCAPTCHA, if any $error = null; if ($this->getRequest()->isPost()) { $request = $this->getRequest(); $dataForm = $myform->getValues(); //prd($dataForm); if ($myform->isValid($request->getPost()) && !empty($_POST["recaptcha_response_field"])) { $dataForm = $myform->getValues(); $resp = recaptcha_check_answer(CAPTCHA_PRIVATE_KEY, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { $myObj = new Users(); if ($staticArr[0]['page_id'] == '80') { $Result = $myObj->ownercontactus($dataForm); } else { $Result = $myObj->contactus($dataForm); } $mySession->sucessMsg = "Thank you, You will soon be contacted"; $varsuccess = 1; } else { $mySession->errorMsg = $error = $resp->error; } } else { $dataForm = $myform->getValues(); $mySession->errorMsg = "Human Verification Error"; } } $this->view->error = $error; $this->view->myform = $myform; $this->view->varsuccess = $varsuccess; __bookSessionClear(); }