Exemplo n.º 1
0
 public function paymentAction()
 {
     try {
         $config = new Zend_Config_Ini(BASE_PATH . DIRECTORY_SEPARATOR . "configs" . DIRECTORY_SEPARATOR . "class.ini", "production");
         $this->view->payment = $config->payment->toArray();
         $bookingId = $this->_getParam("id");
         $bookingModel = new Admin_Model_Booking();
         $this->view->data = $bookingModel->getDetailById($bookingId);
         $this->view->extras = $bookingModel->getExtras($bookingId);
         $this->view->callbackUrl = 'http://rent.4x4offroads.com/dev/index/success';
     } catch (Exception $e) {
         //  var_dump($e->getMessage());
         $this->_helper->FlashMessenger->addMessage(array("error" => $e->getMessage()));
     }
 }
Exemplo n.º 2
0
 public function editBookingAction()
 {
     $form = new Admin_Form_BookingForm();
     $form->submit->setLabel("Save");
     $extraModel = new Admin_Model_Extra();
     $extras = $extraModel->getAll();
     $this->view->extra = $extras;
     $bookingModel = new Admin_Model_Booking();
     $bookingId = $this->_getParam('id', 0);
     if ($bookingId) {
         $data = $bookingModel->getDetailById($bookingId);
         $this->view->data = $data;
         $extrabookingModel = new Admin_Model_Extrabooking();
         $postData = $extrabookingModel->getAllbyBookingId($bookingId);
     } else {
         //needs to set index as action $form->setAction("index action");
         $session = Zend_Registry::get("defaultsession");
         $data = $session->first;
         $this->view->data = $data;
         $postData = array();
         if (array_key_exists("extra_id", $data)) {
             foreach ($data['extra_id'] as $key => $val) {
                 $postData[] = $key;
             }
         }
     }
     $form->populate($data);
     $this->view->form = $form;
     try {
         if ($this->getRequest()->isPost()) {
             $formData = $this->getRequest()->getPost();
             if ($form->isValid($formData)) {
                 unset($formData['submit']);
                 $bookingModel->update($formData, $bookingId);
                 $this->_helper->FlashMessenger->addMessage(array("success" => "Successfully edited booking information"));
                 $this->_helper->redirector('info-edit', "index", "default", array("id" => $bookingId));
             }
             if (array_key_exists("extra_id", $formData)) {
                 $extraIds = array();
                 foreach ($formData['extra_id'] as $key => $val) {
                     $extraIds[] = $key;
                 }
                 $postData = $extraIds;
             }
             $this->view->formData = $formData;
         }
         $this->view->postData = $postData;
     } catch (Exception $e) {
         $this->_helper->FlashMessenger->addMessage(array("error" => $e->getMessage()));
     }
 }