Пример #1
0
 public function addpropertyAction()
 {
     global $mySession;
     $db = new Db();
     $this->view->pageTitle = "Add a Property";
     $ppty_no = generate_property_no($mySession->LoggedUserId);
     $this->view->ppty_no = $ppty_no;
     //code for checking the status of each step
     if (isset($mySession->property_id)) {
         $statusArr = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->property_id . "' ");
         $this->view->status_2 = $status_step2 = $statusArr[0]['status_2'];
         $this->view->status_3 = $status_step3 = $statusArr[0]['status_3'];
         $this->view->status_4 = $status_step4 = $statusArr[0]['status_4'];
         $this->view->status_5 = $status_step5 = $statusArr[0]['status_5'];
         $this->view->status_6 = $status_step6 = $statusArr[0]['status_6'];
         $this->view->status_7 = $status_step7 = $statusArr[0]['status_7'];
         $this->view->status_8 = $status_step8 = $statusArr[0]['status_8'];
         $this->view->status_9 = $status_step9 = $statusArr[0]['status_9'];
         if ($status_step2 && $status_step3 && $status_step4 && $status_step5 && $status_step6 && $status_step7 && $status_step8 && $status_step9) {
             $status_data['status'] = '2';
             $condition = "id=" . $mySession->property_id;
             $db->modify(PROPERTY, $status_data, $condition);
         }
     } else {
         $this->view->status_2 = 0;
         $this->view->status_3 = 0;
         $this->view->status_4 = 0;
         $this->view->status_5 = 0;
         $this->view->status_6 = 0;
         $this->view->status_7 = 0;
         $this->view->status_8 = 0;
         $this->view->status_9 = 0;
     }
     if ($mySession->ppty_no != "") {
         $pId = $mySession->ppty_no;
     } else {
         $pId = "";
         $mySession->step = '0';
     }
     $this->view->pId = $pId;
     $stepId = $this->getRequest()->getParam("step");
     if ($stepId != "") {
         $mySession->step = $stepId - 1;
     }
     switch ($mySession->step) {
         case '0':
             $myform = new Form_Ownproperty($mySession->property_id);
             $this->view->step = '1';
             $step = '1';
             if (isset($mySession->property_id)) {
                 $ratingArr = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->property_id . "' ");
                 $this->view->rating = $ratingArr[0]['star_rating'];
             }
             break;
         case '1':
             $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  ");
             $this->view->specData = $specArr;
             $myform = new Form_Propertyspec($mySession->property_id);
             $this->view->stepId = $stepId;
             $this->view->step = '2';
             $step = '2';
             //bathroom no.
             $bathroomArr = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->property_id . "' ");
             $this->view->no_bedrooms = $bathroomArr[0]['bedrooms'];
             break;
         case '2':
             $amenityArr = $db->runQuery("select * from " . AMENITY_PAGE . " ");
             $this->view->amenityData = $amenityArr;
             $amenity = $db->runQuery("select * from " . AMENITY . " where amenity_status = '1' ");
             $this->view->amenityArr = $amenity;
             if ($mySession->property_id != '') {
                 $myform = new Form_Amenity($mySession->property_id);
             } else {
                 $myform = new Form_Amenity();
             }
             $this->view->step = '3';
             $step = '3';
             break;
         case '3':
             if ($stepId == '4') {
                 $myform = new Form_Location($mySession->property_id);
             } else {
                 $myform = new Form_Location();
             }
             $this->view->step = '4';
             $step = '4';
             break;
         case '4':
             $this->view->step = '5';
             $Arr = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->property_id . "' ");
             $this->view->floorPlan = $Arr[0]['floor_plan'];
             //$myform = new Form_Photo();
             $step = '5';
             //submit photo action
             //submit photo action ends
             break;
         case '5':
             $myform = new Form_Cal();
             $this->view->myform = $myform;
             $next = $this->getRequest()->getParam("cal");
             if ($next != "") {
                 $this->view->nexts = $next;
             } else {
                 $this->view->nexts = 0;
             }
             $calArr = $db->runQuery("select * from " . CAL_AVAIL . " where property_id = '" . $mySession->property_id . "' ");
             $this->view->calArr = $calArr;
             $this->view->step = '6';
             $step = '6';
             //passing default value of calendar to view
             $pptyArr = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->property_id . "' ");
             $this->view->cal_default = $pptyArr[0]['cal_default'];
             break;
         case '6':
             $this->view->step = '7';
             $step = '7';
             $offerArr = $db->runQuery("select * from " . SPCL_OFFER_TYPES . " as sot left join " . SPCL_OFFERS . " as so \n\t\t\t\t\t\t\t\t   on  sot.id = so.offer_id where so.property_id = '" . $mySession->property_id . "' order by so.spcl_offer_id asc\n\t\t\t\t\t\t\t\t   ");
             if (count($offerArr) == 0) {
                 $offerArr = $db->runQuery("select * from " . SPCL_OFFER_TYPES . "");
                 foreach ($offerArr as $values) {
                     $dataForm['offer_id'] = $values['id'];
                     //$dataForm['date_from'] = date('Y-m-d', strtotime($_REQUEST['Date_f']));
                     //$dataForm['date_to'] = date('Y-m-d', strtotime($_REQUEST['Date_t']));
                     //$dataForm['nights'] = $_REQUEST['Nights'];
                     //$dataForm['prate'] = $_REQUEST['Rate'];
                     $dataForm["property_id"] = $mySession->property_id;
                     $db->save(SPCL_OFFERS, $dataForm);
                 }
             }
             $this->view->offerArr = $offerArr;
             //echo $mySession->step; exit;
             //rental question
             $rentalQues = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->property_id . "' ");
             if ($rentalQues != "" && count($rentalQues) > 0) {
                 $this->view->rental_ques = $rentalQues[0]['rental_ques'];
             }
             //currency data
             $currData = $db->runQuery("select * from  " . CURRENCY . " order by currency_order asc ");
             $this->view->currencyData = $currData;
             //checking for currency
             if ($rentalQues[0]['currency_code'] != NULL) {
                 $this->view->currency_set = '1';
                 $this->view->currency_val = $rentalQues[0]['currency_code'];
             } else {
                 $this->view->currency_set = '0';
             }
             break;
         case '7':
             $myform = new Form_Oreview($mySession->property_id);
             //query for getting image
             $this->view->step = '8';
             //$uData = $db->runQuery("select * from ".OWNER_REVIEW." where property_id = '".$mySession->property_id."' ");
             /* if($uData[0]['owner_image'] == "")
                 $this->view->image = "no_owner_pic.jpg";
                 else
                 $this->view->image = $uData[0]['owner_image'];
                */
             if (!isset($mySession->reviewImage)) {
                 $mySession->reviewImage = "no_owner_pic.jpg";
             }
             $this->view->myform = $myform;
             $reviewArr = $db->runQuery("select * from " . OWNER_REVIEW . " as r\n\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\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\twhere r.property_id = '" . $mySession->property_id . "' and r.review_status = '1' order by r.review_id desc ");
             $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);
             $this->view->reviewArr = $reviewData;
             break;
         case '8':
             if (isset($mySession->property_id)) {
                 $myform = new Form_Arrival($mySession->property_id);
             } else {
                 $myform = new Form_Arrival();
             }
             $this->view->step = '9';
             $this->view->myform = $myform;
             $Arrival = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->property_id . "' ");
             $this->view->arrival = $Arrival[0]['arrival_instruction'];
             $this->view->arrival1 = $Arrival[0]['arrival_instruction1'];
             $this->view->arrival2 = $Arrival[0]['arrival_instruction2'];
             if ($this->getRequest()->isPost()) {
                 $mySession->step = '9';
             }
             break;
         case '9':
             $this->view->step = '10';
             $dataUpdate = array();
             $dataUpdate['status'] = '2';
             $condition = " id = " . $mySession->property_id;
             $db->modify(PROPERTY, $dataUpdate, $condition);
             break;
     }
     //switch case ends
     /* code used for step 2 */
     if ($this->getRequest()->isPost() && $_REQUEST['copy_ppty'] == "") {
         if ($_REQUEST['next'] != "") {
             $mySession->step = '2';
         }
     }
     if ($this->getRequest()->isPost() && $_REQUEST['copy_ppty'] != "") {
         $chkQuery = $db->runQuery("select * from " . PROPERTY . " where propertycode = '" . trim($_REQUEST['copy_ppty']) . "' ");
         if ($chkQuery != "" && count($chkQuery) > 0) {
             $param1 = $_REQUEST['pricing'];
             $param2 = $_REQUEST['available'];
             $param3 = $_REQUEST['offers'];
             $param4 = $_REQUEST['images'];
             $obj = new Propertyintro();
             $obj->copyProperty($_REQUEST['copy_ppty'], $param1, $param2, $param3, $param4);
         } else {
             $mySession->errorMsg = "Please enter proper property code in the box";
         }
         $this->_redirect("myaccount/addproperty");
     }
     /*             * * checking that step 2 is there then fetch property specification from the table * */
     $this->view->myform = $myform;
     $this->view->varsuccess = $varsuccess;
     /*             * *  Image fetch from database  ** */
     /*             * *                            ** */
 }
Пример #2
0
 public function init($ppty_id)
 {
     global $mySession;
     $db = new Db();
     $country_id_value = "";
     $state_id_value = "";
     $city_id_value = "";
     $address_value = "";
     $zipcode_value = "";
     $telephone_value = "";
     $website_value = "";
     $no_of_bedroom_value = "";
     $no_of_bathroom_value = "";
     $no_of_en_suite_bathroom_value = "";
     $occupancy_value = "";
     $company_name_value = "";
     $agent_name_value = "";
     $agent_address_value = "";
     $agent_telephone = "";
     $agent_email_value = "";
     $direction_property_value = "";
     $key_instruction_value = "";
     $late_instruction_value = "";
     $arrival_instruction_value = "";
     $title_value = "";
     $introduction_value = "Up to 300 Characters";
     $sub_area_value = "";
     $local_area_value = "";
     $accomodation_type_value = "";
     $rating_value = "";
     $meta_keywords_value = "";
     $meta_description_value = "";
     if ($ppty_id != "") {
         $pptyData = $db->runQuery("select * from " . PROPERTY . " where id = '" . $ppty_id . "' ");
         //prd($pptyData);
         $title_value = $pptyData[0]['property_title'];
         $introduction_value = $pptyData[0]['brief_desc'];
         $country_id_value = $pptyData[0]['country_id'];
         $state_id_value = $pptyData[0]['state_id'];
         $city_id_value = $pptyData[0]['city_id'];
         $sub_area_value = $pptyData[0]['sub_area_id'];
         $local_area_value = $pptyData[0]['local_area_id'];
         $zipcode_value = $pptyData[0]['zipcode'];
         $accomodation_type_value = $pptyData[0]['property_type'];
         $no_of_bedroom_value = $pptyData[0]['bedrooms'];
         $no_of_bathroom_value = $pptyData[0]['bathrooms'];
         $no_of_en_suite_bathroom_value = $pptyData[0]['en_bedrooms'];
         $occupancy_value = $pptyData[0]['maximum_occupancy'];
         $meta_keywords_value = $pptyData[0]['meta_keywords'];
         $meta_description_value = $pptyData[0]['meta_description'];
         //get attribute values
         $attributeVal = $db->runQuery("select attrib.attribute_id, attrib.attribute_name from " . ATTRIBUTE_ANS . " attrib_ans inner join " . ATTRIBUTE . " attrib on attrib_ans.ans_attribute_id = attrib.attribute_id where attribute_status = '1' and attrib_ans.ans_property_id= '{$ppty_id}' ");
         $attributeVal = array_map(function ($x) {
             return $x['attribute_id'];
         }, $attributeVal);
     }
     $title = new Zend_Form_Element_Text('title');
     $title->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Title is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required limitmatch")->setAttrib("placeholder", "Up to 100 Characters")->setAttrib("maxlength", "100")->setValue($title_value);
     $meta_keywords = new Zend_Form_Element_Text('meta_keywords');
     $meta_keywords->addValidator('NotEmpty', true, array('messages' => 'Keywords is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput  limitmatch")->setAttrib("placeholder", "Up to 100 Characters")->setAttrib("maxlength", "100")->setValue($meta_keywords_value);
     $meta_description = new Zend_Form_Element_Text('meta_description');
     $meta_description->addValidator('NotEmpty', true, array('messages' => 'Description is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput  limitmatch")->setAttrib("placeholder", "Up to 200 Characters")->setAttrib("maxlength", "200")->setValue($meta_description_value);
     $introduction = new Zend_Form_Element_Textarea('introduction');
     $introduction->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Title is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required limitmatch1")->setAttrib("placeholder", "Up to 300 Characters ")->setAttrib("maxlength", "300")->setValue($introduction_value);
     $CountryArr = array();
     $CountryArr[0]['key'] = "";
     $CountryArr[0]['value'] = "- - Country - -";
     $CountryData = $db->runQuery("select * from " . COUNTRIES . "  order by country_name");
     if ($CountryData != "" and count($CountryData) > 0) {
         $i = 1;
         foreach ($CountryData as $key => $CountryValues) {
             $CountryArr[$i]['key'] = $CountryValues['country_id'];
             $CountryArr[$i]['value'] = $CountryValues['country_name'];
             $i++;
         }
     }
     $country_id = new Zend_Form_Element_Select('country_id');
     $country_id->setRequired(true)->addMultiOptions($CountryArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setAttrib("onchange", "getCountryState(this.value);")->setValue($country_id_value);
     $stateArr = array();
     $stateArr[0]['key'] = "";
     $stateArr[0]['value'] = "- - State - -";
     /* if($userId != "")
                   {
                   $stateData=$db->runQuery("select * from ".USERS." as u inner join ".STATE." as s on s.state_id = u.state_id
                   where u.user_id='".$userId."'");
                   $stateArr[0]['key'] = $stateData[0]['state_id'];
                   $stateArr[0]['value'] = $stateData[0]['state_name'];
                   $state_id_value = $adminData[0]['state_id'];
     
                   } */
     //		echo $_REQUEST['country_id']; exit;
     if ($_REQUEST['country_id'] != "" || $ppty_id != "") {
         if ($_REQUEST['country_id'] != "") {
             $stateData = $db->runQuery("select * from " . STATE . " as s inner join " . COUNTRIES . " as c on s.country_id = c.country_id\n\t\t\t \t\t\t\t\t\t  where s.country_id='" . $_REQUEST['country_id'] . "'");
             $state_id_value = $_REQUEST['state_id'];
         } else {
             $stateData = $db->runQuery("select * from " . STATE . " as s inner join " . COUNTRIES . " as c on s.country_id = c.country_id\n\t \t\t\t\t\t\t  where s.country_id='" . $country_id_value . "'");
         }
         $i = 1;
         foreach ($stateData as $values) {
             $stateArr[$i]['key'] = $values['state_id'];
             $stateArr[$i]['value'] = $values['state_name'];
             $i++;
         }
     }
     $state_id = new Zend_Form_Element_Select('state_id');
     $state_id->setRequired(true)->addMultiOptions($stateArr)->addValidator('NotEmpty', true, array('messages' => 'State is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setRegisterInArrayValidator(false)->setAttrib("class", "mws-textinput required")->setAttrib("onchange", "getStateCity(this.value);")->setValue($state_id_value);
     $cityArr = array();
     $cityArr[0]['key'] = "";
     $cityArr[0]['value'] = "- - City - -";
     /* if($userId != "")
                   {
                   $cityData=$db->runQuery("select * from ".USERS." as u inner join ".CITIES." as c on c.city_id = u.city_id
                   where u.user_id='".$userId."'");
                   $cityArr[0]['key'] = $cityData[0]['city_id'];
                   $cityArr[0]['value'] = $cityData[0]['city_name'];
                   $city_id_value = $cityData[0]['city_id'];
     
                   } */
     if ($_REQUEST['state_id'] != "" || $ppty_id != "") {
         if ($_REQUEST['state_id'] != "") {
             $cityData = $db->runQuery("select * from " . CITIES . " where state_id='" . $_REQUEST['state_id'] . "'");
             $city_id_value = $_REQUEST['city_id'];
         } else {
             $cityData = $db->runQuery("select * from " . CITIES . " where state_id='" . $state_id_value . "'");
         }
         $i = 1;
         foreach ($cityData as $values) {
             $cityArr[$i]['key'] = $values['city_id'];
             $cityArr[$i]['value'] = $values['city_name'];
             $i++;
         }
     }
     $city_id = new Zend_Form_Element_Select('city_id');
     $city_id->setRequired(true)->addMultiOptions($cityArr)->setRegisterInArrayValidator(false)->addValidator('NotEmpty', true, array('messages' => 'City is required.'))->setAttrib("class", "mws-textinput required")->setAttrib("onchange", "getCitySub(this.value);")->setValue($city_id_value);
     /*             * ** SUB AREA[OPTIONAL] **** */
     /*             * ************************** */
     $subareaArr = array();
     $subareaArr[0]['key'] = "";
     $subareaArr[0]['value'] = "- - Sub Area - -";
     if ($_REQUEST['city_id'] != "" || $ppty_id != "") {
         if ($_REQUEST['city_id'] != "") {
             $subareaData = $db->runQuery("select * from " . SUB_AREA . " where city_id ='" . $_REQUEST['city_id'] . "'");
             $sub_area_value = $_REQUEST['sub_area'];
         } else {
             $subareaData = $db->runQuery("select * from " . SUB_AREA . " where city_id ='" . $city_id_value . "'");
         }
         $i = 1;
         foreach ($subareaData as $values) {
             $subareaArr[$i]['key'] = $values['sub_area_id'];
             $subareaArr[$i]['value'] = $values['sub_area_name'];
             $i++;
         }
     }
     //prd($sub_area_value);
     $sub_area = new Zend_Form_Element_Select('sub_area');
     $sub_area->addMultiOptions($subareaArr)->setRegisterInArrayValidator(false)->setAttrib("class", "mws-textinput")->setAttrib("onchange", "getSubLocal(this.value);")->setValue($sub_area_value);
     /*             * ** LOCAL AREA[OPTIONAL] ** */
     /*             * ************************** */
     $localareaArr = array();
     $localareaArr[0]['key'] = "";
     $localareaArr[0]['value'] = "- - Local Area - -";
     if ($_REQUEST['sub_area'] != "" || $ppty_id != "") {
         if ($_REQUEST['sub_area'] != "") {
             $localareaData = $db->runQuery("select * from " . LOCAL_AREA . " where sub_area_id ='" . $_REQUEST['sub_area'] . "'");
             $local_area_value = $_REQUEST['local_area'];
         } else {
             $localareaData = $db->runQuery("select * from " . LOCAL_AREA . " where sub_area_id ='" . $sub_area_value . "'");
         }
         $i = 1;
         foreach ($localareaData as $values) {
             $localareaArr[$i]['key'] = $values['local_area_id'];
             $localareaArr[$i]['value'] = $values['local_area_name'];
             $i++;
         }
     }
     $local_area = new Zend_Form_Element_Select('local_area');
     $local_area->addMultiOptions($localareaArr)->setRegisterInArrayValidator(false)->setAttrib("class", "mws-textinput")->setValue($local_area_value);
     /* 		$address= new Zend_Form_Element_Textarea('address');
          $address->setAttrib("class","mws-textinput required")
          ->setAttrib("rows","4")
          ->setAttrib("cols","30")
          ->setValue($address_value); */
     $zipcode = new Zend_Form_Element_Text('zipcode');
     $zipcode->setRequired(true)->addValidator('NotEmpty', true, array('messages' => 'Zipcode is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setAttrib("maxlength", "7")->setValue($zipcode_value);
     /* $telephone = new Zend_Form_Element_Text('telephone');
        $telephone->setRequired(true)
        ->addValidator('NotEmpty',true,array('messages' =>'Telephone number is required.'))
        ->addDecorator('Errors', array('class'=>'errmsg'))
        ->setAttrib("class","mws-textinput required")
        ->setAttrib("maxlength","15")
        ->setValue($telephone_value); */
     /* $website = new Zend_Form_Element_Text('website');
        $website->addDecorator('Errors', array('class'=>'errmsg'))
        ->setAttrib("class","mws-textinput url")
        ->setValue($website_value); */
     $accomodationData = $db->runQuery("select * from " . PROPERTY_TYPE . " order by ptyle_name");
     $accomodationArr[0]['key'] = "";
     $accomodationArr[0]['value'] = "- - select -- ";
     $i = 1;
     foreach ($accomodationData as $key => $Data) {
         $accomodationArr[$i]['key'] = $Data['ptyle_id'];
         $accomodationArr[$i]['value'] = $Data['ptyle_name'];
         $i++;
     }
     $accomodation_type = new Zend_Form_Element_Select('accomodation_type');
     $accomodation_type->setRequired(true)->addMultiOptions($accomodationArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setValue($accomodation_type_value);
     /** number of bedrooms * */
     $no_of_bedroomArr[0]['key'] = "";
     $no_of_bedroomArr[0]['value'] = "- - Select - -";
     for ($i = 1; $i <= 10; $i++) {
         $no_of_bedroomArr[$i]['key'] = $i;
         $no_of_bedroomArr[$i]['value'] = $i;
     }
     $no_of_bedroom = new Zend_Form_Element_Select('no_of_bedroom');
     $no_of_bedroom->setRequired(true)->addMultiOptions($no_of_bedroomArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setValue($no_of_bedroom_value);
     /** number of bathrooms * */
     $no_of_bathroomArr[0]['key'] = "";
     $no_of_bathroomArr[0]['value'] = "- - Select - -";
     for ($i = 1, $k = 1; $i <= 20; $k = $k + 0.5, $i++) {
         $no_of_bathroomArr[$i]['key'] = $k;
         $no_of_bathroomArr[$i]['value'] = $k;
     }
     $no_of_bathroom = new Zend_Form_Element_Select('no_of_bathroom');
     $no_of_bathroom->setRequired(true)->addMultiOptions($no_of_bathroomArr)->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setValue($no_of_bathroom_value);
     /** number of En-Suite Bathrooms * */
     $no_of_nbathroomArr[0]['key'] = "";
     $no_of_nbathroomArr[0]['value'] = "- - Select - -";
     for ($i = 1, $k = 0; $k <= 8; $i++, $k++) {
         $no_of_nbathroomArr[$i]['key'] = $k;
         $no_of_nbathroomArr[$i]['value'] = $k;
     }
     $no_of_en_suite_bathroom = new Zend_Form_Element_Select('no_of_en_suite_bathroom');
     $no_of_en_suite_bathroom->setRequired(true)->addMultiOptions($no_of_nbathroomArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setValue($no_of_en_suite_bathroom_value);
     /** maximum occupancy * */
     $occupancyArr[0]['key'] = "";
     $occupancyArr[0]['value'] = "- - Select - -";
     for ($i = 1; $i <= 20; $i++) {
         $occupancyArr[$i]['key'] = $i;
         $occupancyArr[$i]['value'] = $i;
     }
     $occupancy = new Zend_Form_Element_Select('occupancy');
     $occupancy->setRequired(true)->addMultiOptions($occupancyArr)->addValidator('NotEmpty', true, array('messages' => 'Country is required.'))->addDecorator('Errors', array('class' => 'errmsg'))->setAttrib("class", "mws-textinput required")->setValue($occupancy_value);
     /** Rating * */
     /* 		
                   for($i = 1; $i<=5;$i++)
                   {
                   $ratingArr[$i]['key'] = $i;
                   }
     
     
      $rating = new Zend_Form_Element_Radio('rating');
                   $rating->setRequired(true)
                   ->addMultiOptions($ratingArr)
                   ->setRegisterInArrayValidator(false)
                   ->removeDecorator('label')
                   ->setAttrib("class","star")
                   ->setValue($rating_value);
     */
     $primesData = $db->runQuery("select * from " . ATTRIBUTE . " where attribute_status = '1' ");
     foreach ($primesData as $primesKey => $primesVal) {
         $primesArr[$primesKey]['key'] = $primesVal['attribute_id'];
         $primesArr[$primesKey]['value'] = $primesVal['attribute_name'];
     }
     $primes = new Zend_Form_Element_MultiCheckbox('primes');
     $primes->addMultiOptions($primesArr)->setAttrib("class", "mws-textinput")->setAttrib('label_style', '')->setAttrib("padding", "5px")->setValue($attributeVal);
     /* hidden field for checking the step */
     $step = new Zend_Form_Element_Hidden('step');
     $step->setValue("1");
     $ppty_no = new Zend_Form_Element_Hidden('ppty_no');
     $ppty_no->setValue(generate_property_no(11));
     $this->addElements(array($title, $introduction, $country_id, $state_id, $city_id, $zipcode, $accomodation_type, $no_of_bedroom, $no_of_bathroom, $no_of_en_suite_bathroom, $occupancy, $step, $sub_area, $local_area, $ppty_no, $meta_keywords, $meta_description, $primes));
 }
Пример #3
0
 public function copyProperty($ppty_no, $param1, $param2, $param3, $param4)
 {
     global $mySession;
     $db = new Db();
     $chkQuery = $db->runQuery("select * from " . PROPERTY . " where propertycode = '" . $ppty_no . "' ");
     //step1 is saved in database
     $data_update['propertycode'] = generate_property_no($mySession->LoggedUserId);
     $data_update['property_type'] = $chkQuery[0]['property_type'];
     $data_update['property_title'] = $chkQuery[0]['property_title'];
     //$data_update['telephone'] = $dataForm['telephone'];
     $data_update['website'] = $chkQuery[0]['website'];
     $data_update['brief_desc'] = $chkQuery[0]['brief_desc'];
     $data_update['country_id'] = $chkQuery[0]['country_id'];
     $data_update['state_id'] = $chkQuery[0]['state_id'];
     $data_update['city_id'] = $chkQuery[0]['city_id'];
     $data_update['sub_area_id'] = $chkQuery[0]['sub_area_id'];
     $data_update['local_area_id'] = $chkQuery[0]['local_area_id'];
     $data_update['zipcode'] = $chkQuery[0]['zipcode'];
     $data_update['date_added'] = date('Y-m-d');
     /* other details */
     $data_update['bedrooms'] = $chkQuery[0]['bedrooms'];
     $data_update['bathrooms'] = $chkQuery[0]['bathrooms'];
     $data_update['en_bedrooms'] = $chkQuery[0]['en_bedrooms'];
     $data_update['maximum_occupancy'] = $chkQuery[0]['maximum_occupancy'];
     $meta_keywords = $chkQuery[0]['property_title'] . ", " . $chkQuery[0]['bedrooms'] . " bedrooms, " . $chkQuery[0]['bathrooms'] . " bathrooms, " . $chkQuery[0]['property_type'] . ", " . $data_update['propertycode'];
     $meta_description = substr($chkQuery[0]['brief_desc'], 0, 200);
     $data_update['meta_keywords'] = addslashes($meta_keywords);
     $data_update['meta_description'] = addslashes($meta_description);
     //$data_update['status'] = '1';
     $data_update['star_rating'] = $chkQuery[0]['star_rating'];
     $data_update['user_id'] = $mySession->LoggedUserId;
     $data_update['status_2'] = $chkQuery[0]['status_2'];
     //prd($data_update);
     //step 3
     $data_update['big_desc'] = $chkQuery[0]['big_desc'];
     $data_update['amenity_ques'] = $chkQuery[0]['amenity_ques'];
     $data_update['airport1'] = $chkQuery[0]['airport1'];
     $data_update['airport2'] = $chkQuery[0]['airport2'];
     $data_update['distance_airport1'] = $chkQuery[0]['distance_airport1'];
     $data_update['distance_airport2'] = $chkQuery[0]['distance_airport2'];
     $data_update['status_3'] = $chkQuery[0]['status_3'];
     //step 4
     $data_update['cletitude'] = $chkQuery[0]['cletitude'];
     $data_update['clongitude'] = $chkQuery[0]['clongitude'];
     $data_update['address'] = $chkQuery[0]['address'];
     $data_update['status_4'] = $chkQuery[0]['status_4'];
     //step 5
     if ($chkQuery[0]['floor_plan'] != "") {
         $tmp_name = explode(".", $chkQuery[0]['floor_plan']);
         $randomname = "floorplan_" . $chkQuery[0]['user_id'] . "_" . time() . "." . $tmp_name[count($tmp_name) - 1];
         $chkQuery[0]['floor_plan'];
         copy(SITE_ROOT . "images/floorplan/" . $chkQuery[0]['floor_plan'], SITE_ROOT . "images/floorplan/" . $randomname);
         $data_update['floor_plan'] = $randomname;
     }
     //step 7
     $data_update['currency_code'] = $chkQuery[0]['currency_code'];
     //step 8
     $data_update['rental_ques'] = $chkQuery[0]['rental_ques'];
     //step 9
     $data_update['agent_person'] = $chkQuery[0]['agent_person'];
     $data_update['agent_name'] = $chkQuery[0]['agent_name'];
     $data_update['agent_phone'] = $chkQuery[0]['agent_phone'];
     $data_update['agent_address'] = $chkQuery[0]['agent_address'];
     $data_update['agent_email'] = $chkQuery[0]['agent_email'];
     $data_update['agent_website'] = $chkQuery[0]['agent_website'];
     $data_update['property_name'] = $chkQuery[0]['property_name'];
     $data_update['address1'] = $chkQuery[0]['address1'];
     $data_update['telephone'] = $chkQuery[0]['telephone'];
     $data_update['emergency_no'] = $chkQuery[0]['emergency_no'];
     $data_update['website'] = $chkQuery[0]['website'];
     $data_update['master_cal_url'] = $chkQuery[0]['master_cal_url'];
     /* instruction details */
     $data_update['directions_to_property'] = $chkQuery[0]['directions_to_property'];
     $data_update['late_arrival_instruction'] = $chkQuery[0]['late_arrival_instruction'];
     if ($chkQuery[0]['arrival_instruction'] != "") {
         $tmp_name = explode(".", $chkQuery[0]['arrival_instruction']);
         $randomname = $tmp_name[0] . date() . time() . "." . $tmp_name[count($tmp_name) - 1];
         copy(SITE_ROOT . "uploads/instructions/" . $chkQuery[0]['arrival_instruction'], SITE_ROOT . "uploads/instructions/" . $randomname);
         $data_update['arrival_instruction'] = $randomname;
     }
     if ($chkQuery[0]['arrival_instruction1'] != "") {
         $tmp_name = explode(".", $chkQuery[0]['arrival_instruction1']);
         $randomname = $tmp_name[0] . date() . time() . "." . $tmp_name[count($tmp_name) - 1];
         copy(SITE_ROOT . "uploads/instructions/" . $chkQuery[0]['arrival_instruction1'], SITE_ROOT . "uploads/instructions/" . $randomname);
         $data_update['arrival_instruction1'] = $randomname;
     }
     if ($chkQuery[0]['arrival_instruction2'] != "") {
         $tmp_name = explode(".", $chkQuery[0]['arrival_instruction2']);
         $randomname = $tmp_name[0] . date() . time() . "." . $tmp_name[count($tmp_name) - 1];
         copy(SITE_ROOT . "uploads/instructions/" . $chkQuery[0]['arrival_instruction2'], SITE_ROOT . "uploads/instructions/" . $randomname);
         $data_update['arrival_instruction2'] = $randomname;
     }
     $data_update['key_instructions'] = $chkQuery[0]['key_instructions'];
     $data_update['status_9'] = $chkQuery[0]['status_9'];
     $db->save(PROPERTY, $data_update);
     $mySession->property_id = $db->lastInsertId();
     $mySession->ppty_no = $data_update['propertycode'];
     //$mySession->step = '1';
     //COPY SPECIFICATION
     $specArr = $db->runQuery("select * from " . SPEC_ANS . " where property_id = '" . $chkQuery[0]['id'] . "' ");
     foreach ($specArr as $val) {
         $data_update1['user_id'] = $mySession->LoggedUserId;
         $data_update1['property_id'] = $mySession->property_id;
         $data_update1['spec_id'] = $val['spec_id'];
         $data_update1['answer'] = $val['answer'];
         $db->save(SPEC_ANS, $data_update1);
     }
     //COPY AMENITY STEP
     $amenityArr = $db->runQuery("select * from " . AMENITY_ANS . " where property_id = '" . $chkQuery[0]['id'] . "' ");
     $data_update1 = array();
     foreach ($amenityArr as $val) {
         $data_update1['user_id'] = $mySession->LoggedUserId;
         $data_update1['property_id'] = $mySession->property_id;
         $data_update1['amenity_id'] = $val['amenity_id'];
         $data_update1['amenity_value'] = $val['amenity_value'];
         $db->save(AMENITY_ANS, $data_update1);
     }
     //IMAGE UPLOAD STEP 5
     if ($param4 == '1') {
         $galleryArr = $db->runQuery("select * from " . GALLERY . " where property_id = '" . $chkQuery[0]['id'] . "' ");
         $data_update1 = array();
         foreach ($galleryArr as $val) {
             $data_update1['property_id'] = $mySession->property_id;
             //code for duplicating image as well as naming it
             $gimage = explode(".", $val['image_name']);
             $randomname = date() . time() . $val['gallery_id'] . "." . $gimage[count($gimage) - 1];
             copy(SITE_ROOT . "images/property/" . $val['image_name'], SITE_ROOT . "images/property/" . $randomname);
             $data_update1['image_name'] = $randomname;
             $data_update1['image_title'] = $val['image_title'];
             $db->save(GALLERY, $data_update1);
         }
         $status_update = "";
         $status_update['status_5'] = $chkQuery[0]['status_5'];
         $condition = "id=" . $mySession->property_id;
         $db->modify(PROPERTY, $status_update, $condition);
     }
     //AVAILABILITY CALENDAR STEP 6
     if ($param2 == '1') {
         $galleryArr = $db->runQuery("select * from " . CAL_AVAIL . " where property_id = '" . $chkQuery[0]['id'] . "' ");
         $data_update1 = array();
         foreach ($galleryArr as $val) {
             $data_update1['property_id'] = $mySession->property_id;
             $data_update1['date_from'] = $val['date_from'];
             $data_update1['date_to'] = $val['date_to'];
             $data_update1['cal_status'] = $val['cal_status'];
             $db->save(CAL_AVAIL, $data_update1);
         }
         $status_update = "";
         //step 6
         $status_update['cal_default'] = $chkQuery[0]['cal_default'];
         $status_update['status_6'] = $chkQuery[0]['status_6'];
         $condition = "id=" . $mySession->property_id;
         $db->modify(PROPERTY, $status_update, $condition);
     }
     //RENTAL RATES STEP 7
     if ($param1 == '1') {
         $rateArr = $db->runQuery("select * from " . CAL_RATE . " where property_id = '" . $chkQuery[0]['id'] . "' ");
         $data_update1 = array();
         foreach ($rateArr as $val) {
             $data_update1['property_id'] = $mySession->property_id;
             $data_update1['date_from'] = $val['date_from'];
             $data_update1['date_to'] = $val['date_to'];
             $data_update1['nights'] = $val['nights'];
             $data_update1['prate'] = $val['prate'];
             $db->save(CAL_RATE, $data_update1);
         }
         //save extras
         $extraArr = $db->runQuery("select * from " . EXTRAS . " where property_id = '" . $chkQuery[0]['id'] . "'  ");
         $data_update1 = array();
         foreach ($extraArr as $eval) {
             $data_update1['property_id'] = $mySession->property_id;
             $data_update1['ename'] = $eval['ename'];
             $data_update1['eprice'] = $eval['eprice'];
             $data_update1['etype'] = $eval['etype'];
             $data_update1['stay_type'] = $eval['stay_type'];
             $db->save(EXTRAS, $data_update1);
         }
         $status_update = "";
         $status_update['status_7'] = $chkQuery[0]['status_7'];
         $condition = "id=" . $mySession->property_id;
         $db->modify(PROPERTY, $status_update, $condition);
     }
     //RENTAL RATES EXTRAS STEP7
     $extrasArr = $db->runQuery("select * from " . EXTRAS . " where property_id = '" . $chkQuery[0]['id'] . "' ");
     $data_update1 = array();
     foreach ($extrasArr as $val) {
         $data_update1['property_id'] = $mySession->property_id;
         $data_update1['ename'] = $val['ename'];
         $data_update1['eprice'] = $val['eprice'];
         $data_update1['etype'] = $val['etype'];
         $db->save(EXTRAS, $data_update1);
     }
     //SPECIAL OFFERS STEP 7
     if ($param3 == '1') {
         $offerArr = $db->runQuery("select * from " . SPCL_OFFERS . " where property_id = '" . $chkQuery[0]['id'] . "' ");
         $data_update1 = array();
         foreach ($offerArr as $val) {
             $data_update1['property_id'] = $mySession->property_id;
             $data_update1['offer_id'] = $val['offer_id'];
             $data_update1['discount_offer'] = $val['discount_offer'];
             $data_update1['valid_from'] = $val['valid_from'];
             $data_update1['valid_to'] = $val['valid_to'];
             $data_update1['min_night'] = $val['min_night'];
             $data_update1['book_by'] = $val['book_by'];
             $data_update1['activate'] = $val['activate'];
             $db->save(SPCL_OFFERS, $data_update1);
         }
     }
     //code to check the status of the current property in process
     $chkstatusArr = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->property_id . "' ");
     if ($chkstatusArr[0]['status_2'] && $chkstatusArr[0]['status_3'] && $chkstatusArr[0]['status_4'] && $chkstatusArr[0]['status_5'] && $chkstatusArr[0]['status_6'] && $chkstatusArr[0]['status_7'] && $chkstatusArr[0]['status_8'] && $chkstatusArr[0]['status_9']) {
         $status_update = "";
         $status_update['status'] = '2';
         $condition = "id=" . $mySession->property_id;
         $db->modify(PROPERTY, $status_update, $condition);
     } else {
         $status_update = "";
         $status_update['status'] = '1';
         $condition = "id=" . $mySession->property_id;
         $db->modify(PROPERTY, $status_update, $condition);
     }
 }
Пример #4
0
 public function addpropertyAction()
 {
     global $mySession;
     $db = new Db();
     $this->view->pageHeading = "Add a Property";
     $ppty_no = generate_property_no(11);
     $this->view->ppty_no = $ppty_no;
     //code for checking the status of each step
     if (isset($mySession->admin_property_id)) {
         $statusArr = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->admin_property_id . "' ");
         $this->view->status_2 = $status_step2 = $statusArr[0]['status_2'];
         $this->view->status_3 = $status_step3 = $statusArr[0]['status_3'];
         $this->view->status_4 = $status_step4 = $statusArr[0]['status_4'];
         $this->view->status_5 = $status_step5 = $statusArr[0]['status_5'];
         $this->view->status_6 = $status_step6 = $statusArr[0]['status_6'];
         $this->view->status_7 = $status_step7 = $statusArr[0]['status_7'];
         $this->view->status_8 = $status_step8 = $statusArr[0]['status_8'];
         $this->view->status_9 = $status_step9 = $statusArr[0]['status_9'];
         if ($status_step2 && $status_step3 && $status_step4 && $status_step5 && $status_step6 && $status_step7 && $status_step8 && $status_step9) {
             $status_data['status'] = '2';
             $condition = "id=" . $mySession->admin_property_id;
             $db->modify(PROPERTY, $status_data, $condition);
         }
         $pptyId = $this->view->pptyId = $mySession->admin_property_id;
         $preview_link_data = $db->runQuery("select " . PROPERTY . ".propertycode ," . COUNTRIES . ".country_name, " . STATE . ".state_name, " . CITIES . ".city_name, " . LOCAL_AREA . ".local_area_name, " . SUB_AREA . ".sub_area_name,ptyle_name, ptyle_url, bedrooms, bathrooms  from " . PROPERTY . " \n                                                    inner join " . PROPERTY_TYPE . " on " . PROPERTY_TYPE . ".ptyle_id = " . PROPERTY . ".property_type\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                                                    left join " . SUB_AREA . " on " . SUB_AREA . ".sub_area_id = " . PROPERTY . ".sub_area_id\n                                                    left join " . LOCAL_AREA . " on " . LOCAL_AREA . ".local_area_id = " . PROPERTY . ".local_area_id\n                                                    where id = '" . $pptyId . "'\n                                                   ");
         $this->view->pageHeading = "Add a Propery -- Property no - " . $preview_link_data[0]['propertycode'];
         $this->view->assign($preview_link_data[0]);
     } else {
         $this->view->status_2 = 0;
         $this->view->status_3 = 0;
         $this->view->status_4 = 0;
         $this->view->status_5 = 0;
         $this->view->status_6 = 0;
         $this->view->status_7 = 0;
         $this->view->status_8 = 0;
         $this->view->status_9 = 0;
     }
     $stepId = $this->getRequest()->getParam("step");
     if ($stepId != "") {
         $mySession->step = $stepId - 1;
     }
     if ($stepId == 'confirm') {
         $mySession->step = 0;
     }
     if (!isset($mySession->admin_property_id)) {
         $mySession->step = 0;
     }
     //prd($mySession->step);
     switch ($mySession->step) {
         default:
         case '0':
             $myform = new Form_Ownproperty($mySession->admin_property_id);
             $this->view->step = '1';
             $step = '1';
             if (isset($mySession->admin_property_id)) {
                 $ratingArr = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->admin_property_id . "' ");
                 $this->view->rating = $ratingArr[0]['star_rating'];
             }
             //custom attributes
             $customAttributes = $db->runQuery(" select * from " . ATTRIBUTE_ANS . " where ans_property_id = '{$pptyId}' and ans_attribute_id='0' ");
             $this->view->customAttributes = $customAttributes;
             break;
         case '1':
             $specArr = $db->runQuery("select * from " . SPECIFICATION . " as s inner join " . PROPERTY_SPEC_CAT . " as psc on s.cat_id = psc.cat_id \n                                                    where psc.cat_status = '1' \n                                                    and s.status = '1' order by psc.cat_id, s.spec_order asc\n\t\t\t\t\t\t   ");
             $this->view->specData = $specArr;
             $myform = new Form_Propertyspec($mySession->admin_property_id);
             $this->view->stepId = $stepId;
             $this->view->step = '2';
             $step = '2';
             //bathroom no.
             $bathroomArr = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->admin_property_id . "' ");
             $this->view->no_bedrooms = $bathroomArr[0]['bedrooms'];
             break;
         case '2':
             $amenityArr = $db->runQuery("select * from " . AMENITY_PAGE . " ");
             $this->view->amenityData = $amenityArr;
             $amenity = $db->runQuery("select * from " . AMENITY . " where amenity_status = '1' ");
             $this->view->amenityArr = $amenity;
             if ($mySession->admin_property_id != '') {
                 $myform = new Form_Amenities($mySession->admin_property_id);
             } else {
                 $myform = new Form_Amenities();
             }
             $this->view->step = '3';
             $step = '3';
             break;
         case '3':
             if ($stepId == '4') {
                 $myform = new Form_Location($mySession->admin_property_id);
             } else {
                 $myform = new Form_Location();
             }
             $this->view->step = '4';
             $step = '4';
             break;
         case '4':
             $this->view->step = '5';
             $Arr = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->admin_property_id . "' ");
             $this->view->floorPlan = $Arr[0]['floor_plan'];
             //$myform = new Form_Photo();
             $step = '5';
             //submit photo action
             //submit photo action ends
             break;
         case '5':
             $myform = new Form_Cal();
             $this->view->myform = $myform;
             $next = $this->getRequest()->getParam("cal");
             if ($next != "") {
                 $this->view->nexts = $next;
             } else {
                 $this->view->nexts = 0;
             }
             $calArr = $db->runQuery("select * from " . CAL_AVAIL . " where property_id = '" . $mySession->admin_property_id . "' ");
             $this->view->calArr = $calArr;
             $this->view->step = '6';
             $step = '6';
             //passing default value of calendar to view
             $pptyArr = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->admin_property_id . "' ");
             $this->view->cal_default = $pptyArr[0]['cal_default'];
             break;
         case '6':
             $this->view->step = '7';
             $step = '7';
             $offerArr = $db->runQuery("select * from " . SPCL_OFFER_TYPES . " as sot left join " . SPCL_OFFERS . " as so \n\t\t\t\t\t\t\t\t   on  sot.id = so.offer_id where so.property_id = '" . $mySession->admin_property_id . "' order by so.spcl_offer_id asc\n\t\t\t\t\t\t\t\t   ");
             if (count($offerArr) == 0) {
                 $offerArr = $db->runQuery("select * from " . SPCL_OFFER_TYPES . "");
                 foreach ($offerArr as $values) {
                     $dataForm['offer_id'] = $values['id'];
                     //$dataForm['date_from'] = date('Y-m-d', strtotime($_REQUEST['Date_f']));
                     //$dataForm['date_to'] = date('Y-m-d', strtotime($_REQUEST['Date_t']));
                     //$dataForm['nights'] = $_REQUEST['Nights'];
                     //$dataForm['prate'] = $_REQUEST['Rate'];
                     $dataForm["property_id"] = $mySession->admin_property_id;
                     $db->save(SPCL_OFFERS, $dataForm);
                 }
             }
             $this->view->offerArr = $offerArr;
             //echo $mySession->step; exit;
             //rental question
             $rentalQues = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->admin_property_id . "' ");
             if ($rentalQues != "" && count($rentalQues) > 0) {
                 $this->view->rental_ques = $rentalQues[0]['rental_ques'];
             }
             //currency data
             $currData = $db->runQuery("select * from  " . CURRENCY . " order by currency_order asc ");
             $this->view->currencyData = $currData;
             //checking for currency
             if ($rentalQues[0]['currency_code'] != NULL) {
                 $this->view->currency_set = '1';
                 $this->view->currency_val = $rentalQues[0]['currency_code'];
             } else {
                 $this->view->currency_set = '0';
             }
             break;
         case '7':
             $myform = new Form_Oreview($mySession->admin_property_id);
             //query for getting image
             $this->view->step = '8';
             //$uData = $db->runQuery("select * from ".OWNER_REVIEW." where property_id = '".$mySession->admin_property_id."' ");
             /* if($uData[0]['owner_image'] == "")
                 $this->view->image = "no_owner_pic.jpg";
                 else
                 $this->view->image = $uData[0]['owner_image'];
                */
             if (!isset($mySession->reviewImage)) {
                 $mySession->reviewImage = "no_owner_pic.jpg";
             }
             $this->view->myform = $myform;
             $reviewArr = $db->runQuery("select * from " . OWNER_REVIEW . " as r\n\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\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\twhere r.property_id = '" . $mySession->admin_property_id . "' and r.review_status = '1' order by r.review_id desc ");
             $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);
             $this->view->reviewArr = $reviewData;
             break;
         case '8':
             if (isset($mySession->admin_property_id)) {
                 $myform = new Form_Arrival($mySession->admin_property_id);
             } else {
                 $myform = new Form_Arrival();
             }
             $this->view->step = '9';
             $this->view->myform = $myform;
             $Arrival = $db->runQuery("select * from " . PROPERTY . " where id = '" . $mySession->admin_property_id . "' ");
             $this->view->arrival = $Arrival[0]['arrival_instruction'];
             $this->view->arrival1 = $Arrival[0]['arrival_instruction1'];
             $this->view->arrival2 = $Arrival[0]['arrival_instruction2'];
             if ($this->getRequest()->isPost()) {
                 $mySession->step = '9';
             }
             break;
         case '9':
             $this->view->step = '10';
             break;
         case '10':
             break;
     }
     //switch case ends
     /* code used for step 2 */
     if ($this->getRequest()->isPost() && $_REQUEST['copy_ppty'] == "") {
         if ($_REQUEST['next'] != "") {
             $mySession->step = '2';
         }
     }
     $this->view->myform = $myform;
     $this->view->varsuccess = $varsuccess;
     //list of default properties
     $defaultPropertyArr = $db->runQuery("select * from " . PROPERTY . " where status = '5' ");
     $this->view->defaultPropertyArr = $defaultPropertyArr;
 }