/** Edit a research project * @access public * @return void * @uses ResearchForm * @throws Pas_Exception_Param */ public function editAction() { if ($this->getParam('id', false)) { $form = new ResearchForm(); $form->submit->setLabel('Submit changes to project'); $this->view->form = $form; if ($this->getRequest()->isPost()) { if ($form->isValid($this->_request->getPost())) { $where = $this->_research->getAdapter()->quoteInto('id = ?', $this->getParam('id')); $this->_research->update($form->getValues(), $where); $this->getFlash()->addMessage('Research project details updated.'); $this->redirect(self::REDIRECT); } else { $form->populate($form->getValues()); } } else { $form->populate($this->_research->fetchRow('id=' . $this->_request->getParam('id'))->toArray()); } } else { throw new Pas_Exception_Param($this->_missingParameter, 500); } }
public function deleteprojectAction() { if ($this->_getParam('id', false)) { $projects = new ResearchProjects(); $where = $projects->getAdapter()->quoteInto('id = ?', (int) $this->_getParam('id')); $projects->delete($where); } else { throw new Exception('There is no research project ID specified', 500); } }
/** Delete a project * @access public * @return mixed * @throws Pas_Exception_Param */ public function deleteprojectAction() { if ($this->getParam('id', false)) { $projects = new ResearchProjects(); $where = $projects->getAdapter()->quoteInto('id = ?', (int) $this->getParam('id')); $projects->delete($where); } else { throw new Pas_Exception_Param($this->_missingParameter, 404); } }