Example #1
0
 public function infoEditAction()
 {
     $form = new Admin_Form_InformationForm();
     $form->submit->setLabel("Save");
     $infoModel = new Admin_Model_Booking();
     $bookingId = $this->_getParam('id', 0);
     $data = $infoModel->getDetailById($bookingId);
     $this->view->id = $bookingId;
     $form->populate($data);
     $this->view->form = $form;
     try {
         if ($this->getRequest()->isPost()) {
             if ($form->Valid($this->getRequest()->getPost())) {
                 $formData = $this->getRequest()->getPost();
                 $bookingId = $formData['booking_id'];
                 unset($formData['booking_id']);
                 unset($formData['submit']);
                 $infoModel->update($formData, $bookingId);
                 $this->_helper->FlashMessenger->addMessage(array("success" => "Successfully edited personal information"));
                 $this->_helper->redirector('payment', "index", "default", array("id" => $bookingId));
             }
         }
     } catch (Exception $e) {
         $this->_helper->FlashMessenger->addMessage(array("error" => $e->getMessage()));
     }
 }
Example #2
0
 public function infoAction()
 {
     $form = new Admin_Form_InformationForm();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             $session = Zend_Registry::get("defaultsession");
             $firstData = $session->first;
             $formData += $firstData;
             unset($formData['submit']);
             try {
                 $bookingModel = new Admin_Model_Booking();
                 $bookingId = $bookingModel->add($formData);
                 $this->_helper->FlashMessenger->addMessage(array("success" => "Successfully Booking Completed"));
                 $this->_helper->redirector('payment', "index", "default", array("id" => $bookingId));
             } catch (Exception $e) {
                 var_dump($e->getMessage());
                 $this->_helper->FlashMessenger->addMessage(array("error" => $e->getMessage()));
             }
         }
     }
 }