예제 #1
0
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $i = 0;
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = $this->getForm("/admin/payments/process");
     $request = $this->getRequest();
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/payments/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/payments/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('list', 'payments', 'admin');
     }
     if ($form->isValid($request->getPost())) {
         // Get the id
         $id = $this->getRequest()->getParam('payment_id');
         // Set the new values
         if (is_numeric($id)) {
             $this->payments = Payments::getbyId($id);
         }
         // Get the values posted
         $params = $form->getValues();
         try {
             $id = Payments::saveData($params);
             $this->_helper->redirector('edit', 'payments', 'admin', array('id' => $id, 'mex' => 'The task requested has been executed successfully.', 'status' => 'success'));
         } catch (Exception $e) {
             $this->_helper->redirector('edit', 'payments', 'admin', array('id' => $id, 'mex' => $this->translator->translate('Unable to process the request at this time.') . ": " . $e->getMessage(), 'status' => 'danger'));
         }
         $redirector->gotoUrl("/admin/payments/edit/id/{$id}");
     } else {
         $this->view->form = $form;
         $this->view->title = $this->translator->translate("Payment Transaction Edit");
         $this->view->description = $this->translator->translate("Edit the Payment Transaction information");
         return $this->render('applicantform');
     }
 }