ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilBaseElement.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12abstract class ilBaseElement
13{
15 protected $bpmn2_array;
16
20 public function getBpmn2Array()
21 {
22 return $this->bpmn2_array;
23 }
24
28 public function setBpmn2Array($bpmn2_array)
29 {
30 $this->bpmn2_array = $bpmn2_array;
31 }
32
40 public function handleDataAssociations($element, $class_object, $element_varname)
41 {
42 $code = '';
43 if(isset($element['children']) && count($element['children']))
44 {
45 foreach ($element['children'] as $child)
46 {
47 if($child['name'] == 'dataInputAssociation')
48 {
49 $class_object->registerRequire('./Services/WorkflowEngine/classes/detectors/class.ilDataDetector.php');
50 $reference_name = $child['children'][0]['content'];
51 $code .= '
52 '.$element_varname.'_inputDataDetector = new ilDataDetector('.$element_varname.');
53 '.$element_varname.'_inputDataDetector->setVarName("'.$reference_name.'");
54 '.$element_varname.'_inputDataDetector->setName('.$element_varname.'_inputDataDetector);
55 '.$element_varname.'->addDetector('.$element_varname.'_inputDataDetector);
56 ';
57 }
58
59 if($child['name'] == 'dataOutputAssociation')
60 {
61 $class_object->registerRequire('./Services/WorkflowEngine/classes/emitters/class.ilDataEmitter.php');
62 $reference_name = $child['children'][0]['content'];
63 // So we need a data emitter to the given
64 $code .= '
65 '.$element_varname.'_outputDataEmitter = new ilDataEmitter('.$element_varname.');
66 '.$element_varname.'_outputDataEmitter->setVarName("'.$reference_name.'");
67 '.$element_varname.'_outputDataEmitter->setName('.$element_varname.'_outputDataEmitter);
68 '.$element_varname.'->addEmitter('.$element_varname.'_outputDataEmitter);
69 ';
70 }
71 }
72 }
73
74 return $code;
75 }
76
82 public function getDataInputAssociationIdentifiers($element)
83 {
84 $retval = array();
85
86 if(isset($element['children']))
87 {
88 foreach($element['children'] as $child)
89 {
90 if($child['namespace'] == 'bpmn2' && $child['name'] == 'dataInputAssociation')
91 {
92 foreach($child['children'] as $reference)
93 {
94 if($reference['namespace'] == 'bpmn2' && $reference['name'] == 'sourceRef')
95 {
96 $retval[] = $reference['content'];
97 }
98 }
99 }
100 }
101 }
102
103 return $retval;
104 }
105
111 public function getDataOutputAssociationIdentifiers($element)
112 {
113 $retval = array();
114
115 if(isset($element['children']))
116 {
117 foreach($element['children'] as $child)
118 {
119 if($child['namespace'] == 'bpmn2' && $child['name'] == 'dataOutputAssociation')
120 {
121 foreach($child['children'] as $reference)
122 {
123 if($reference['namespace'] == 'bpmn2' && $reference['name'] == 'targetRef')
124 {
125 $retval[] = $reference['content'];
126 }
127 }
128 }
129 }
130 }
131
132 return $retval;
133 }
134}
An exception for terminatinating execution or to throw for unit testing.
Class ilBaseElement.
handleDataAssociations($element, $class_object, $element_varname)
getDataOutputAssociationIdentifiers($element)
setBpmn2Array($bpmn2_array)
getDataInputAssociationIdentifiers($element)
$code
Definition: example_050.php:99