31 $this->mass_action = (bool) $a_mass_action;
42 public function processEvent(
62 require_once
'./Services/WorkflowEngine/classes/utils/class.ilWorkflowDbHelper.php';
63 $workflows = ilWorkflowDbHelper::getDetectors(
72 if (count($workflows) != 0)
74 foreach ($workflows as $workflow_id)
76 $wf_instance = ilWorkflowDbHelper::wakeupWorkflow($workflow_id);
77 if($wf_instance == null)
82 $wf_instance->handleEvent(
92 ilWorkflowDbHelper::writeWorkflow($wf_instance);
102 public function handleEvent($component, $event, $parameter)
116 require_once
'./Services/WorkflowEngine/classes/extractors/class.ilExtractorFactory.php';
118 require_once
'./Services/WorkflowEngine/interfaces/ilExtractor.php';
124 $extracted_params = $extractor->extract($event, $parameter);
127 $mappers = json_decode($ilLocalSetting->get(
'custom_mapper',json_encode(
array())),
true);
128 foreach((
array)$mappers as $mapper)
130 if(!file_exists($mapper[
'location']))
135 include_once $mapper[
'location'];
136 if(!class_exists($mapper[
'class']))
141 $mapper_class = $mapper[
'class'];
142 $extracted_params = $mapper_class::mapParams($component, $event, $parameter, $extracted_params);
143 $component = $mapper_class::mapComponent($component, $event, $parameter, $extracted_params);
144 $event = $mapper_class::mapEvent($component, $event, $parameter, $extracted_params);
150 $extracted_params->getSubjectType(),
151 $extracted_params->getSubjectId(),
152 $extracted_params->getContextType(),
153 $extracted_params->getContextId()
156 $this->launchArmedWorkflows($component, $event, $extracted_params);
163 public function launchArmedWorkflows($component, $event, $extractedParams)
175 $workflows = ilWorkflowDbHelper::findApplicableWorkflows($component, $event, $extractedParams);
177 foreach($workflows as $workflow)
179 $data = ilWorkflowDbHelper::getStaticInputDataForEvent($workflow[
'event']);
182 require_once
'./Services/WorkflowEngine/classes/class.ilObjWorkflowEngine.php';
185 $class = substr($workflow[
'workflow'],4);
187 $workflow_instance =
new $class;
189 $workflow_instance->setWorkflowClass(
'wfd.'.$class.
'.php');
192 if(count($workflow_instance->getInputVars()))
194 foreach ($workflow_instance->getInputVars() as $input_var)
196 $workflow_instance->setInstanceVarById($input_var[
'name'],
$data[ $input_var[
'name'] ]);
200 $workflow_instance->setInstanceVarByRole($extractedParams->getContextType(), $extractedParams->getContextId());
201 $workflow_instance->setInstanceVarByRole($extractedParams->getSubjectType(), $extractedParams->getSubjectId());
203 require_once
'./Services/WorkflowEngine/classes/utils/class.ilWorkflowDbHelper.php';
204 ilWorkflowDbHelper::writeWorkflow( $workflow_instance );
206 $workflow_instance->startWorkflow();
207 $workflow_instance->handleEvent(
218 ilWorkflowDbHelper::writeWorkflow( $workflow_instance );
ilWorkflowEngine is part of the petri net based workflow engine.
static getRepositoryDir()
Create styles array
The data for the language used.
__construct($a_mass_action=false)
ilWorkflowEngine constructor.