Ejemplo n.º 1
0
 public function onrequestpayAction()
 {
     global $mySession;
     $db = new Db();
     $spclOffer = implode(",", $mySession->spclOfferId);
     $extras = implode(",", $mySession->extrasId);
     //$dataForm['property_id'] = $mySession->pptyId;
     $dataForm['property_id'] = $mySession->bookingUser['property_id'];
     $dataForm['user_id'] = $mySession->bookingUser['user_id'];
     $dataForm['date_from'] = date('Y-m-d', strtotime($mySession->arrivalDate));
     $dataForm['date_to'] = date('Y-m-d', strtotime($mySession->arrivalDate . " + " . $mySession->noOfNights . " day"));
     $dataForm['offer_id'] = $spclOffer;
     $dataForm['min_rate'] = $mySession->minrate;
     //$dataForm['extras_id'] = $extras;
     $dataForm['children'] = $mySession->Children;
     $dataForm['adult'] = $mySession->Adults;
     $dataForm['infants'] = $mySession->Infants;
     $dataForm['total'] = $mySession->Infants;
     $dataForm['rental_amt'] = $mySession->totalCost;
     $dataForm['booking_date'] = date('Y-m-d');
     $dataForm['booking_type'] = '1';
     $dataForm['paid_status'] = '0';
     $db->save(BOOKING, $dataForm);
     $bookingId = $db->lastInsertId();
     //code to save data in calendar table
     /*$dataForm = array();
     		
     		$dataForm['property_id'] = $mySession->pptyId;
     		$dataForm['date_from'] = date('Y-m-d',strtotime($mySession->arrivalDate));
     		$dataForm['date_to'] = date('Y-m-d',strtotime($mySession->arrivalDate." + ".$mySession->noOfNights." day"));
     		$dataForm['cal_status'] = '0';
     		
     		save_calendar_stat($mySession->pptyId,$dataForm['date_from'],$dataForm['date_to']);*/
     //saving in the booking extra table
     foreach ($mySession->extrasId as $values) {
         $extrasArr = $db->runQuery("select ename,eprice*exchange_rate as eprice,etype,stay_type from  " . EXTRAS . " \n\t\t\t                            inner join " . PROPERTY . " on " . PROPERTY . ".id = " . EXTRAS . ".property_id\n\t\t\t\t\t\t\t\t\t\tinner join " . CURRENCY . " on " . CURRENCY . ".currency_code = " . PROPERTY . ".currency_code\n\t\t\t\t\t\t\t\t\t\twhere eid = '" . $values . "'\t ");
         $dataForm = array();
         $dataForm['booking_id'] = $bookingId;
         $dataForm['option_name'] = $extrasArr[0]['ename'];
         $dataForm['option_price'] = $extrasArr[0]['eprice'];
         $dataForm['option_status'] = $extrasArr[0]['etype'];
         $dataForm['stay_type'] = $extrasArr[0]['stay_type'];
         $db->save(BOOKING_EXTRA, $dataForm);
     }
     //		$extrasArr = $db->runQuery("select ename,eprice*exchange_rate as eprice,etype,stay_type from  ".EXTRAS."
     //									inner join ".PROPERTY." on ".PROPERTY.".id = ".EXTRAS.".property_id
     //   								    inner join ".CURRENCY." on ".CURRENCY.".currency_code = ".PROPERTY.".currency_code
     //									where property_id = '".$mySession->pptyId."' and etype = '1' ");
     $extrasArr = $db->runQuery("select ename,eprice*exchange_rate as eprice,etype,stay_type from  " . EXTRAS . " \n\t\t\t\t\t\t\t\t\tinner join " . PROPERTY . " on " . PROPERTY . ".id = " . EXTRAS . ".property_id\n   \t\t\t\t\t\t\t\t    inner join " . CURRENCY . " on " . CURRENCY . ".currency_code = " . PROPERTY . ".currency_code\n\t\t\t\t\t\t\t\t\twhere property_id = '" . $mySession->bookingUser['property_id'] . "' and etype = '1' ");
     //saving for the compulosry extras table
     foreach ($extrasArr as $values) {
         $dataForm = array();
         $dataForm['booking_id'] = $bookingId;
         $dataForm['option_name'] = $values['ename'];
         $dataForm['option_price'] = $values['eprice'];
         $dataForm['option_status'] = $values['etype'];
         $dataForm['stay_type'] = $values['stay_type'];
         $db->save(BOOKING_EXTRA, $dataForm);
     }
     $mySession->sucessMsg = "Thank you.. Property has been Booked Successfully";
     $pptyno = $db->runQuery("select propertycode from  " . PROPERTY . " where id = '" . $mySession->pptyId . "' ");
     $fullName = $mySession->LoggedUserName;
     $Url = '<a href="' . APPLICATION_URL . '">' . APPLICATION_URL . '</a>';
     $templateData = $db->runQuery("select * from " . EMAIL_TEMPLATES . " where template_id='7'");
     $messageText = $templateData[0]['email_body'];
     $subject = $templateData[0]['email_subject'];
     $messageText = str_replace("[NAME]", $fullName, $messageText);
     $messageText = str_replace("[SITENAME]", SITE_NAME, $messageText);
     $messageText = str_replace("[SITEURL]", APPLICATION_URL, $messageText);
     $messageText = str_replace("[PROPERTYNO]", $pptyno[0]['propertycode'], $messageText);
     SendEmail($dataForm['email_address'], $subject, $messageText);
     __bookSessionClear();
     $this->_redirect("contents/pages/slug/bookingsucess");
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 public function afterpayAction()
 {
     global $mySession;
     $db = new Db();
     $return = $this->getRequest()->getParam("Return");
     /* 	prd($_GET); */
     if ($return == '1') {
         $spclOffer = implode(",", $mySession->spclOfferId);
         //fetching the compulsory extras
         /* $extrasArr = $db->runQuery("select eid from ".EXTRAS." where property_id = '".$mySession->pptyId."' and etype = '1' ");
         
         
                           $extras = implode(",",$mySession->extrasId); */
         foreach ($extrasArr as $val) {
             $extras[] = $val['edi'];
         }
         $bookingId = $mySession->bookingId;
         $dataUpdate = array();
         $dataUpdate['payment_status'] = 'success';
         $db->modify(BOOKING, $dataUpdate, " booking_id  = " . $bookingId);
         // saving in Booking table
         //$dataForm['property_id'] = $mySession->pptyId;
         //prd($mySession->bookingUser);
         //================ code for saving data in booking table========================//
         //================ code to save data in calendar table==========================//
         //saving in payment list
         //pr($mySession->pptyId);
         //prd($mySession->bookingUser);
         $dataForm = array();
         $dataForm['user_id'] = $mySession->bookingUser['user_id'];
         $dataForm['property_id'] = $mySession->pptyId;
         //$dataForm['property_id'] = $mySession->bookingUser['property_id'];
         //$dataForm['trans_id'] = $_REQUEST['txn_id'];
         $dataForm['amount_paid'] = $mySession->finalAmt;
         $dataForm['booking_id'] = $bookingId;
         $dataForm['payment_date'] = date('Y-m-d');
         $db->save(PAYMENT, $dataForm);
         //saving in the booking extra table
         foreach ($mySession->extrasId as $values) {
             $extrasArr = $db->runQuery("select ename,eprice*exchange_rate as eprice,etype,stay_type from  " . EXTRAS . " \n\t\t\t                            inner join " . PROPERTY . " on " . PROPERTY . ".id = " . EXTRAS . ".property_id\n\t\t\t\t\t\t\t\t\t\tinner join " . CURRENCY . " on " . CURRENCY . ".currency_code = " . PROPERTY . ".currency_code\n\t\t\t\t\t\t\t\t\t\twhere eid = '" . $values . "'\t ");
             $dataForm = array();
             $dataForm['booking_id'] = $bookingId;
             $dataForm['option_name'] = $extrasArr[0]['ename'];
             $dataForm['option_price'] = $extrasArr[0]['eprice'];
             $dataForm['option_status'] = $extrasArr[0]['etype'];
             $dataForm['stay_type'] = $extrasArr[0]['stay_type'];
             $db->save(BOOKING_EXTRA, $dataForm);
         }
         $extrasArr = $db->runQuery("select ename,eprice*exchange_rate as eprice,etype,stay_type from  " . EXTRAS . " \n\t\t\t\t\t\t\t\t\tinner join " . PROPERTY . " on " . PROPERTY . ".id = " . EXTRAS . ".property_id\n   \t\t\t\t\t\t\t\t    inner join " . CURRENCY . " on " . CURRENCY . ".currency_code = " . PROPERTY . ".currency_code\n\t\t\t\t\t\t\t\t\twhere property_id = '" . $mySession->pptyId . "' and etype = '1' ");
         //saving for the compulosry extras table
         foreach ($extrasArr as $values) {
             $dataForm = array();
             $dataForm['booking_id'] = $bookingId;
             $dataForm['option_name'] = $values['ename'];
             $dataForm['option_price'] = $values['eprice'];
             $dataForm['option_status'] = $values['etype'];
             $dataForm['stay_type'] = $values['stay_type'];
             $db->save(BOOKING_EXTRA, $dataForm);
         }
         $mySession->sucessMsg = "Thank you.. you have sucessfully booked the property.";
         //$pptyno = $db->runQuery("select propertycode from  ".PROPERTY." where id = '".$mySession->pptyId."' ");
         $pptyno = $db->runQuery("select propertycode from  " . PROPERTY . " where id = '" . $mySession->bookingUser['property_id'] . "' ");
         $fullName = $mySession->LoggedUserName;
         $Url = '<a href="' . APPLICATION_URL . '">' . APPLICATION_URL . '</a>';
         $templateData = $db->runQuery("select * from " . EMAIL_TEMPLATES . " where template_id='7'");
         $messageText = $templateData[0]['email_body'];
         $subject = $templateData[0]['email_subject'];
         $messageText = str_replace("[NAME]", $fullName, $messageText);
         $messageText = str_replace("[SITENAME]", SITE_NAME, $messageText);
         $messageText = str_replace("[SITEURL]", APPLICATION_URL, $messageText);
         $messageText = str_replace("[PROPERTYNO]", $pptyno[0]['propertycode'], $messageText);
         SendEmail($dataForm['email_address'], $subject, $messageText);
         //===== code for adding popular properties
         //two cases
         //1. when booked property is already in the list of slides property
         //2. when booked property is not in the list of slides property
         $identifyArr = $db->runQuery("select * from " . SLIDES_PROPERTY . " where lppty_property_id = '" . $mySession->pptyId . "' and lppty_type = '1' ");
         if ($identifyArr != "" and count($identifyArr) > 0) {
             $db->delete(SLIDES_PROPERTY, 'lppty_id= "' . $identifyArr[0]['lppty_id'] . '" ');
             $updateData = array();
             $updateData['lppty_order'] = new Zend_Db_Expr('lppty_order-1');
             $updateData['lppty_status'] = '1';
             $db->modify(SLIDES_PROPERTY, $updateData, "lppty_type='1' and lppty_order > '" . $identifyArr[0]['lppty_order'] . "' ");
         } else {
             $updateData = array();
             $updateData['lppty_order'] = new Zend_Db_Expr('lppty_order+1');
             $updateData['lppty_status'] = '1';
             $db->modify(SLIDES_PROPERTY, $updateData, "lppty_type='1'");
             $saveData = array();
             $saveData['lppty_property_id'] = $mySession->pptyId;
             $saveData['lppty_type'] = '1';
             $saveData['lppty_order'] = '1';
             $db->save(SLIDES_PROPERTY, $saveData);
         }
         //---------------------------------------
         $this->_redirect("contents/pages/slug/bookingsucess");
     } else {
         $mySession->errorMsg = "We are sorry for the misconviniece <br />\n\t\t\t\t\t\t\t\t\t Error while booking property";
         __bookSessionClear();
         $this->_redirect(APPLICATION_URL);
     }
 }