/** * @return void */ public function editAction() { $request = $this->getRequest(); $id = $this->_helper->IdConvert->hexToStr($request->getParam('id')); $form = new Logic_Ws_Service_SaveIP_Form_Generic(); if ($request->isPost()) { if ($form->isCancelled($this->getRequest()->getPost())) { $this->_helper->redirector('index', null, null); return; } if ($form->isValid($request->getPost())) { try { $this->_model->updateIP($form, $id); $this->_helper->messenger->success(); $this->_helper->redirector('index'); return; } catch (Logic_Ws_Exception $e) { $this->_helper->messenger->error($e->getMessage()); } } } else { $data = array(); try { $data = $this->_model->getIpWithClients(intval($id)); $row = new Row_WsSaveIP(); $ip = str_replace(array('{', '}', ','), array('', '', "\n"), $data['ip']); $data['ip'] = $ip; } catch (Zend_Db_Exception $e) { $this->_helper->messenger->error($e->getMessage()); $this->_helper->redirector('index'); return; } $form->setDefaults($data); } $this->view->form = $form; }