oValidator->validateTemplate("ktcore/workflow/documentWorkflow"); $oDocument =& $this->oValidator->validateDocument($_REQUEST['fDocumentId']); $oWorkflow = KTWorkflowUtil::getWorkflowForDocument($oDocument); $oWorkflowState = KTWorkflowUtil::getWorkflowStateForDocument($oDocument); $oUser =& User::get($_SESSION['userID']); $aTransitions = KTWorkflowUtil::getTransitionsForDocumentUser($oDocument, $oUser); $aWorkflows = KTWorkflow::getList(); $aTemplateData = array( 'oDocument' => $oDocument, 'oWorkflow' => $oWorkflow, 'oState' => $oWorkflowState, 'aTransitions' => $aTransitions, 'aWorkflows' => $aWorkflows, ); return $oTemplate->render($aTemplateData); } function do_startWorkflow() { $oDocument =& $this->oValidator->validateDocument($_REQUEST['fDocumentId']); $oWorkflow =& $this->oValidator->validateWorkflow($_REQUEST['fWorkflowId']); $res = KTWorkflowUtil::startWorkflowOnDocument($oWorkflow, $oDocument); $this->successRedirectToMain('Workflow started', array('fDocumentId' => $oDocument->getId())); exit(0); } function do_performTransition() { $oDocument =& $this->oValidator->validateDocument($_REQUEST['fDocumentId']); $oTransition =& $this->oValidator->validateWorkflowTransition($_REQUEST['fTransitionId']); $sComments =& $this->oValidator->notEmpty($_REQUEST['fComments']); $oUser =& User::get($_SESSION['userID']); $res = KTWorkflowUtil::performTransitionOnDocument($oTransition, $oDocument, $oUser, $sComments); $this->successRedirectToMain('Transition performed', array('fDocumentId' => $oDocument->getId())); } } $oDispatcher = new DocumentWorkflowDispatcher; $oDispatcher->dispatch(); ?>