ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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.

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

References $namespace, $r, and add_node().

Referenced by add_node(), and load_string().

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

◆ extractDataNamingFromElement()

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

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

272 {
273 if (!isset($element['children'])) {
274 return null;
275 }
276
277 foreach ($element['children'] as $child) {
278 if ($child['name'] == 'extensionElements') {
279 foreach ($child['children'] as $extension) {
280 $prefix = 'ilias:';
281 if ($extension['children'][0]['namespace'] == 'ilias') {
282 $prefix = '';
283 }
284 if ($extension['name'] == $prefix . 'properties') {
285 if ($extension['children'][0]['name'] == $prefix . 'property') {
286 $attributes = $extension['children'][0]['attributes'];
287 return $attributes['value'];
288 break;
289 }
290 }
291 }
292 }
293 }
294
295 return null;
296 }
$attributes

References $attributes.

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

+ Here is the caller graph for this function:

◆ extractILIASDataObjectDefinitionFromElement()

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

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

336 {
337 if (!isset($element['children'])) {
338 return null;
339 }
340
341 $retval = null;
342 foreach ((array) $element['children'] as $child) {
343 if ($child['name'] == 'extensionElements') {
344 foreach ($child['children'] as $extension) {
345 $prefix = 'ilias:';
346 if ($extension['children'][0]['namespace'] == 'ilias') {
347 $prefix = '';
348 }
349 if ($extension['name'] == $prefix . 'properties') {
350 foreach ((array) $extension['children'] as $child) {
351 if ($child['name'] == 'dataobject') {
352 $retval['role'] = $child['attributes']['role'];
353 $retval['type'] = $child['attributes']['type'];
354 }
355 }
356 }
357 }
358 }
359 }
360 return $retval;
361 }

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

+ 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 112 of file class.ilBPMN2ParserUtils.php.

113 {
114 $descriptor_extension = array();
115 $subject_extension = array();
116 $context_extension = array();
117 $timeframe_extension = array();
118
119 foreach ($bpmn2_array['children'] as $element) {
120 if ($element['name'] == $type && $element['attributes']['id'] == $start_event_ref) {
121 $bpmn_extension_elements = $element['children'][0];
122 $extension_elements = $bpmn_extension_elements['children'][0]['children'];
123
124 foreach ($extension_elements as $child) {
125 $prefix = 'ilias:';
126 if ($child['namespace'] == 'ilias') {
127 $prefix = '';
128 }
129 if ($child['name'] == $prefix . 'eventDescriptor') {
130 $descriptor_extension = $child;
131 }
132 if ($child['name'] == $prefix . 'eventSubject') {
133 $subject_extension = $child;
134 }
135
136 if ($child['name'] == $prefix . 'eventContext') {
137 $context_extension = $child;
138 }
139
140 if ($child['name'] == $prefix . 'eventTimeframe') {
141 $timeframe_extension = $child;
142 }
143 }
144 }
145 }
146
147 $event_definition = array(
148 'type' => $descriptor_extension['attributes']['type'],
149 'content' => $descriptor_extension['attributes']['name'],
150 'subject_type' => $subject_extension['attributes']['type'],
151 'subject_id' => $subject_extension['attributes']['id'],
152 'context_type' => $context_extension['attributes']['type'],
153 'context_id' => $context_extension['attributes']['id'],
154 'listening_start' => $timeframe_extension['attributes']['start'],
155 'listening_end' => $timeframe_extension['attributes']['end']
156 );
157
158 return $event_definition;
159 }
$type

References $type.

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

+ Here is the caller graph for this function:

◆ extractILIASInputPropertiesFromElement()

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

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

304 {
305 if (!isset($element['children'])) {
306 return null;
307 }
308
309 $retval = null;
310 foreach ((array) $element['children'] as $child) {
311 if ($child['name'] == 'extensionElements') {
312 foreach ($child['children'] as $extension) {
313 $prefix = 'ilias:';
314 if ($extension['children'][0]['namespace'] == 'ilias') {
315 $prefix = '';
316 }
317 if ($extension['name'] == $prefix . 'properties') {
318 foreach ((array) $extension['children'] as $child) {
319 if ($child['name'] == 'inputproperty') {
320 $retval[$child['attributes']['name']] = $child['attributes']['value'];
321 }
322 }
323 }
324 }
325 }
326 }
327 return $retval;
328 }

Referenced by ilDataInputElement\getPHP().

+ Here is the caller graph for this function:

◆ extractILIASLibraryCallDefinitionFromElement()

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

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

223 {
224 $library_call = array();
225 foreach ($element['children'] as $child) {
226 if ($child['name'] == 'extensionElements') {
227 foreach ($child['children'] as $extension) {
228 $prefix = 'ilias:';
229 if ($extension['namespace'] == 'ilias') {
230 $prefix = '';
231 }
232 if ($extension['name'] == $prefix . 'properties') {
233 if ($extension['children'][0]['name'] == $prefix . 'libraryCall') {
234 $library_call = $extension['children'][0]['attributes'];
235 break;
236 }
237 }
238 }
239 }
240 }
241
242 // TODO: This must consult Service Disco for details!
243
244 return array(
245 'include_filename' => $library_call['location'],
246 'class_and_method' => $library_call['api'] . '::' . $library_call['method']
247 );
248 }

Referenced by ilCallActivityElement\getPHP().

+ Here is the caller graph for this function:

◆ extractILIASMessageDefinitionFromElement()

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

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

369 {
370 if (!isset($element['children'])) {
371 return null;
372 }
373
374 $retval = null;
375 foreach ((array) $element['children'] as $child) {
376 if ($child['name'] == 'extensionElements') {
377 foreach ($child['children'] as $extension) {
378 $prefix = 'ilias:';
379 if ($extension['children'][0]['namespace'] == 'ilias') {
380 $prefix = '';
381 }
382 if ($extension['name'] == $prefix . 'properties') {
383 foreach ((array) $extension['children'] as $child) {
384 if ($child['attributes']['name'] == 'mailtext') {
385 $retval['mailtext'] = base64_encode($child['content']);
386 }
387 }
388 }
389 }
390 }
391 }
392
393 return $retval;
394 }

Referenced by ilMessageDefinitionElement\getMessageDefinitionArray().

+ Here is the caller graph for this function:

◆ extractScriptDefinitionFromElement()

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

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

256 {
257 $code = '';
258 foreach ($element['children'] as $child) {
259 if ($child['name'] == 'script') {
260 $code = $child['content'];
261 }
262 }
263 return $code;
264 }
$code
Definition: example_050.php:99

References $code.

◆ 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 168 of file class.ilBPMN2ParserUtils.php.

169 {
170 $content = '';
171 foreach ($bpmn2_array['children'] as $elements) {
172 foreach ($elements['children'] as $element) {
173 if ($element['name'] == $type) {
174 foreach ((array) $element['children'] as $event_child) {
175 if ($event_child['name'] == 'timerEventDefinition') {
176 if ($event_child['children'][0]['name'] == 'timeDate') {
177 $content = $event_child['children'][0]['content'];
178 $start = date('U', strtotime($content));
179 $end = 0;
180
181 return array(
182 'type' => 'time_passed',
183 'content' => 'time_passed',
184 'subject_type' => 'none',
185 'subject_id' => 0,
186 'context_type' => 'none',
187 'context_id' => 0,
188 'listening_start' => $start,
189 'listening_end' => $end
190 );
191 }
192
193 if ($event_child['children'][0]['name'] == 'timeDuration') {
194 $content = $event_child['children'][0]['content'];
195 $interval = new \DateInterval(strtotime($content));
196 $duration = ($interval->d * 24 * 60 * 60) + ($interval->h * 60 * 60) +
197 ($interval->i * 60) + $interval->s;
198
199 return array(
200 'type' => 'time_passed',
201 'content' => 'time_passed',
202 'subject_type' => 'none',
203 'subject_id' => 0,
204 'context_type' => 'none',
205 'context_id' => 0,
206 'listening_relative'=> 1,
207 'listening_interval'=> $duration
208 );
209 }
210 }
211 }
212 }
213 }
214 }
215 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$end
Definition: saml1-acs.php:18

References $end, $type, and date.

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

+ 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.

23 {
24 $node=@simplexml_load_string($xml_string);
25 return $this->add_node($node);
26 }

References add_node().

+ Here is the call graph for this function:

◆ xsIDToPHPVarname()

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

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

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

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

+ Here is the caller graph for this function:

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