ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDataDetector.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
5 require_once './Services/WorkflowEngine/interfaces/ilDetector.php';
7 require_once './Services/WorkflowEngine/interfaces/ilWorkflowEngineElement.php';
8 
18 {
24  private $context;
25 
31  private $detection_state = false;
32 
34  protected $name;
35 
37  protected $source_node;
38 
40  protected $var_name;
41 
47  public function __construct(ilNode $context)
48  {
49  $this->context = $context;
50  }
51 
56  public function getContext()
57  {
58  return $this->context;
59  }
60 
71  public function trigger($params)
72  {
73  return true;
74  }
75 
81  public function getDetectorState()
82  {
83  $definitions = $this->getContext()->getContext()->getInstanceVars();
84 
87  foreach ($definitions as $definition) {
88  if ($definition['id'] == $name) {
89  if ($definition['reference']) {
90  $id = $definition['target'];
91  }
92  $name = $definition['name'];
93  break;
94  }
95  }
96 
97  $this->getContext()->setRuntimeVar(
98  $name,
99  $this->getContext()->getContext()->getInstanceVarById($id)
100  );
101  $this->detection_state = true;
102 
103  return true;
104  }
105 
117  public function setDetectorState($new_state)
118  {
119  $this->detection_state = true;
120  $this->context->notifyDetectorSatisfaction($this);
121  }
122 
127  public function onActivate()
128  {
129  return;
130  }
131 
136  public function onDeactivate()
137  {
138  return;
139  }
140 
144  public function getActivated()
145  {
146  return $this->detection_state;
147  }
148 
152  public function setName($name)
153  {
154  $this->name = $name;
155  }
156 
160  public function getName()
161  {
162  return $this->name;
163  }
164 
168  public function getSourceNode()
169  {
170  return $this->source_node;
171  }
172 
176  public function setSourceNode($source_node)
177  {
178  $this->source_node = $source_node;
179  }
180 
184  public function getVarName()
185  {
186  return $this->var_name;
187  }
188 
192  public function setVarName($var_name)
193  {
194  $this->var_name = $var_name;
195  }
196 }
ilWorkflowEngineElement Interface is part of the petri net based workflow engine. ...
__construct(ilNode $context)
Default constructor.
if(!array_key_exists('StateId', $_REQUEST)) $id
PhpIncludeInspection
trigger($params)
Trigger this detector.
onDeactivate()
Method is called, when the parent node is deactivated.
PhpIncludeInspection
Definition: ilNode.php:25
getDetectorState()
Returns if the current detector state is satisfied or not.
onActivate()
Method is called, when the parent node is activated.
ilDetector Interface is part of the petri net based workflow engine.
Definition: ilDetector.php:16
getContext()
Returns the parent object.
setSourceNode($source_node)
setDetectorState($new_state)
Sets a new detector state.