public function editAction() { $request = $this->getRequest(); $id = $request->getParam('id'); if ($id === null) { $this->addErrorMessage($this->tr->_('ACTION_MISSING_ID')); return; } $form = new Default_Form_Error; $model = new Default_Model_Error; if ($request->isPost()) { if ($form->isValid($request->getPost())) { // Save data $model->update($form->getValues(), $id); $model->refreshAPCCache(); $this->addMessage(sprintf($this->tr->_('ERROR_UPDATE_SUCCESS'), $request->getParam('name'))); $this->_redirect('/errors/edit/id/' . $id); } } else { $data = $model->get($id); $form->populate($data); } $this->view->form = $form; }
public function editAction() { $request = $this->getRequest(); $id = $request->getParam('id'); if ($id === null) { $this->addErrorMessage('ID parameter is missing.'); return; } $form = new Default_Form_Error(); $model = new Default_Model_Error(); if ($request->isPost()) { if ($form->isValid($request->getPost())) { // Save data $model->update($form->getValues(), $id); $model->refreshAPCCache(); $this->addMessage('Error code ' . $request->getParam('name') . ' updated.'); $this->_redirect('/errors/edit/id/' . $id); } } else { $data = $model->get($id); $form->populate($data); } $this->view->form = $form; }