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