14 #region XML to Array conversion 24 $node = @simplexml_load_string($xml_string);
38 $namespaces = $node->getNameSpaces(
true);
41 $r[
'name'] = $node->getName();
43 $tmp = array_keys($node->getNameSpaces(
false));
44 $r[
'namespace'] = $tmp[0];
45 $r[
'namespaces'] = $namespaces;
51 $r[
'content'] = $content;
54 foreach ($namespaces as $pre => $ns) {
55 foreach ($node->children($ns) as $k => $v) {
56 $this->
add_node($v,
$r[
'children'], $pre,
true);
58 foreach ($node->attributes($ns) as $k => $v) {
59 $r[
'attributes'][$k] =
"$pre:$v";
63 foreach ($node->children() as $k => $v) {
67 foreach ($node->attributes() as $k => $v) {
68 $r[
'attributes'][$k] =
"$v";
100 $xsID_converted = str_replace(
'.',
'__period__', $xsID);
101 $xsID_converted = str_replace(
'-',
'__hyphen__', $xsID_converted);
102 return $xsID_converted;
114 $descriptor_extension = array();
115 $subject_extension = array();
116 $context_extension = array();
117 $timeframe_extension = array();
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'];
124 foreach ($extension_elements as $child) {
126 if ($child[
'namespace'] ==
'ilias') {
129 if ($child[
'name'] == $prefix .
'eventDescriptor') {
130 $descriptor_extension = $child;
132 if ($child[
'name'] == $prefix .
'eventSubject') {
133 $subject_extension = $child;
136 if ($child[
'name'] == $prefix .
'eventContext') {
137 $context_extension = $child;
140 if ($child[
'name'] == $prefix .
'eventTimeframe') {
141 $timeframe_extension = $child;
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']
158 return $event_definition;
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));
182 'type' =>
'time_passed',
183 'content' =>
'time_passed',
184 'subject_type' =>
'none',
186 'context_type' =>
'none',
188 'listening_start' =>
$start,
189 'listening_end' =>
$end 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;
200 'type' =>
'time_passed',
201 'content' =>
'time_passed',
202 'subject_type' =>
'none',
204 'context_type' =>
'none',
206 'listening_relative' => 1,
207 'listening_interval' => $duration
224 $library_call = array();
225 foreach ($element[
'children'] as $child) {
226 if ($child[
'name'] ==
'extensionElements') {
227 foreach ($child[
'children'] as $extension) {
229 if ($extension[
'namespace'] ==
'ilias') {
232 if ($extension[
'name'] == $prefix .
'properties') {
233 if ($extension[
'children'][0][
'name'] == $prefix .
'libraryCall') {
234 $library_call = $extension[
'children'][0][
'attributes'];
245 'include_filename' => $library_call[
'location'],
246 'class_and_method' => $library_call[
'api'] .
'::' . $library_call[
'method']
258 foreach ($element[
'children'] as $child) {
259 if ($child[
'name'] ==
'script') {
260 $code = $child[
'content'];
273 if (!isset($element[
'children'])) {
277 foreach ($element[
'children'] as $child) {
278 if ($child[
'name'] ==
'extensionElements') {
279 foreach ($child[
'children'] as $extension) {
281 if ($extension[
'children'][0][
'namespace'] ==
'ilias') {
284 if ($extension[
'name'] == $prefix .
'properties') {
285 if ($extension[
'children'][0][
'name'] == $prefix .
'property') {
286 $attributes = $extension[
'children'][0][
'attributes'];
305 if (!isset($element[
'children'])) {
310 foreach ((array) $element[
'children'] as $child) {
311 if ($child[
'name'] ==
'extensionElements') {
312 foreach ($child[
'children'] as $extension) {
314 if ($extension[
'children'][0][
'namespace'] ==
'ilias') {
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'];
337 if (!isset($element[
'children'])) {
342 foreach ((array) $element[
'children'] as $child) {
343 if ($child[
'name'] ==
'extensionElements') {
344 foreach ($child[
'children'] as $extension) {
346 if ($extension[
'children'][0][
'namespace'] ==
'ilias') {
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'];
370 if (!isset($element[
'children'])) {
375 foreach ((array) $element[
'children'] as $child) {
376 if ($child[
'name'] ==
'extensionElements') {
377 foreach ($child[
'children'] as $extension) {
379 if ($extension[
'children'][0][
'namespace'] ==
'ilias') {
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']);
static extractILIASMessageDefinitionFromElement($element)
if($err=$client->getError()) $namespace
static xsIDToPHPVarname($xsID)
static extractDataNamingFromElement($element)
static extractILIASEventDefinitionFromProcess($start_event_ref, $type, $bpmn2_array)
static extractScriptDefinitionFromElement($element)
Class ilBPMN2ParserUtils.
static extractILIASLibraryCallDefinitionFromElement($element)
static extractILIASInputPropertiesFromElement($element)
add_node($node, &$parent=null, $namespace='', $recursive=false)
if(array_key_exists('yes', $_REQUEST)) $attributes
static extractILIASDataObjectDefinitionFromElement($element)
static extractTimeDateEventDefinitionFromElement($start_event_ref, $type, $bpmn2_array)