ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilWorkflowScaffold Class Reference

Class ilWorkflowScaffold. More...

+ Collaboration diagram for ilWorkflowScaffold:

Public Member Functions

 registerRequire ($require)
 
 getRequires ()
 
 registerStartEventRef ($start_event_ref)
 
 registerStartSignalRef ($start_event_ref)
 
 registerStartTimerRef ($start_event_ref)
 
 getStartEventInfo ()
 
 setWorkflowName ($workflow_name)
 
 addAuxilliaryMethod ($auxilliary_method)
 
 __construct ($bpmn2_array)
 
 getConstructorMethodContent ()
 
 setConstructorMethodContent ($constructor_method_content)
 
 getPHP ()
 
 getTimeDateEventDefinition ($start_event_ref)
 

Data Fields

 $requires = array()
 
 $constructor_method_content
 
 $bpmn2_array
 
 $auxilliary_methods
 
 $workflow_name
 
 $start_event_refs
 

Detailed Description

Class ilWorkflowScaffold.

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

/

Definition at line 12 of file class.ilWorkflowScaffold.php.

Constructor & Destructor Documentation

◆ __construct()

ilWorkflowScaffold::__construct (   $bpmn2_array)

Definition at line 162 of file class.ilWorkflowScaffold.php.

163 {
164 $this->registerRequire('./Services/WorkflowEngine/classes/workflows/class.ilBaseWorkflow.php');
165 $this->bpmn2_array = $bpmn2_array;
166 $this->auxilliary_methods = array();
167 }

References $bpmn2_array, and registerRequire().

+ Here is the call graph for this function:

Member Function Documentation

◆ addAuxilliaryMethod()

ilWorkflowScaffold::addAuxilliaryMethod (   $auxilliary_method)
Parameters
string$auxilliary_method

Definition at line 157 of file class.ilWorkflowScaffold.php.

158 {
159 $this->auxilliary_methods[] = $auxilliary_method;
160 }

◆ getConstructorMethodContent()

ilWorkflowScaffold::getConstructorMethodContent ( )
Returns
mixed

Definition at line 172 of file class.ilWorkflowScaffold.php.

References $constructor_method_content.

◆ getPHP()

ilWorkflowScaffold::getPHP ( )
Returns
string

Definition at line 188 of file class.ilWorkflowScaffold.php.

189 {
190 $pre_constructor_content = $this->getRequires();
191 $pre_constructor_content .= "
192 class " . $this->workflow_name . " extends ilBaseWorkflow
193 {
194 " . $this->getStartEventInfo() . "
195 public function __construct()
196 {
197 ";
198
199 $post_constructor_content = "
200 }";
201 foreach ($this->auxilliary_methods as $auxilliary_method) {
202 $post_constructor_content .= "
203
204 " . $auxilliary_method . "
205 ";
206 }
207 $post_constructor_content .= "
208 }
209 ";
210
211 return $pre_constructor_content . $this->constructor_method_content . $post_constructor_content;
212 }

References getRequires(), and getStartEventInfo().

+ Here is the call graph for this function:

◆ getRequires()

ilWorkflowScaffold::getRequires ( )
Returns
string

Definition at line 44 of file class.ilWorkflowScaffold.php.

45 {
46 $requires = '';
47 foreach ($this->requires as $required_file) {
48 $requires .= "require_once '" . $required_file . "';\n";
49 }
50 return $requires;
51 }

References $requires.

Referenced by getPHP().

+ Here is the caller graph for this function:

◆ getStartEventInfo()

ilWorkflowScaffold::getStartEventInfo ( )
Returns
string

Definition at line 87 of file class.ilWorkflowScaffold.php.

88 {
89 $event_definitions = array();
90 foreach ((array) $this->start_event_refs as $start_event_ref) {
91 $event_definition = array();
92 switch ($start_event_ref['type']) {
93 case 'message':
95 $start_event_ref['ref'],
96 'message',
97 $this->bpmn2_array
98 );
99 break;
100 case 'signal':
102 $start_event_ref['ref'],
103 'signal',
104 $this->bpmn2_array
105 );
106 break;
107 case 'timeDate':
108 $event_definition = $this->getTimeDateEventDefinition($start_event_ref['ref']);
109 break;
110 }
111 $event_definitions[] = $event_definition;
112 }
113
114 if (count($event_definitions)) {
115 $code = '
116 public static $startEventRequired = true;
117 ' . "
118 public static function getStartEventInfo()
119 {";
120 foreach ($event_definitions as $event_definition) {
121 $code .= '
122 $events[] = ' . "array(
123 'type' => '" . $event_definition['type'] . "',
124 'content' => '" . $event_definition['content'] . "',
125 'subject_type' => '" . $event_definition['subject_type'] . "',
126 'subject_id' => '" . $event_definition['subject_id'] . "',
127 'context_type' => '" . $event_definition['context_type'] . "',
128 'context_id' => '" . $event_definition['context_id'] . "',
129 );
130 ";
131 }
132 $code .= '
133 return $events;
134 }
135 ';
136 return $code;
137 } else {
138 return '
139 public static $startEventRequired = false;
140 ';
141 }
142 }
static extractILIASEventDefinitionFromProcess($start_event_ref, $type, $bpmn2_array)
getTimeDateEventDefinition($start_event_ref)

References ilBPMN2ParserUtils\extractILIASEventDefinitionFromProcess(), and getTimeDateEventDefinition().

Referenced by getPHP().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTimeDateEventDefinition()

ilWorkflowScaffold::getTimeDateEventDefinition (   $start_event_ref)
Parameters
string$start_event_ref
Returns
array

Definition at line 219 of file class.ilWorkflowScaffold.php.

220 {
221 $content = '';
222 foreach ((array) $this->bpmn2_array['children'] as $elements) {
223 foreach ((array) $elements['children'] as $element) {
224 if ($element['name'] == 'startEvent' && @$element['children'][0]['name'] == 'timerEventDefinition') {
225 $timer_element = $element['children'][0];
226 $content = $timer_element['children'][0]['content'];
227 }
228 }
229 }
230
231 $start = date('U', strtotime($content));
232 $end = 0;
233
234 return array(
235 'type' => 'time_passed',
236 'content' => 'time_passed',
237 'subject_type' => 'none',
238 'subject_id' => 0,
239 'context_type' => 'none',
240 'context_id' => 0,
241 'listening_start' => $start,
242 'listening_end' => $end
243 );
244 }

Referenced by getStartEventInfo().

+ Here is the caller graph for this function:

◆ registerRequire()

◆ registerStartEventRef()

ilWorkflowScaffold::registerStartEventRef (   $start_event_ref)
Parameters
string$start_event_ref

Definition at line 63 of file class.ilWorkflowScaffold.php.

64 {
65 $this->start_event_refs[] = array('type' => 'message', 'ref' => $start_event_ref);
66 }

Referenced by ilStartEventElement\getPHP().

+ Here is the caller graph for this function:

◆ registerStartSignalRef()

ilWorkflowScaffold::registerStartSignalRef (   $start_event_ref)
Parameters
string$start_event_ref

Definition at line 71 of file class.ilWorkflowScaffold.php.

72 {
73 $this->start_event_refs[] = array('type' => 'signal', 'ref' => $start_event_ref);
74 }

Referenced by ilStartEventElement\getPHP().

+ Here is the caller graph for this function:

◆ registerStartTimerRef()

ilWorkflowScaffold::registerStartTimerRef (   $start_event_ref)
Parameters
string$start_event_ref

Definition at line 79 of file class.ilWorkflowScaffold.php.

80 {
81 $this->start_event_refs[] = array('type' => 'timeDate', 'ref' => $start_event_ref);
82 }

Referenced by ilStartEventElement\getPHP().

+ Here is the caller graph for this function:

◆ setConstructorMethodContent()

ilWorkflowScaffold::setConstructorMethodContent (   $constructor_method_content)
Parameters
mixed$constructor_method_content

Definition at line 180 of file class.ilWorkflowScaffold.php.

181 {
182 $this->constructor_method_content = $constructor_method_content;
183 }

References $constructor_method_content.

◆ setWorkflowName()

ilWorkflowScaffold::setWorkflowName (   $workflow_name)
Parameters
mixed$workflow_name

Definition at line 149 of file class.ilWorkflowScaffold.php.

150 {
151 $this->workflow_name = $workflow_name;
152 }

References $workflow_name.

Field Documentation

◆ $auxilliary_methods

array ilWorkflowScaffold::$auxilliary_methods

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

◆ $bpmn2_array

array ilWorkflowScaffold::$bpmn2_array

Definition at line 23 of file class.ilWorkflowScaffold.php.

Referenced by __construct().

◆ $constructor_method_content

string ilWorkflowScaffold::$constructor_method_content

◆ $requires

array ilWorkflowScaffold::$requires = array()

Definition at line 17 of file class.ilWorkflowScaffold.php.

Referenced by getRequires().

◆ $start_event_refs

array ilWorkflowScaffold::$start_event_refs

Definition at line 58 of file class.ilWorkflowScaffold.php.

◆ $workflow_name

string ilWorkflowScaffold::$workflow_name

Definition at line 29 of file class.ilWorkflowScaffold.php.

Referenced by setWorkflowName().


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