/** Edit a reference type * @access public * @return void */ public function editrefAction() { if ($this->getParam('id', false)) { $form = new CoinClassForm(); $form->details->setLegend('Edit reference volume details'); $form->submit->setLabel('Submit changes'); $this->view->form = $form; if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $classes = new CoinClassifications(); $where = array(); $where[] = $classes->getAdapter()->quoteInto('id = ?', $this->getParam('id')); $classes->update($form->getValues(), $where); $this->getFlash()->addMessage('Reference volume details changed'); $this->redirect('/admin/numismatics/refs/'); } else { $this->getFlash()->addMessage($this->_formErrors); $form->populate($this->_request->getPost()); } } else { $id = (int) $this->_request->getParam('id', 0); if ($id > 0) { $classes = new CoinClassifications(); $class = $classes->fetchRow('id=' . $id); if (count($class)) { $form->populate($class->toArray()); } else { throw new Pas_Exception_Param($this->_nothingFound); } } } } else { throw new Pas_Exception_Param($this->_missingParameter, 500); } }