Exemplo n.º 1
0
 function createSessionTaxiBooking($data, $step = 1)
 {
     // 		$this->clearSessionBYStep($step);
     $session = new Zend_Session_Namespace('taxibooking');
     if ($step == 1) {
         $session->point_step = 1;
         $session->step1 = 1;
         $session->step2 = 0;
         $session->step3 = 0;
         $session->step4 = 0;
         $data['return_date'] = $data['pickup_date'];
         // 			$data['return_time']=$data['pickup_time'].":".$data['pickup_mins'];//must get max hour plus with pick up
         $session->pickup_date = empty($data['pickup_date']) ? null : $data['pickup_date'];
         $session->pickup_time = empty($data['pickup_time']) ? null : $data['pickup_time'];
         $session->pickup_mins = empty($data['pickup_mins']) ? null : $data['pickup_mins'];
         $session->return_date = empty($data['return_date']) ? null : $data['return_date'];
         $session->return_time = empty($data['return_time']) ? null : $data['return_time'];
         // 			$session->return_mins =empty($data['return_mins'])? null : $data['return_mins'];
         $session->from_location = empty($data['from_location']) ? 0 : $data['from_location'];
         $session->to_location = empty($data['to_location']) ? 0 : $data['to_location'];
         $session->trip_way = $data['trip_way'];
         $session->from_locationname = $this->getLocationNameById($data['from_location']);
         $session->to_locationname = $this->getLocationNameById($data['to_location']);
         $db = new Application_Model_DbTable_DbGlobal();
         $session->vehiclevaliable = $db->getAllAvailableVehicle($data);
     } elseif ($step == 2) {
         $session->point_step = 2;
         $session->step2 = 1;
         $session->vehicle_id = $data;
         //$data get parram store value only not array
         $row = $this->getTaxiPriceByLocation($data, $session->from_location, $session->to_location);
         if ($session->trip_way == 1) {
             $taxiprice = $row['price'] + $row['price'] * $row['tax'] / 100;
         } else {
             $taxiprice = $row['round_trip'] + $row['round_trip'] * $row['tax'] / 100;
         }
         $session->taxi_price = $taxiprice;
         $db = new Application_Model_DbTable_DbGlobal();
         $array = array('pickup_date' => $session->pickup_date, 'return_date' => $session->pickup_date, 'return_time' => $session->pickup_time . ":" . $session->pickup_mins);
         $session->guideavaliable = $db->getAvailableDriver($array);
         $row = $db->geVehicleById($data);
         $session->vehicle_name = $row["make"] . " " . $row["model"] . " " . $row["sub_model"] . "(" . $row["reffer"] . ")";
         $session->time = $this->getTimeArrived($data, $session->from_location, $session->to_location);
     } elseif ($step == 3) {
         $session->point_step = 3;
         $session->step3 = 1;
         $session_user = new Zend_Session_Namespace('customer');
         $session->user_id = $session_user->customer_id;
         $session->user_name = $session_user->customer_name;
     } elseif ($step == 4) {
         $session->point_step = 4;
         $session->step4 = 1;
     }
     return true;
 }
Exemplo n.º 2
0
 public function bookingAction()
 {
     $db = new Application_Model_DbTable_DbGlobal();
     $step_one = 0;
     $step_two = 0;
     $step_three = 0;
     $step_five = 0;
     //$step_four=0;
     $customer_user_session = "";
     $session_step_one = new Zend_Session_Namespace('booking');
     $step_booking = $session_step_one->step_one;
     $user_ip = $session_step_one->user_ip;
     $step_4 = new Zend_Session_Namespace('step_four');
     $session_step_four = $step_4->step4;
     $customer_session = new Zend_Session_Namespace('customer');
     $user_session = $customer_session->customer_session;
     if (!empty($session_step_four)) {
         $step_four = $session_step_four;
     } else {
         $step_four = 0;
     }
     if (!empty($user_session)) {
         $customer_user_session = $user_session;
         $customer_user = $customer_session->customer_id;
         $this->view->user_name = $customer_session->customer_name;
         $this->view->user_info = $customer_session->user_info;
     } else {
         $customer_user_session = 0;
     }
     if ($step_booking == "") {
         $step_one = 0;
     } else {
         $step_one = $step_booking;
     }
     $data_first_step = array();
     $row_vehicle = array();
     $row_vehicle_price = array();
     $row_equipment_price = array();
     $row_driver_price = array();
     $row_equipment = array();
     $row_driver = array();
     if ($step_one != 0) {
         $post = $this->getRequest()->getPost();
         if (isset($post["search_vehicle"])) {
             $db->deleteVisaulBooking($user_ip, 2);
             $row = $db->getAllAvailableVehicle($post);
             if (!empty($row)) {
                 $db->updateVisualBookingStepOne($post, $user_ip);
             }
             $session_step_two = new Zend_Session_Namespace('step_two');
             $session_step_two->unsetAll();
             $session_step_three = new Zend_Session_Namespace('step_three');
             $session_step_three->unsetAll();
             $session_step_four = new Zend_Session_Namespace('step_four');
             $session_step_four->unsetAll();
             $session_step_five = new Zend_Session_Namespace('step_five');
             $session_step_five->unsetAll();
             //Application_Form_FrmMessage::redirectUrl("/index/booking");
         }
         $data_first_step = $db->getFirstStepData($user_ip);
         $row_driver = $db->getAvailableDriver($data_first_step);
         $row_equipment = $db->getEquipment($data_first_step);
         $row_vehicle = $db->getAllAvailableVehicle($data_first_step);
         $session_step_two = new Zend_Session_Namespace('step_two');
         if ($session_step_two->step_two == "") {
             $step_two = 0;
         } else {
             $step_two = $session_step_two->step_two;
         }
         if ($step_two != 0) {
             $row_vehicle_price = $db->getVehiclePriceSelected($user_ip);
             $session_step_three = new Zend_Session_Namespace('step_three');
             if ($session_step_three->step_three == "") {
                 $step_three = 0;
             } else {
                 $step_three = $session_step_three->step_three;
             }
             if ($step_three != 0) {
                 if ($this->getRequest()->isPost()) {
                     $data = $this->getRequest()->getPost();
                     if (isset($data["pro_equip"])) {
                         if ($data["identity_equipment"] != "" or $data["identity_driver"] != "") {
                             $db->updateVisualBookingStebthree($user_ip, $data);
                         }
                     }
                 }
                 $row_equipment_price = $db->getProductAndServicesSelected($user_ip, 3);
                 $row_driver_price = $db->getProductAndServicesSelected($user_ip, 2);
                 if ($step_four != 0) {
                     if ($this->getRequest()->isPost()) {
                         $data = $this->getRequest()->getPost();
                         if (isset($data["confirm_book"])) {
                             $session_step_five = new Zend_Session_Namespace('step_five');
                             $step_five = $session_step_five->step_five = 1;
                         } elseif (isset($data["term_condiction"])) {
                             $db->addCuFlight($data, $user_ip);
                         }
                     }
                 } else {
                     if ($this->getRequest()->isPost()) {
                         $data = $this->getRequest()->getPost();
                         if (isset($data["term_condiction"])) {
                             $db->addCuFlight($data, $user_ip);
                             $session_step_four = new Zend_Session_Namespace('step_four');
                             $step_four = $session_step_four->step4 = 1;
                         }
                     }
                 }
             } else {
                 if ($this->getRequest()->isPost()) {
                     $data = $this->getRequest()->getPost();
                     if (isset($data["pro_equip"])) {
                         $session_step_three = new Zend_Session_Namespace('step_three');
                         $session_step_three->step_three = 1;
                         if ($data["identity_equipment"] != "" or $data["identity_driver"] != "") {
                             $db->addVisualBookingStebthree($user_ip, $data);
                         }
                         Application_Form_FrmMessage::redirectUrl("/index/booking");
                     }
                 }
                 $row_equipment_price = $db->getProductAndServicesSelected($user_ip, 3);
                 $row_driver_price = $db->getProductAndServicesSelected($user_ip, 2);
             }
         }
     } else {
         if ($this->getRequest()->isPost()) {
             $post = $this->getRequest()->getPost();
             if (isset($post["search_vehicle"])) {
                 $row = $db->getAllAvailableVehicle($post);
                 if (!empty($row)) {
                     $session_booking = new Zend_Session_Namespace('booking');
                     $session_booking->step_one = 1;
                     $session_booking->user_ip = $post["public_ip"] . "-" . $post["ip_address"];
                     $user_ip = $session_booking->user_ip;
                     $db->addVisualBookingStepOne($post);
                     $data_first_step = $db->getFirstStepData($user_ip);
                     $row_driver = $db->getAvailableDriver($data_first_step);
                     $row_equipment = $db->getEquipment($data_first_step);
                     $row_vehicle = $db->getAllAvailableVehicle($data_first_step);
                     Application_Form_FrmMessage::redirectUrl("/index/booking");
                 } else {
                     $session_booking = new Zend_Session_Namespace('booking');
                     $session_booking->step_one = 0;
                 }
             }
         }
     }
     $this->view->user_session = $customer_user_session;
     $this->view->step_five = $step_five;
     $this->view->step_four = $step_four;
     $this->view->step_one = $step_one;
     $this->view->step_two = $step_two;
     $this->view->step_three = $step_three;
     $this->view->equipment_price = $row_equipment_price;
     $this->view->driver_price = $row_driver_price;
     $this->view->vehicle_price = $row_vehicle_price;
     $this->view->equipment = $row_equipment;
     $this->view->vehicle = $row_vehicle;
     $this->view->driver = $row_driver;
     $this->view->data_first_step = $data_first_step;
     $frmbooks = new Application_Form_FrmBooking();
     $frmbooking = $frmbooks->FromBooking();
     Application_Model_Decorator::removeAllDecorator($frmbooking);
     $this->view->frmbooking = $frmbooking;
 }
Exemplo n.º 3
0
 function createSessionBookingCityTour($data, $step = 1)
 {
     $this->clearSessionBYStep($step);
     $session_step = new Zend_Session_Namespace('bookcitytour');
     if ($step == 1) {
         $session_step->package_id = $data;
         $session_step->package_name = $this->getPackageCityTourById($data);
         $session_step->max_hour = $this->getMaxHourByPackageId($data);
         //to show max hour in front
         $session_step->step1 = 1;
         $session_step->step2 = 0;
         $session_step->step3 = 0;
         $session_step->step4 = 0;
         $session_step->point_step = 1;
     } elseif ($step == 2) {
         $session_step->point_step = 2;
         $data['return_date'] = $data['pickup_date'];
         $session_step->pickup_date = empty($data['pickup_date']) ? null : $data['pickup_date'];
         $session_step->pickup_time = empty($data['pickup_time']) ? null : $data['pickup_time'];
         $session_step->pickup_mins = empty($data['pickup_mins']) ? null : $data['pickup_mins'];
         $session_step->step2 = 1;
         $session_step->return_date = empty($data['return_date']) ? null : $data['return_date'];
         $session_step->return_time = empty($data['return_time']) ? null : $data['return_time'];
         $session_step->return_mins = empty($data['return_mins']) ? null : $data['return_mins'];
         $db = new Application_Model_DbTable_DbGlobal();
         $session_step->vehiclevaliable = $db->getAllAvailableVehicle($data);
     } elseif ($step == 3) {
         $session_step->point_step = 3;
         $session_step->step3 = 1;
         $session_step->vehicle_id = $data;
         //$data get parram store value only not array
         $session_step->price = $this->getPriceBYPackageandVehicle($data, $session_step->package_id);
         $db = new Application_Model_DbTable_DbGlobal();
         $array = array('pickup_date' => $session_step->pickup_date, 'return_date' => $session_step->pickup_date, 'return_time' => $session_step->pickup_time . ":" . $session_step->pickup_mins);
         $session_step->guideavaliable = $db->getAvailableDriver($array);
         $row = $db->geVehicleById($data);
         $session_step->vehicle_name = $row["make"] . " " . $row["model"] . " " . $row["sub_model"];
         $session_step->reff = $row["reffer"];
     } elseif ($step == 4) {
         $session_step->point_step = 4;
         $session_step->step4 = 1;
         if (!empty($data)) {
             //if select guide/
             $row = $this->getGuideNormalPrice($data);
             $guideprice = $row['c_normalprice'];
             $guidename = $row['first_name'] . '-' . $row['last_name'];
             $guide_id = $row["id"];
             //$session_step->guide_id =$guide_id;
         } else {
             $guideprice = 0;
             $guidename = 'None';
             $guide_id = 'None';
         }
         $session_step->guidename = $guidename;
         $session_step->guideprice = $guideprice;
         $session_step->guideid = $guide_id;
     } elseif ($step == 5) {
         $session_step->point_step = 5;
         $session_step->step5 = 1;
     } elseif ($step == 6) {
         $session_step->point_step = 6;
         $session_step->step6 = 1;
     }
     return true;
     // 		if(!empty($session_step_one->step2)){
     // 			$session_step_one->vehicle_id=$data['vehicle_id'];
     // 		}
     // 		$session_step_one->step2 = null;
     // 		$session_step_one->step3 = null;
 }