ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilEndEventElement.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_id;
28
29 $event_definition = null;
30
31 $terminate = false;
32
33 if (count($element['children'])) {
34 foreach ($element['children'] as $child) {
35 if ($child['name'] == 'messageEventDefinition') {
37 $child['attributes']['messageRef'],
38 'message',
39 $this->bpmn2_array
40 );
41 }
42 if ($child['name'] == 'signalEventDefinition') {
44 $child['attributes']['signalRef'],
45 'signal',
46 $this->bpmn2_array
47 );
48 }
49 if ($child['name'] == 'terminateEventDefinition') {
50 $terminate = true;
51 }
52 }
53 }
54
55 $class_object->registerRequire('./Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php');
56 $code .= '
57 ' . $this->element_varname . ' = new ilBasicNode($this);
58 $this->addNode(' . $this->element_varname . ');
59 ' . $this->element_varname . '->setName(\'' . $this->element_varname . '\');
60 ';
61
62 if (isset($event_definition['type']) && isset($event_definition['content'])) {
63 $class_object->registerRequire('./Services/WorkflowEngine/classes/activities/class.ilEventRaisingActivity.php');
64 $code .= '
65 ' . $this->element_varname . '_throwEventActivity = new ilEventRaisingActivity(' . $this->element_varname . ');
66 ' . $this->element_varname . '_throwEventActivity->setName(\'' . $this->element_varname . '_throwEventActivity\');
67 ' . $this->element_varname . '_throwEventActivity->setEventType("' . $event_definition['type'] . '");
68 ' . $this->element_varname . '_throwEventActivity->setEventName("' . $event_definition['content'] . '");
69 ' . $this->element_varname . '->addActivity(' . $this->element_varname . '_throwEventActivity);
70 ';
71 }
72
73 if ($terminate) {
74 $class_object->registerRequire('./Services/WorkflowEngine/classes/activities/class.ilStopWorkflowActivity.php');
75 $code .= '
76 ' . $this->element_varname . '_terminationEventActivity = new ilStopWorkflowActivity(' . $this->element_varname . ');
77 ' . $this->element_varname . '->addActivity(' . $this->element_varname . '_terminationEventActivity);
78 ';
79 }
80
81 $code .= $this->handleDataAssociations($element, $class_object, $this->element_varname);
82
83 return $code;
84 }
85}
An exception for terminatinating execution or to throw for unit testing.
static extractILIASEventDefinitionFromProcess($start_event_ref, $type, $bpmn2_array)
Class ilBaseElement.
handleDataAssociations($element, $class_object, $element_varname)
Class ilEndEventElement.
getPHP($element, ilWorkflowScaffold $class_object)
@noinspection PhpIncludeInspection
Class ilWorkflowScaffold.
$code
Definition: example_050.php:99
Class ilCertificateAppEventListener.