/** Edit a workflow stage */ public function editworkflowAction() { if ($this->_getParam((int) 'id', false)) { $form = new WorkflowForm(); $form->submit->setLabel(self::UPDATE); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $workflows = new Workflows(); $where = array(); $where[] = $workflows->getAdapter()->quoteInto('id = ?', (int) $this->_getParam('id')); $update = $workflows->update($form->getValues(), $where); $this->_flashMessenger->addMessage('Workflow updated'); $this->_redirect($this->_redirectUrl . 'workflows'); } else { $form->populate($form->getValues()); } } else { $id = (int) $this->_request->getParam('id', 0); if ($id > 0) { $workflows = new Workflows(); $workflow = $workflows->fetchRow('id=' . $id); if (count($workflow)) { $form->populate($workflow->toArray()); } else { throw new Pas_Exception_Param($this->_nothingFound); } } } } else { throw new Pas_Exception_Param($this->_missingParameter); } }