ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilSendTaskElement.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3
13{
16
23 public function getPHP($element, ilWorkflowScaffold $class_object)
24 {
25 $code = "";
26 $element_id = ilBPMN2ParserUtils::xsIDToPHPVarname($element['attributes']['id']);
27 $this->element_varname = '$_v_'.$element['attributes']['id'];
28 $event_definition = null;
29 if(count($element['children']))
30 {
31 foreach ($element['children'] as $child)
32 {
33 if($child['name'] == 'messageEventDefinition')
34 {
35 $event_definition = ilBPMN2ParserUtils::extractILIASEventDefinitionFromProcess($child['attributes']['messageRef'], 'message', $this->bpmn2_array);
36 }
37 if($child['name'] == 'signalEventDefinition')
38 {
39 $event_definition = ilBPMN2ParserUtils::extractILIASEventDefinitionFromProcess($child['attributes']['signalRef'], 'signal', $this->bpmn2_array);
40 }
41 }
42 }
43
44 $message_element = false;
45 if(isset($element['attributes']['ilias:message']))
46 {
47 $message_element = $element['attributes']['ilias:message'];
48 }
49
50 $class_object->registerRequire('./Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php');
51 $code .= '
52 ' . $this->element_varname . ' = new ilBasicNode($this);
53 $this->addNode(' . $this->element_varname . ');
54 ' . $this->element_varname . '->setName(\'' . $this->element_varname . '\');
55 ';
56
57 if(isset($event_definition['type']) && isset($event_definition['content']))
58 {
59 $class_object->registerRequire('./Services/WorkflowEngine/classes/activities/class.ilEventRaisingActivity.php');
60 $code .= '
61 ' . $this->element_varname . '_sendTaskActivity = new ilEventRaisingActivity(' . $this->element_varname . ');
62 ' . $this->element_varname . '_sendTaskActivity->setName(\'' . $this->element_varname . '_sendTaskActivity\');
63 ' . $this->element_varname . '_sendTaskActivity->setEventType("'.$event_definition['type'].'");
64 ' . $this->element_varname . '_sendTaskActivity->setEventName("'.$event_definition['content'].'");
65 ' . $this->element_varname . '->addActivity(' . $this->element_varname . '_sendTaskActivity);
66 ';
67 }
68
69 if(isset($element['attributes']['message']))
70 {
71 $data_inputs = $this->getDataInputAssociationIdentifiers($element);
72 $task_parameters = '';
73 $message_name = $element['attributes']['message'];
74 if(substr($message_name,0, 6) == 'ilias:')
75 {
76 $message_name = substr($message_name,6);
77 }
78 if(count($data_inputs))
79 {
80 $task_parameters = '"'.implode('","', $data_inputs).'"';
81 }
82
83 $class_object->registerRequire('./Services/WorkflowEngine/classes/activities/class.ilSendMailActivity.php');
84 $code .= '
85 ' . $this->element_varname . '_sendTaskActivity = new ilSendMailActivity(' . $this->element_varname . ');
86 ' . $this->element_varname . '_sendTaskActivity->setMessageName(\'' . $message_name . '\');
87 ' . $this->element_varname . '_sendTaskActivity_params = array(' . $task_parameters . ');
88 ' . $this->element_varname . '_sendTaskActivity->setParameters(' . $this->element_varname . '_sendTaskActivity_params);
89 ' . $this->element_varname . '->addActivity(' . $this->element_varname . '_sendTaskActivity);
90 ';
91 }
92
93 $code .= $this->handleDataAssociations($element, $class_object, $this->element_varname);
94
95 return $code;
96 }
97}
An exception for terminatinating execution or to throw for unit testing.
static extractILIASEventDefinitionFromProcess($start_event_ref, $type, $bpmn2_array)
Class ilBaseElement.
getDataInputAssociationIdentifiers($element)
@noinspection PhpIncludeInspection
Class ilSendTaskElement.
getPHP($element, ilWorkflowScaffold $class_object)
Class ilWorkflowScaffold.
$code
Definition: example_050.php:99
Class ilRuntime.