ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
12 abstract 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  foreach ($element['children'] as $child) {
45  if ($child['name'] == 'dataInputAssociation') {
46  $class_object->registerRequire('./Services/WorkflowEngine/classes/detectors/class.ilDataDetector.php');
47  $reference_name = $child['children'][0]['content'];
48  $code .= '
49  ' . $element_varname . '_inputDataDetector = new ilDataDetector(' . $element_varname . ');
50  ' . $element_varname . '_inputDataDetector->setVarName("' . $reference_name . '");
51  ' . $element_varname . '_inputDataDetector->setName(' . $element_varname . '_inputDataDetector);
52  ' . $element_varname . '->addDetector(' . $element_varname . '_inputDataDetector);
53  ';
54  }
55 
56  if ($child['name'] == 'dataOutputAssociation') {
57  $class_object->registerRequire('./Services/WorkflowEngine/classes/emitters/class.ilDataEmitter.php');
58  $reference_name = $child['children'][0]['content'];
59  // So we need a data emitter to the given
60  $code .= '
61  ' . $element_varname . '_outputDataEmitter = new ilDataEmitter(' . $element_varname . ');
62  ' . $element_varname . '_outputDataEmitter->setVarName("' . $reference_name . '");
63  ' . $element_varname . '_outputDataEmitter->setName(' . $element_varname . '_outputDataEmitter);
64  ' . $element_varname . '->addEmitter(' . $element_varname . '_outputDataEmitter);
65  ';
66  }
67  }
68  }
69 
70  return $code;
71  }
72 
78  public function getDataInputAssociationIdentifiers($element)
79  {
80  $retval = array();
81 
82  if (isset($element['children'])) {
83  foreach ($element['children'] as $child) {
84  if ($child['namespace'] == 'bpmn2' && $child['name'] == 'dataInputAssociation') {
85  foreach ($child['children'] as $reference) {
86  if ($reference['namespace'] == 'bpmn2' && $reference['name'] == 'sourceRef') {
87  $retval[] = $reference['content'];
88  }
89  }
90  }
91  }
92  }
93 
94  return $retval;
95  }
96 
102  public function getDataOutputAssociationIdentifiers($element)
103  {
104  $retval = array();
105 
106  if (isset($element['children'])) {
107  foreach ($element['children'] as $child) {
108  if ($child['namespace'] == 'bpmn2' && $child['name'] == 'dataOutputAssociation') {
109  foreach ($child['children'] as $reference) {
110  if ($reference['namespace'] == 'bpmn2' && $reference['name'] == 'targetRef') {
111  $retval[] = $reference['content'];
112  }
113  }
114  }
115  }
116  }
117 
118  return $retval;
119  }
120 }
getDataInputAssociationIdentifiers($element)
setBpmn2Array($bpmn2_array)
handleDataAssociations($element, $class_object, $element_varname)
$code
Definition: example_050.php:99
getDataOutputAssociationIdentifiers($element)
Class ilBaseElement.