ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
85  $id = $this->var_name;
87  foreach($definitions as $definition)
88  {
89  if($definition['id'] == $name)
90  {
91  if($definition['reference'])
92  {
93  $id = $definition['target'];
94  }
95  $name = $definition['name'];
96  break;
97  }
98  }
99 
100  $this->getContext()->setRuntimeVar(
101  $name,
102  $this->getContext()->getContext()->getInstanceVarById($id)
103  );
104  $this->detection_state = true;
105 
106  return true;
107  }
108 
120  public function setDetectorState($new_state)
121  {
122  $this->detection_state = true;
123  $this->context->notifyDetectorSatisfaction($this);
124  }
125 
130  public function onActivate()
131  {
132  return;
133  }
134 
139  public function onDeactivate()
140  {
141  return;
142  }
143 
147  public function getActivated()
148  {
149  return $this->detection_state;
150  }
151 
155  public function setName($name)
156  {
157  $this->name = $name;
158  }
159 
163  public function getName()
164  {
165  return $this->name;
166  }
167 
171  public function getSourceNode()
172  {
173  return $this->source_node;
174  }
175 
179  public function setSourceNode($source_node)
180  {
181  $this->source_node = $source_node;
182  }
183 
187  public function getVarName()
188  {
189  return $this->var_name;
190  }
191 
195  public function setVarName($var_name)
196  {
197  $this->var_name = $var_name;
198  }
199 }
ilWorkflowEngineElement Interface is part of the petri net based workflow engine. ...
__construct(ilNode $context)
Default constructor.
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.
$params
Definition: example_049.php:96
setSourceNode($source_node)
setDetectorState($new_state)
Sets a new detector state.