ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
97  if($instance_var['id'] == $this->var_name)
98  {
99  if($instance_var['reference'])
100  {
101  $target = $instance_var['target'];
102  }
103  }
104  }
105 
106  foreach((array)$this->context->getContext()->getInstanceVars() as $value)
107  {
108  if($value['id'] == $target)
109  {
110  $this->getContext()->getContext()->setInstanceVarById($target, $value['value']);
111  }
112  }
113 
114  if($this->target_detector instanceof ilDetector)
115  {
116  $this->target_detector->trigger(array());
117  }
118  $this->emitted = true;
119  }
120 
124  public function getActivated()
125  {
126  return $this->emitted;
127  }
128 
132  public function setName($name)
133  {
134  $this->name = $name;
135  }
136 
140  public function getName()
141  {
142  return $this->name;
143  }
144 
148  public function getVarName()
149  {
150  return $this->var_name;
151  }
152 
156  public function setVarName($var_name)
157  {
158  $this->var_name = $var_name;
159  }
160 }
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.
Create styles array
The data for the language used.
ilDetector Interface is part of the petri net based workflow engine.
Definition: ilDetector.php:16
PhpIncludeInspection
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