ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilBPMN2ParserUtils Class Reference

Class ilBPMN2ParserUtils. More...

+ Collaboration diagram for ilBPMN2ParserUtils:

Public Member Functions

 load_string ($xml_string)
 

Static Public Member Functions

static xsIDToPHPVarname ($xsID)
 
static extractILIASEventDefinitionFromProcess ($start_event_ref, $type, $bpmn2_array)
 
static extractTimeDateEventDefinitionFromElement ($start_event_ref, $type, $bpmn2_array)
 
static extractILIASLibraryCallDefinitionFromElement ($element)
 
static extractScriptDefinitionFromElement ($element)
 
static extractDataNamingFromElement ($element)
 
static extractILIASInputPropertiesFromElement ($element)
 
static extractILIASDataObjectDefinitionFromElement ($element)
 
static extractILIASMessageDefinitionFromElement ($element)
 

Private Member Functions

 add_node ($node, &$parent=null, $namespace='', $recursive=false)
 

Detailed Description

Class ilBPMN2ParserUtils.

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

/

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

Member Function Documentation

◆ add_node()

ilBPMN2ParserUtils::add_node (   $node,
$parent = null,
  $namespace = '',
  $recursive = false 
)
private
Parameters
$node
null$parent
string$namespace
bool$recursive
Returns
mixed

Definition at line 36 of file class.ilBPMN2ParserUtils.php.

References $namespace, and $r.

Referenced by load_string().

37  {
38  $namespaces = $node->getNameSpaces(true);
39  $content="$node";
40 
41  $r['name']=$node->getName();
42  if (!$recursive)
43  {
44  $tmp=array_keys($node->getNameSpaces(false));
45  $r['namespace']=$tmp[0];
46  $r['namespaces']=$namespaces;
47  }
48  if ($namespace) $r['namespace']=$namespace;
49  if ($content) $r['content']=$content;
50 
51  foreach ($namespaces as $pre=>$ns)
52  {
53  foreach ($node->children($ns) as $k=>$v)
54  {
55  $this->add_node($v, $r['children'], $pre, true);
56  }
57  foreach ($node->attributes($ns) as $k=>$v)
58  {
59  $r['attributes'][$k]="$pre:$v";
60  }
61  }
62 
63  foreach ($node->children() as $k=>$v)
64  {
65  $this->add_node($v, $r['children'], '', true);
66  }
67 
68  foreach ($node->attributes() as $k=>$v)
69  {
70  $r['attributes'][$k]="$v";
71  }
72 
73  $parent[]=&$r;
74 
75  return $parent[0];
76  }
if($err=$client->getError()) $namespace
$r
Definition: example_031.php:79
add_node($node, &$parent=null, $namespace='', $recursive=false)
+ Here is the caller graph for this function:

◆ extractDataNamingFromElement()

static ilBPMN2ParserUtils::extractDataNamingFromElement (   $element)
static
Parameters
array$element
Returns
null

Definition at line 297 of file class.ilBPMN2ParserUtils.php.

Referenced by ilDataInputElement\getPHP(), ilDataOutputElement\getPHP(), ilDataObjectReferenceElement\getPHP(), and ilDataObjectElement\getPHP().

298  {
299  if(!isset($element['children']))
300  {
301  return null;
302  }
303 
304  foreach($element['children'] as $child)
305  {
306  if($child['name'] == 'extensionElements')
307  {
308  foreach($child['children'] as $extension)
309  {
310  $prefix = 'ilias:';
311  if($extension['children'][0]['namespace'] == 'ilias')
312  {
313  $prefix = '';
314  }
315  if($extension['name'] == $prefix.'properties')
316  {
317  if($extension['children'][0]['name'] == $prefix.'property')
318  {
319  $attributes = $extension['children'][0]['attributes'];
320  return $attributes['value'];
321  break;
322  }
323  }
324  }
325  }
326  }
327 
328  return null;
329  }
+ Here is the caller graph for this function:

◆ extractILIASDataObjectDefinitionFromElement()

static ilBPMN2ParserUtils::extractILIASDataObjectDefinitionFromElement (   $element)
static
Parameters
array$element
Returns
null|array

Definition at line 376 of file class.ilBPMN2ParserUtils.php.

References array.

Referenced by ilDataInputElement\getPHP(), and ilDataObjectElement\getPHP().

377  {
378  if(!isset($element['children']))
379  {
380  return null;
381  }
382 
383  $retval = null;
384  foreach((array)$element['children'] as $child)
385  {
386  if($child['name'] == 'extensionElements')
387  {
388  foreach($child['children'] as $extension)
389  {
390  $prefix = 'ilias:';
391  if($extension['children'][0]['namespace'] == 'ilias')
392  {
393  $prefix = '';
394  }
395  if($extension['name'] == $prefix.'properties')
396  {
397  foreach((array)$extension['children'] as $child)
398  {
399  if($child['name'] == 'dataobject')
400  {
401  $retval['role'] = $child['attributes']['role'];
402  $retval['type'] = $child['attributes']['type'];
403  }
404  }
405  }
406  }
407  }
408  }
409  return $retval;
410  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ extractILIASEventDefinitionFromProcess()

static ilBPMN2ParserUtils::extractILIASEventDefinitionFromProcess (   $start_event_ref,
  $type,
  $bpmn2_array 
)
static
Parameters
srting$start_event_ref
string$type
array$bpmn2_array
Returns
array

Definition at line 114 of file class.ilBPMN2ParserUtils.php.

References array.

Referenced by ilIntermediateCatchEventElement\getPHP(), ilIntermediateThrowEventElement\getPHP(), ilSendTaskElement\getPHP(), ilReceiveTaskElement\getPHP(), ilStartEventElement\getPHP(), ilEndEventElement\getPHP(), and ilWorkflowScaffold\getStartEventInfo().

115  {
116  $descriptor_extension = array();
117  $subject_extension = array();
118  $context_extension = array();
119  $timeframe_extension = array();
120 
121  foreach ($bpmn2_array['children'] as $element)
122  {
123  if ($element['name'] == $type && $element['attributes']['id'] == $start_event_ref)
124  {
125  $bpmn_extension_elements = $element['children'][0];
126  $extension_elements = $bpmn_extension_elements['children'][0]['children'];
127 
128  foreach ($extension_elements as $child)
129  {
130  $prefix = 'ilias:';
131  if($child['namespace'] == 'ilias')
132  {
133  $prefix = '';
134  }
135  if ($child['name'] == $prefix.'eventDescriptor')
136  {
137  $descriptor_extension = $child;
138  }
139  if ($child['name'] == $prefix.'eventSubject')
140  {
141  $subject_extension = $child;
142  }
143 
144  if ($child['name'] == $prefix.'eventContext')
145  {
146  $context_extension = $child;
147  }
148 
149  if ($child['name'] == $prefix.'eventTimeframe')
150  {
151  $timeframe_extension = $child;
152  }
153  }
154  }
155  }
156 
157  $event_definition = array(
158  'type' => $descriptor_extension['attributes']['type'],
159  'content' => $descriptor_extension['attributes']['name'],
160  'subject_type' => $subject_extension['attributes']['type'],
161  'subject_id' => $subject_extension['attributes']['id'],
162  'context_type' => $context_extension['attributes']['type'],
163  'context_id' => $context_extension['attributes']['id'],
164  'listening_start' => $timeframe_extension['attributes']['start'],
165  'listening_end' => $timeframe_extension['attributes']['end']
166  );
167 
168  return $event_definition;
169  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ extractILIASInputPropertiesFromElement()

static ilBPMN2ParserUtils::extractILIASInputPropertiesFromElement (   $element)
static
Parameters
array$element
Returns
null|array

Definition at line 336 of file class.ilBPMN2ParserUtils.php.

References array.

Referenced by ilDataInputElement\getPHP().

337  {
338  if(!isset($element['children']))
339  {
340  return null;
341  }
342 
343  $retval = null;
344  foreach((array)$element['children'] as $child)
345  {
346  if($child['name'] == 'extensionElements')
347  {
348  foreach($child['children'] as $extension)
349  {
350  $prefix = 'ilias:';
351  if($extension['children'][0]['namespace'] == 'ilias')
352  {
353  $prefix = '';
354  }
355  if($extension['name'] == $prefix.'properties')
356  {
357  foreach((array)$extension['children'] as $child)
358  {
359  if($child['name'] == 'inputproperty')
360  {
361  $retval[$child['attributes']['name']] = $child['attributes']['value'];
362  }
363  }
364  }
365  }
366  }
367  }
368  return $retval;
369  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ extractILIASLibraryCallDefinitionFromElement()

static ilBPMN2ParserUtils::extractILIASLibraryCallDefinitionFromElement (   $element)
static
Parameters
array$element
Returns
array

Definition at line 240 of file class.ilBPMN2ParserUtils.php.

References array.

Referenced by ilCallActivityElement\getPHP().

241  {
242  $library_call = array();
243  foreach($element['children'] as $child)
244  {
245  if($child['name'] == 'extensionElements')
246  {
247  foreach($child['children'] as $extension)
248  {
249  $prefix = 'ilias:';
250  if($extension['namespace'] == 'ilias')
251  {
252  $prefix = '';
253  }
254  if($extension['name'] == $prefix.'properties')
255  {
256  if($extension['children'][0]['name'] == $prefix.'libraryCall')
257  {
258  $library_call = $extension['children'][0]['attributes'];
259  break;
260  }
261  }
262  }
263  }
264  }
265 
266  // TODO: This must consult Service Disco for details!
267 
268  return array(
269  'include_filename' => $library_call['location'],
270  'class_and_method' => $library_call['api'] .'::' . $library_call['method']
271  );
272  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ extractILIASMessageDefinitionFromElement()

static ilBPMN2ParserUtils::extractILIASMessageDefinitionFromElement (   $element)
static
Parameters
array$element
Returns
null|array

Definition at line 417 of file class.ilBPMN2ParserUtils.php.

References array.

Referenced by ilMessageDefinitionElement\getMessageDefinitionArray().

418  {
419  if(!isset($element['children']))
420  {
421  return null;
422  }
423 
424  $retval = null;
425  foreach((array)$element['children'] as $child)
426  {
427  if($child['name'] == 'extensionElements')
428  {
429  foreach($child['children'] as $extension)
430  {
431  $prefix = 'ilias:';
432  if($extension['children'][0]['namespace'] == 'ilias')
433  {
434  $prefix = '';
435  }
436  if($extension['name'] == $prefix.'properties')
437  {
438  foreach((array)$extension['children'] as $child)
439  {
440  if($child['attributes']['name'] == 'mailtext')
441  {
442  $retval['mailtext'] = base64_encode($child['content']);
443  }
444  }
445  }
446  }
447  }
448  }
449 
450  return $retval;
451  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ extractScriptDefinitionFromElement()

static ilBPMN2ParserUtils::extractScriptDefinitionFromElement (   $element)
static
Parameters
array$element
Returns
string

Definition at line 279 of file class.ilBPMN2ParserUtils.php.

References $code.

280  {
281  $code = '';
282  foreach($element['children'] as $child)
283  {
284  if($child['name'] == 'script')
285  {
286  $code = $child['content'];
287  }
288  }
289  return $code;
290  }
$code
Definition: example_050.php:99

◆ extractTimeDateEventDefinitionFromElement()

static ilBPMN2ParserUtils::extractTimeDateEventDefinitionFromElement (   $start_event_ref,
  $type,
  $bpmn2_array 
)
static
Parameters
string$start_event_ref
string$type
array$bpmn2_array
Returns
array

Definition at line 178 of file class.ilBPMN2ParserUtils.php.

References $duration, $start, array, and date.

Referenced by ilIntermediateCatchEventElement\getPHP(), ilReceiveTaskElement\getPHP(), and ilStartEventElement\getPHP().

179  {
180  $content = '';
181  foreach($bpmn2_array['children'] as $elements)
182  {
183  foreach($elements['children'] as $element)
184  {
185  if ($element['name'] == $type)
186  {
187  foreach((array)$element['children'] as $event_child)
188  {
189  if($event_child['name'] == 'timerEventDefinition')
190  {
191  if($event_child['children'][0]['name'] == 'timeDate')
192  {
193  $content = $event_child['children'][0]['content'];
194  $start = date('U',strtotime($content));
195  $end = 0;
196 
197  return array(
198  'type' => 'time_passed',
199  'content' => 'time_passed',
200  'subject_type' => 'none',
201  'subject_id' => 0,
202  'context_type' => 'none',
203  'context_id' => 0,
204  'listening_start' => $start,
205  'listening_end' => $end
206  );
207  }
208 
209  if($event_child['children'][0]['name'] == 'timeDuration')
210  {
211  $content = $event_child['children'][0]['content'];
212  $interval = new \DateInterval(strtotime($content));
213  $duration = ($interval->d * 24 * 60 * 60) + ($interval->h * 60 * 60) +
214  ($interval->i * 60) + $interval->s;
215 
216  return array(
217  'type' => 'time_passed',
218  'content' => 'time_passed',
219  'subject_type' => 'none',
220  'subject_id' => 0,
221  'context_type' => 'none',
222  'context_id' => 0,
223  'listening_relative'=> 1,
224  'listening_interval'=> $duration
225  );
226  }
227  }
228  }
229  }
230  }
231  }
232 
233  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ load_string()

ilBPMN2ParserUtils::load_string (   $xml_string)
Parameters
string$xml_string
Returns
mixed

Definition at line 22 of file class.ilBPMN2ParserUtils.php.

References add_node().

23  {
24  $node=@simplexml_load_string($xml_string);
25  return $this->add_node($node);
26  }
add_node($node, &$parent=null, $namespace='', $recursive=false)
+ Here is the call graph for this function:

◆ xsIDToPHPVarname()

static ilBPMN2ParserUtils::xsIDToPHPVarname (   $xsID)
static
Parameters
string$xsID
Returns
string

Definition at line 85 of file class.ilBPMN2ParserUtils.php.

Referenced by ilCallActivityElement\getPHP(), ilComplexGatewayElement\getPHP(), ilTaskElement\getPHP(), ilServiceTaskElement\getPHP(), ilSendTaskElement\getPHP(), ilScriptTaskElement\getPHP(), ilReceiveTaskElement\getPHP(), ilManualTaskElement\getPHP(), ilDataOutputElement\getPHP(), ilDataObjectReferenceElement\getPHP(), ilDataObjectElement\getPHP(), ilDataInputElement\getPHP(), ilParallelGatewayElement\getPHP(), ilInclusiveGatewayElement\getPHP(), ilExclusiveGatewayElement\getPHP(), ilEventBasedGatewayElement\getPHP(), ilIntermediateCatchEventElement\getPHP(), ilSequenceFlowElement\getPHP(), ilStartEventElement\getPHP(), ilEndEventElement\getPHP(), ilIntermediateThrowEventElement\getPHP(), and ilAssociationElement\getPHP().

86  {
87  /*
88  * The type xsd:ID is used for an attribute that uniquely identifies an element in an XML document. An xsd:ID
89  * value must be an NCName. This means that it must start with a letter or underscore, and can only contain
90  * letters, digits, underscores, hyphens, and periods.
91  *
92  * xsd:ID carries several additional constraints:
93  *
94  * * Their values must be unique within an XML instance, regardless of the attribute's name or
95  * its element name.
96  * * A complex type cannot include more than one attribute of type xsd:ID, or any type derived from xsd:ID.
97  * * xsd:ID attributes cannot have default or fixed values specified.
98  *
99  * This differs from PHP variable name rules.
100  * To overcome this, we need to address possible hyphens and periods in xsIDs, here they are replaced.
101  */
102  $xsID_converted = str_replace('.','__period__',$xsID);
103  $xsID_converted = str_replace('-','__hyphen__',$xsID_converted);
104  return $xsID_converted;
105  }
+ Here is the caller graph for this function:

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