/** Edit an institution * @access public * @return void */ public function editAction() { $form = new InstitutionForm(); $form->details->setLegend('Edit institution details: '); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $where = array(); $where[] = $this->_institutions->getAdapter()->quoteInto('id = ?', $this->getParam('id')); $this->_institutions->update($form->getValues(), $where); $this->getFlash()->addMessage($form->getValue('institution') . '\'s details updated.'); $this->redirect($this->_redirectUrl . 'institutions/'); } else { $form->populate($form->getValues()); } } else { // find id is expected in $params['id'] $id = (int) $this->_request->getParam('id', 0); if ($id > 0) { $this->view->inst = $this->_institutions->fetchRow('id=' . $id)->toArray(); $form->populate($this->_institutions->fetchRow('id=' . $id)->toArray()); } } }