public function reviewAction() { // get params from session $tripID = $this->_getCustomerNS()->tripID; $seatCountYouWant = $this->_getCustomerNS()->seatCountYouWant; $selectedSeatNumbers = $this->_getCustomerNS()->selectedSeatNumbers; // get trip info $tripModel = new Customer_Model_Trip(); $trip = $tripModel->getTripInfo($tripID); if ($trip == null) { throw new Exception('You can\'t reach here'); } // prepare for "review" view $this->view->from_city = $trip['from_city']; $this->view->to_city = $trip['to_city']; $this->view->departure_time = $trip['departure_time']; $this->view->boarding_point = $trip['boarding_point']; $this->view->fare = $trip['fare']; $this->view->seatCountYouWant = $seatCountYouWant; $this->view->selectedSeatNumbers = $selectedSeatNumbers; // create captcha form $bookingFinishForm = new Customer_Form_BookingFinish(); $bookingFinishForm->setAction('/orders/review')->setMethod('post'); $fromCustomerEnterInfo = $this->_request->getParam('fromCustomerEnterInfo'); // check if previous page is customer/enter-info if ($fromCustomerEnterInfo) { // empty } else { if ($this->_request->isPost() && $bookingFinishForm->isValid($_POST)) { return $this->_forward('create', 'orders', 'customer'); } } $this->view->bookingFinishForm = $bookingFinishForm; }
public function listAction() { // get params $from = $this->_request->getParam('from', 'Hồ Chí Minh'); $to = $this->_request->getParam('to', 'Hà Nội'); $date = $this->_getParam('date', '01-08-2011'); // convert dd-MM-y to y-MM-dd to operate in MySQL $dateFormat = new Zend_Date($date, 'dd-MM-y'); $date = $dateFormat->toString('y-MM-dd'); // create paginator $tripModel = new Customer_Model_Trip(); $tripArray = $tripModel->getTripArray($from, $to, $date); if (count($tripArray) > 0) { $paginator = Zend_Paginator::factory($tripArray); $paginator->setItemCountPerPage(5); $page = $this->_request->getParam('page', 1); $paginator->setCurrentPageNumber($page); $this->view->paginator = $paginator; $this->view->column_count = count($tripArray[0]); } }
public function receiveCodeAction() { // get params from session $tripID = $this->_getCustomerNS()->tripID; $seatCountYouWant = $this->_getCustomerNS()->seatCountYouWant; $selectedSeatNumbers = $this->_getCustomerNS()->selectedSeatNumbers; $code = $this->_getCustomerNS()->code; // get trip info $tripModel = new Customer_Model_Trip(); $trip = $tripModel->getTripInfo($tripID); if ($trip == null) { throw new Exception('You can\'t reach here'); } // assign params to view $this->view->from_city = $trip['from_city']; $this->view->to_city = $trip['to_city']; $this->view->departure_time = $trip['departure_time']; $this->view->boarding_point = $trip['boarding_point']; $this->view->fare = $trip['fare']; $this->view->code = $code; $this->view->seatCountYouWant = $seatCountYouWant; $this->view->selectedSeatNumbers = $selectedSeatNumbers; }