/**
* Create or Edit a WorklistDefinition.
*
* @param null $id
*
* @throws CHttpException
*/
public function actionDefinitionUpdate($id = null)
{
$definition = $this->manager->getWorklistDefinition($id);
if (!$definition) {
throw new CHttpException(404, 'Worklist definition could not be ' . ($id ? 'found' : 'created'));
}
if (!$this->manager->canUpdateWorklistDefinition($definition)) {
throw new CHttpException(409, 'Cannot change mappings for un-editable Definition');
}
if (isset($_POST['WorklistDefinition'])) {
$definition->attributes = $_POST['WorklistDefinition'];
if (!$this->manager->saveWorklistDefinition($definition)) {
$errors = $definition->getErrors();
} else {
$this->flashMessage('success', 'Worklist Definition saved');
return $this->redirect(array('/worklistAdmin/definitions'));
}
}
$this->render('//admin/worklists/definition_edit', array('definition' => $definition, 'errors' => @$errors));
}