31 $this->mass_action = (bool) $a_mass_action;
42 public function processEvent(
54 if (0 ==
$ilSetting->get(
'wfe_activation', 0)) {
60 require_once
'./Services/WorkflowEngine/classes/utils/class.ilWorkflowDbHelper.php';
61 $workflows = ilWorkflowDbHelper::getDetectors(
70 if (count($workflows) != 0) {
71 foreach ($workflows as $workflow_id) {
72 $wf_instance = ilWorkflowDbHelper::wakeupWorkflow($workflow_id);
73 if ($wf_instance == null) {
77 $wf_instance->handleEvent(
87 ilWorkflowDbHelper::writeWorkflow($wf_instance);
97 public function handleEvent($component, $event, $parameter)
103 if (0 ==
$ilSetting->get(
'wfe_activation', 0)) {
110 require_once
'./Services/WorkflowEngine/classes/extractors/class.ilExtractorFactory.php';
112 require_once
'./Services/WorkflowEngine/interfaces/ilExtractor.php';
117 $extracted_params = $extractor->extract($event, $parameter);
120 $mappers = json_decode($ilLocalSetting->get(
'custom_mapper', json_encode(
array())),
true);
121 foreach ((
array) $mappers as $mapper) {
122 if (!file_exists($mapper[
'location'])) {
126 include_once $mapper[
'location'];
127 if (!class_exists($mapper[
'class'])) {
131 $mapper_class = $mapper[
'class'];
132 $extracted_params = $mapper_class::mapParams($component, $event, $parameter, $extracted_params);
133 $component = $mapper_class::mapComponent($component, $event, $parameter, $extracted_params);
134 $event = $mapper_class::mapEvent($component, $event, $parameter, $extracted_params);
140 $extracted_params->getSubjectType(),
141 $extracted_params->getSubjectId(),
142 $extracted_params->getContextType(),
143 $extracted_params->getContextId()
146 $this->launchArmedWorkflows($component, $event, $extracted_params);
153 public function launchArmedWorkflows($component, $event, $extractedParams)
159 if (0 ==
$ilSetting->get(
'wfe_activation', 0)) {
163 $workflows = ilWorkflowDbHelper::findApplicableWorkflows($component, $event, $extractedParams);
165 foreach ($workflows as $workflow) {
166 $data = ilWorkflowDbHelper::getStaticInputDataForEvent($workflow[
'event']);
169 require_once
'./Services/WorkflowEngine/classes/class.ilObjWorkflowEngine.php';
176 $class = substr($workflow[
'workflow'], 4);
178 $workflow_instance =
new $class;
180 $workflow_instance->setWorkflowClass(
'wfd.' . $class .
'.php');
183 if (count($workflow_instance->getInputVars())) {
184 foreach ($workflow_instance->getInputVars() as $input_var) {
185 $workflow_instance->setInstanceVarById($input_var[
'name'],
$data[ $input_var[
'name'] ]);
189 $workflow_instance->setInstanceVarByRole($extractedParams->getContextType(), $extractedParams->getContextId());
190 $workflow_instance->setInstanceVarByRole($extractedParams->getSubjectType(), $extractedParams->getSubjectId());
192 require_once
'./Services/WorkflowEngine/classes/utils/class.ilWorkflowDbHelper.php';
193 ilWorkflowDbHelper::writeWorkflow($workflow_instance);
195 $workflow_instance->startWorkflow();
196 $workflow_instance->handleEvent(
207 ilWorkflowDbHelper::writeWorkflow($workflow_instance);
static getRepositoryDir($relative=false)
ilWorkflowEngine is part of the petri net based workflow engine.
Create styles array
The data for the language used.
__construct($a_mass_action=false)
ilWorkflowEngine constructor.