ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilIntermediateCatchEventElement.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  if (count($element['children'])) {
31  foreach ($element['children'] as $child) {
32  if ($child['name'] == 'messageEventDefinition') {
34  $child['attributes']['messageRef'],
35  'message',
36  $this->bpmn2_array
37  );
38  }
39  if ($child['name'] == 'signalEventDefinition') {
41  $child['attributes']['signalRef'],
42  'signal',
43  $this->bpmn2_array
44  );
45  }
46  if ($child['name'] == 'timerEventDefinition') {
48  $child['attributes']['id'],
49  'intermediateCatchEvent',
50  $this->bpmn2_array
51  );
52  }
53  }
54  }
55 
56  $class_object->registerRequire('./Services/WorkflowEngine/classes/nodes/class.ilBasicNode.php');
57  $code .= '
58  ' . $this->element_varname . ' = new ilBasicNode($this);
59  $this->addNode(' . $this->element_varname . ');
60  ' . $this->element_varname . '->setName(\'' . $this->element_varname . '\');
61  ';
62 
63  if (is_array($event_definition)) {
64  $class_object->registerRequire('./Services/WorkflowEngine/classes/detectors/class.ilEventDetector.php');
65  $code .= '
66  ' . $this->element_varname . '_detector = new ilEventDetector(' . $this->element_varname . ');
67  ' . $this->element_varname . '_detector->setName(\'' . $this->element_varname . '_detector\');
68  ' . $this->element_varname . '_detector->setEvent( "' . $event_definition['type'] . '", "' . $event_definition['content'] . '");
69  ' . $this->element_varname . '_detector->setEventSubject( "' . $event_definition['subject_type'] . '", "' . $event_definition['subject_id'] . '");
70  ' . $this->element_varname . '_detector->setEventContext( "' . $event_definition['context_type'] . '", "' . $event_definition['context_id'] . '");
71  ';
72 
73  if (isset($event_definition['listening_start']) || isset($event_definition['listening_end'])) {
74  $code .= $this->element_varname . '_detector->setListeningTimeframe(' . (int) $event_definition['listening_start'] .
75  ', ' . (int) $event_definition['listening_end'] . ');';
76  } elseif (isset($event_definition['listening_relative']) && isset($event_definition['listening_interval'])) {
77  $code .= $this->element_varname . '_detector->setTimerRelative(true);';
78  $code .= $this->element_varname . '_detector->setTimerLimit(' . (int) $event_definition['listening_interval'] . ');';
79  }
80 
81  $code .= '
82  ' . $this->element_varname . '->addDetector(' . $this->element_varname . '_detector);
83  ';
84  }
85 
86  $code .= $this->handleDataAssociations($element, $class_object, $this->element_varname);
87 
88  return $code;
89  }
90 }
Class ilIntermediateCatchEventElement.
static extractILIASEventDefinitionFromProcess($start_event_ref, $type, $bpmn2_array)
getPHP($element, ilWorkflowScaffold $class_object)
Class ilWorkflowScaffold.
handleDataAssociations($element, $class_object, $element_varname)
$code
Definition: example_050.php:99
static extractTimeDateEventDefinitionFromElement($start_event_ref, $type, $bpmn2_array)
PhpIncludeInspection
Class ilBaseElement.
Class ilRuntime.