/** Edit a mint * @access public * @return void * @throws Pas_Exception_Param */ public function editmintAction() { if ($this->getParam('id', false)) { $form = new MintForm(); $form->submit->setLabel('Update details on database'); $this->view->form = $form; if ($this->_request->isPost()) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $mints = new Mints(); $where = array(); $where[] = $mints->getAdapter()->quoteInto('id = ?', (int) $this->getParam('id')); $mints->update($form->getValues(), $where); $this->getFlash()->addMessage('Active mint information updated!'); $this->redirect($this->_redirectUrl . 'mints/period/' . $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) { $mints = new Mints(); $mint = $mints->fetchRow('id=' . $id); if (count($mint)) { $form->populate($mint->toArray()); } else { throw new Pas_Exception_Param($this->_nothingFound); } } } } else { throw new Pas_Exception_Param($this->_missingParameter, 500); } }