ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 170 of file class.ilWorkflowScaffold.php.

171 {
172 $this->registerRequire('./Services/WorkflowEngine/classes/workflows/class.ilBaseWorkflow.php');
173 $this->bpmn2_array = $bpmn2_array;
174 $this->auxilliary_methods = array();
175 }

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 165 of file class.ilWorkflowScaffold.php.

166 {
167 $this->auxilliary_methods[] = $auxilliary_method;
168 }

◆ getConstructorMethodContent()

ilWorkflowScaffold::getConstructorMethodContent ( )
Returns
mixed

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

References $constructor_method_content.

◆ getPHP()

ilWorkflowScaffold::getPHP ( )
Returns
string

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

197 {
198 $pre_constructor_content = $this->getRequires();
199 $pre_constructor_content .= "
200 class " . $this->workflow_name . " extends ilBaseWorkflow
201 {
202 " . $this->getStartEventInfo() . "
203 public function __construct()
204 {
205 ";
206
207 $post_constructor_content = "
208 }";
209 foreach($this->auxilliary_methods as $auxilliary_method)
210 {
211 $post_constructor_content .= "
212
213 " . $auxilliary_method . "
214 ";
215 }
216 $post_constructor_content .= "
217 }
218 ";
219
220 return $pre_constructor_content . $this->constructor_method_content . $post_constructor_content;
221 }

References getRequires(), and getStartEventInfo().

+ Here is the call graph for this function:

◆ getRequires()

ilWorkflowScaffold::getRequires ( )
Returns
string

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

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

References $requires.

Referenced by getPHP().

+ Here is the caller graph for this function:

◆ getStartEventInfo()

ilWorkflowScaffold::getStartEventInfo ( )
Returns
string

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

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

References $code, 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 228 of file class.ilWorkflowScaffold.php.

229 {
230 $content = '';
231 foreach((array)$this->bpmn2_array['children'] as $elements)
232 {
233 foreach((array)$elements['children'] as $element)
234 {
235 if ($element['name'] == 'startEvent' && @$element['children'][0]['name'] == 'timerEventDefinition')
236 {
237 $timer_element = $element['children'][0];
238 $content = $timer_element['children'][0]['content'];
239 }
240 }
241 }
242
243 $start = date('U',strtotime($content));
244 $end = 0;
245
246 return array(
247 'type' => 'time_passed',
248 'content' => 'time_passed',
249 'subject_type' => 'none',
250 'subject_id' => 0,
251 'context_type' => 'none',
252 'context_id' => 0,
253 'listening_start' => $start,
254 'listening_end' => $end
255 );
256 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())

References $start, and date.

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 65 of file class.ilWorkflowScaffold.php.

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

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 73 of file class.ilWorkflowScaffold.php.

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

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 81 of file class.ilWorkflowScaffold.php.

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

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 188 of file class.ilWorkflowScaffold.php.

189 {
190 $this->constructor_method_content = $constructor_method_content;
191 }

References $constructor_method_content.

◆ setWorkflowName()

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

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

158 {
159 $this->workflow_name = $workflow_name;
160 }

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 60 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: