/** Edit a landuse */ public function editlanduseAction() { if ($this->_getParam('id', false)) { $form = new LanduseForm(); $form->details->setLegend('Edit landuse'); $form->submit->setLabel(self::UPDATE); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $landuses = new Landuses(); $where = array(); $where[] = $landuses->getAdapter()->quoteInto('id = ?', (int) $this->_getParam('id')); $update = $landuses->update($form->getValues(), $where); $this->_flashMessenger->addMessage('Active landuse information updated!'); $this->_redirect($this->_redirectUrl . 'landuses'); } else { $form->populate($form->getValues()); } } else { $id = (int) $this->_request->getParam('id', 0); if ($id > 0) { $landuses = new Landuses(); $landuse = $landuses->fetchRow('id=' . $id); if (count($landuse)) { $form->populate($landuse->toArray()); } else { throw new Pas_Exception_Param($this->_nothingFound); } } } } else { throw new Pas_Exception_Param($this->_missingParameter); } }