Example #1
0
 /**
  * @return void
  */
 public function editAction()
 {
     $request = $this->getRequest();
     $id = $this->_helper->IdConvert->hexToStr($request->getParam('id'));
     $form = new Logic_Ws_Client_Form_Generic(null, 0, true);
     if ($request->isPost()) {
         if ($form->isCancelled($this->getRequest()->getPost())) {
             $this->_helper->redirector('index', null, null);
             return;
         }
         if ($form->isValid($request->getPost())) {
             try {
                 $this->_model->updateClient($id, $form);
                 $this->_helper->messenger->success();
                 $this->_helper->redirector('index');
                 return;
             } catch (Zend_Db_Exception $e) {
                 $this->_helper->messenger->error();
             }
         }
     } else {
         $data = array();
         try {
             $data = $this->_model->getClientWithIP($id);
         } catch (Zend_Db_Exception $e) {
             $this->_helper->messenger->error();
             $this->_helper->redirector('index');
             return;
         }
         $form->setDefaults($data);
     }
     $this->view->form = $form;
 }