ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPluginNode Class Reference

PhpIncludeInspection More...

+ Inheritance diagram for ilPluginNode:
+ Collaboration diagram for ilPluginNode:

Public Member Functions

 __construct (ilWorkflow $context)
 Default constructor. More...
 
 activate ()
 Activates the node. More...
 
 deactivate ()
 Deactivates the node. More...
 
 trigger ($a_type, $a_params=null)
 Passes a trigger to attached detectors. More...
 
 checkTransitionPreconditions ()
 Checks, if the preconditions of the node to transit are met. More...
 
 attemptTransition ()
 Attempts to transit the node. More...
 
 executeTransition ()
 Executes the 'then'-transition of the node. More...
 
 addEmitter (ilEmitter $emitter, $else_emitter=false)
 Adds an emitter to one of the lists attached to the node. More...
 
 addActivity (ilActivity $activity, $else_activity=false)
 Adds an activity to one of the lists attached to the node. More...
 
 setEvaluationExpression ($a_expression)
 
 notifyDetectorSatisfaction (ilDetector $detector)
 This method is called by detectors, that just switched to being satisfied. More...
 
 getActivities ($else=false)
 Returns all currently set activites. More...
 
 getEmitters ($else=false)
 Returns all currently set emitters. More...
 
- Public Member Functions inherited from ilBaseNode
 addDetector (ilDetector $detector)
 Adds a detector to the list of detectors. More...
 
 getDetectors ()
 Returns all currently set detectors. More...
 
 addEmitter (ilEmitter $emitter)
 Adds an emitter to the list of emitters. More...
 
 getEmitters ()
 Returns all currently set emitters. More...
 
 addActivity (ilActivity $activity)
 Adds an activity to the list of activities. More...
 
 getActivities ()
 Returns all currently set activities. More...
 
 getContext ()
 Returns a reference to the parent workflow object. More...
 
 setName ($name)
 
 getName ()
 
 getRuntimeVars ()
 
 setRuntimeVars ($runtime_vars)
 
 getRuntimeVar ($name)
 
 setRuntimeVar ($name, $value)
 
 onActivate ()
 Method called on activation of the node. More...
 
 onDeactivate ()
 Method calles on deactivation of the node. More...
 
 isActive ()
 Returns the activation status of the node. More...
 
 attemptTransition ()
 
 checkTransitionPreconditions ()
 
 executeTransition ()
 
 activate ()
 
 deactivate ()
 
 notifyDetectorSatisfaction (ilDetector $detector)
 

Private Member Functions

 executeActivities ()
 Executes all 'then'-activities attached to the node. More...
 
 executeEmitters ()
 Executes all 'then'-emitters attached to the node. More...
 

Private Attributes

 $else_emitters
 
 $else_activities
 
 $evaluation_expression = "return null;"
 

Additional Inherited Members

- Protected Attributes inherited from ilBaseNode
 $context
 
 $detectors
 
 $emitters
 
 $activities
 
 $active = false
 
 $name
 
 $runtime_vars
 

Detailed Description

PhpIncludeInspection

Plugin node of the petri net based workflow engine.

The plugin node is a deciding node. It features a multiple set of emitters and activities.

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

/

Definition at line 18 of file class.ilPluginNode.php.

Constructor & Destructor Documentation

◆ __construct()

ilPluginNode::__construct ( ilWorkflow  $context)

Default constructor.

Parameters
ilWorkflow$contextReference to the parent workflow.

Definition at line 49 of file class.ilPluginNode.php.

References ilBaseNode\$context, and array.

50  {
51  $this->context = $context;
52  $this->detectors = array();
53  $this->emitters = array();
54  $this->else_emitters = array();
55  $this->activities = array();
56  $this->else_activities = array();
57  }
Create styles array
The data for the language used.

Member Function Documentation

◆ activate()

ilPluginNode::activate ( )

Activates the node.

Implements ilNode.

Definition at line 62 of file class.ilPluginNode.php.

References attemptTransition(), and ilBaseNode\onActivate().

63  {
64  $this->active = true;
65  foreach ($this->detectors as $detector) {
66  $detector->onActivate();
67  }
68  $this->onActivate();
69  $this->attemptTransition();
70  }
attemptTransition()
Attempts to transit the node.
onActivate()
Method called on activation of the node.
+ Here is the call graph for this function:

◆ addActivity()

ilPluginNode::addActivity ( ilActivity  $activity,
  $else_activity = false 
)

Adds an activity to one of the lists attached to the node.

Parameters
ilActivity$activity
boolean$else_activityTrue, if the activity should be an 'else'-activity.

Definition at line 213 of file class.ilPluginNode.php.

214  {
215  if (!$else_activity) {
216  $this->activities[] = $activity;
217  } else {
218  $this->else_activities[] = $activity;
219  }
220  }

◆ addEmitter()

ilPluginNode::addEmitter ( ilEmitter  $emitter,
  $else_emitter = false 
)

Adds an emitter to one of the lists attached to the node.

Parameters
ilEmitter$emitter
boolean$else_emitterTrue, if the emitter should be an 'else'-emitter.

Definition at line 198 of file class.ilPluginNode.php.

199  {
200  if (!$else_emitter) {
201  $this->emitters[] = $emitter;
202  } else {
203  $this->else_emitters[] = $emitter;
204  }
205  }

◆ attemptTransition()

ilPluginNode::attemptTransition ( )

Attempts to transit the node.

Basically, this checks for preconditions and transits, returning true or false if preconditions are not met, aka detectors are not fully satisfied.

Returns
boolean True, if transition succeeded.

Implements ilNode.

Definition at line 138 of file class.ilPluginNode.php.

References ilBaseNode\$detectors, and executeTransition().

Referenced by activate(), notifyDetectorSatisfaction(), and trigger().

139  {
140  // TODO Call Plugin here.
141  $eval_function = function ($detectors) {
142  return eval($this->evaluation_expression);
143  };
144 
145  if ($eval_function($this->detectors) === null) {
146  return false;
147  }
148 
149  if ($eval_function($this->detectors) === true) {
150  $this->executeTransition();
151  return true;
152  } else {
153  $this->executeElseTransition();
154  return true;
155  }
156  }
executeTransition()
Executes the 'then'-transition of the node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkTransitionPreconditions()

ilPluginNode::checkTransitionPreconditions ( )

Checks, if the preconditions of the node to transit are met.

Please note, that in a conditional node, this means the node can transit to one or another outcome. This method only returns false, if the return value of the method is neither true nor false.

Returns
boolean True, if node is ready to transit.

Implements ilNode.

Definition at line 112 of file class.ilPluginNode.php.

References ilBaseNode\$detectors.

113  {
114  // TODO Call Plugin here.
115  $eval_function = function ($detectors) {
116  return eval($this->evaluation_expression);
117  };
118 
119  if ($eval_function($this->detectors) === null) {
120  return false;
121  }
122 
123  if ($eval_function($this->detectors) === true) {
124  return true;
125  } else {
126  return true;
127  }
128  }

◆ deactivate()

ilPluginNode::deactivate ( )

Deactivates the node.

Implements ilNode.

Definition at line 75 of file class.ilPluginNode.php.

References ilBaseNode\onDeactivate().

Referenced by executeTransition().

76  {
77  $this->active = false;
78  foreach ($this->detectors as $detector) {
79  $detector->onDeactivate();
80  }
81  $this->onDeactivate();
82  }
onDeactivate()
Method calles on deactivation of the node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeActivities()

ilPluginNode::executeActivities ( )
private

Executes all 'then'-activities attached to the node.

Definition at line 161 of file class.ilPluginNode.php.

Referenced by executeTransition().

162  {
163  if (count($this->activities) != 0) {
164  foreach ($this->activities as $activity) {
165  $activity->execute();
166  }
167  }
168  }
+ Here is the caller graph for this function:

◆ executeEmitters()

ilPluginNode::executeEmitters ( )
private

Executes all 'then'-emitters attached to the node.

Definition at line 173 of file class.ilPluginNode.php.

Referenced by executeTransition().

174  {
175  if (count($this->emitters) != 0) {
176  foreach ($this->emitters as $emitter) {
177  $emitter->emit();
178  }
179  }
180  }
+ Here is the caller graph for this function:

◆ executeTransition()

ilPluginNode::executeTransition ( )

Executes the 'then'-transition of the node.

Implements ilNode.

Definition at line 185 of file class.ilPluginNode.php.

References deactivate(), executeActivities(), and executeEmitters().

Referenced by attemptTransition().

186  {
187  $this->deactivate();
188  $this->executeActivities();
189  $this->executeEmitters();
190  }
deactivate()
Deactivates the node.
executeActivities()
Executes all 'then'-activities attached to the node.
executeEmitters()
Executes all 'then'-emitters attached to the node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActivities()

ilPluginNode::getActivities (   $else = false)

Returns all currently set activites.

Parameters
boolean$elseTrue, if else activities should be returned.
Returns
Array Array with objects of ilActivity

Definition at line 285 of file class.ilPluginNode.php.

References ilBaseNode\$activities, and $else_activities.

286  {
287  if ($else) {
288  return $this->else_activities;
289  }
290  return $this->activities;
291  }

◆ getEmitters()

ilPluginNode::getEmitters (   $else = false)

Returns all currently set emitters.

Parameters
boolean$elseTrue, if else emitters should be returned.
Returns
Array Array with objects of ilEmitter

Definition at line 300 of file class.ilPluginNode.php.

References $else_emitters, and ilBaseNode\$emitters.

301  {
302  if ($else) {
303  return $this->else_emitters;
304  }
305  return $this->emitters;
306  }

◆ notifyDetectorSatisfaction()

ilPluginNode::notifyDetectorSatisfaction ( ilDetector  $detector)

This method is called by detectors, that just switched to being satisfied.

Parameters
ilDetector$detectorilDetector which is now satisfied.
Returns
mixed|void

Implements ilNode.

Definition at line 271 of file class.ilPluginNode.php.

References attemptTransition(), and ilBaseNode\isActive().

272  {
273  if ($this->isActive()) {
274  $this->attemptTransition();
275  }
276  }
attemptTransition()
Attempts to transit the node.
isActive()
Returns the activation status of the node.
+ Here is the call graph for this function:

◆ setEvaluationExpression()

ilPluginNode::setEvaluationExpression (   $a_expression)

Definition at line 258 of file class.ilPluginNode.php.

259  {
260  // TODO Rework to use a Plugin here.
261  $this->evaluation_expression = $a_expression;
262  }

◆ trigger()

ilPluginNode::trigger (   $a_type,
  $a_params = null 
)

Passes a trigger to attached detectors.

Deprecated:
Parameters
type$a_type
type$a_params

Definition at line 91 of file class.ilPluginNode.php.

References $a_type, and attemptTransition().

92  {
93  if ($this->active == true && count($this->detectors) != 0) {
94  foreach ($this->detectors as $detector) {
95  if (get_class($detector) == $a_type) {
96  $detector->trigger($a_params);
97  }
98  }
99  }
100  $this->attemptTransition();
101  }
attemptTransition()
Attempts to transit the node.
$a_type
Definition: workflow.php:92
+ Here is the call graph for this function:

Field Documentation

◆ $else_activities

ilPluginNode::$else_activities
private

Definition at line 34 of file class.ilPluginNode.php.

Referenced by getActivities().

◆ $else_emitters

ilPluginNode::$else_emitters
private

Definition at line 26 of file class.ilPluginNode.php.

Referenced by getEmitters().

◆ $evaluation_expression

ilPluginNode::$evaluation_expression = "return null;"
private

Definition at line 42 of file class.ilPluginNode.php.


The documentation for this class was generated from the following file: