/** Edit a denomination * @access public * @return void * @throws Pas_Exception_Param */ public function editdenominationAction() { if ($this->getParam('id', false)) { $form = new DenominationForm(); $form->submit->setLabel('Update details'); $this->view->form = $form; if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { $id = (int) $this->getParam('id'); $denominations = new Denominations(); $where = array(); $where[] = $denominations->getAdapter()->quoteInto('id = ?', (int) $id); $denominations->update($form->getValues(), $where); $this->getFlash()->addMessage('Denomination information updated!'); $this->redirect($this->_redirectUrl . 'denominations/period/' . (int) $form->getValue('period')); } else { $this->getFlash()->addMessage($this->_formErrors); $form->populate($this->_request->getPost()); } } else { $id = (int) $this->_request->getParam('id', 0); if ($id > 0) { $denominations = new Denominations(); $denomination = $denominations->fetchRow('id=' . $id); if (count($denomination)) { $form->populate($denomination->toArray()); } else { throw new Pas_Exception_Param($this->_nothingFound); } } } } else { throw new Pas_Exception_Param($this->_missingParameter, 500); } }