ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDataEmitter.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
5 require_once './Services/WorkflowEngine/interfaces/ilEmitter.php';
7 require_once './Services/WorkflowEngine/interfaces/ilDetector.php';
9 require_once './Services/WorkflowEngine/interfaces/ilNode.php';
11 require_once './Services/WorkflowEngine/interfaces/ilWorkflowEngineElement.php';
12 
22 {
29 
35  private $context;
36 
38  private $emitted;
39 
41  protected $name;
42 
44  protected $var_name;
45 
51  public function __construct(ilNode $context)
52  {
53  $this->context = $context;
54  $this->emitted = false;
55  }
56 
63  {
64  $this->target_detector = $target_detector;
65  }
66 
72  public function getTargetDetector()
73  {
75  }
76 
82  public function getContext()
83  {
84  return $this->context;
85  }
86 
90  public function emit()
91  {
92  $instance_vars = $this->context->getContext()->getInstanceVars();
93 
95  foreach ($instance_vars as $instance_var) {
96  if ($instance_var['id'] == $this->var_name) {
97  if ($instance_var['reference']) {
98  $target = $instance_var['target'];
99  }
100  }
101  }
102 
103  foreach ((array) $this->context->getContext()->getInstanceVars() as $value) {
104  if ($value['id'] == $target) {
105  $this->getContext()->getContext()->setInstanceVarById($target, $value['value']);
106  }
107  }
108 
109  if ($this->target_detector instanceof ilDetector) {
110  $this->target_detector->trigger(array());
111  }
112  $this->emitted = true;
113  }
114 
118  public function getActivated()
119  {
120  return $this->emitted;
121  }
122 
126  public function setName($name)
127  {
128  $this->name = $name;
129  }
130 
134  public function getName()
135  {
136  return $this->name;
137  }
138 
142  public function getVarName()
143  {
144  return $this->var_name;
145  }
146 
150  public function setVarName($var_name)
151  {
152  $this->var_name = $var_name;
153  }
154 }
ilWorkflowEngineElement Interface is part of the petri net based workflow engine. ...
__construct(ilNode $context)
Default constructor.
getContext()
Returns a reference to the parent node of this emitter.
emit()
Executes this emitter after activating the target node.
PhpIncludeInspection
Definition: ilNode.php:25
setTargetDetector(ilDetector $target_detector)
Sets the target detector for this emitter.
ilDetector Interface is part of the petri net based workflow engine.
Definition: ilDetector.php:16
PhpIncludeInspection
$target
Definition: test.php:19
getTargetDetector()
Gets the currently set target detector of this emitter.
ilEmitter Interface is part of the petri net based workflow engine.
Definition: ilEmitter.php:16