ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SeqTreeBuilder Class Reference
+ Collaboration diagram for SeqTreeBuilder:

Public Member Functions

 buildNodeSeqTree ($file)
 

Static Public Member Functions

static getObjectives ($iNode, $ioAct)
 
static getADLSEQObjectives ($iNode, $ioAct)
 
static getADLSeqMaps ($iNode, $curseqobj)
 
static fillinADLSeqMaps ($iNode, $map)
 
static getObjectiveMaps ($iNode)
 
static getRollupRules ($iNode, $ioAct)
 
static getSequencingRules ($iNode, $ioAct)
 
static extractSeqRuleConditions ($iNode)
 
static getAuxResources ($iNode, $ioAct)
 

Private Member Functions

 buildNode ($node, $seq, $doc)
 
 extractSeqInfo ($iNode, $ioAct)
 

Static Private Member Functions

static convert_to_bool ($string)
 
static lookupElement ($iNode, $iElement)
 

Detailed Description

Definition at line 67 of file SeqTreeBuilder.php.

Member Function Documentation

◆ buildNode()

SeqTreeBuilder::buildNode (   $node,
  $seq,
  $doc 
)
private

Definition at line 127 of file SeqTreeBuilder.php.

128 {
129
130 //create a new activity object
131 $act = new SeqActivity();
132
133 //set various attributes, if existent
134 $act->setID(preg_replace('/(%20)+/', ' ', trim($node->getAttribute("identifier"))));
135
136 $tempVal = preg_replace('/(%20)+/', ' ', trim($node->getAttribute("identifierref")));
137 if ($tempVal) {
138 $act->setResourceID($tempVal);
139 }
140
141 $tempVal = $node->getAttribute("isvisible");
142
143 if ($tempVal) {
144 $act->setIsVisible(self::convert_to_bool($tempVal));
145 }
146
147
148
149 //Proceed nested items
150 $children = $node->childNodes;
151
152 for ($i = 0; $i < $children->length; $i++) {
153 $curNode=$children->item($i);
154 //elements only
155
156 if ($curNode->nodeType == XML_ELEMENT_NODE) {
157 //only items are nested
158 if ($curNode->localName == "item") {
159 //init;
160 $c_nestedAct=null;
161 $nestedAct = new SeqActivity();
162 $nestedAct = $this->buildNode($curNode, $seq, $doc);
163 if ($nestedAct != null) {
164 $act->AddChild($nestedAct);
165 }
166 } elseif ($curNode->localName == "title") {
167 $act->setTitle($this->lookupElement($curNode, null));
168 } elseif ($curNode->localName == "completionThreshold") {
169 $tempVal = $curNode->getAttribute("minProgressMeasure");
170
171 if ($tempVal) {
172 $act->setCompletionThreshold($tempVal);
173 } elseif ($curNode->nodeValue != null && $curNode->nodeValue != '') {
174 $act->setCompletionThreshold($curNode->nodeValue);
175 }
176
177 $tempVal = $curNode->getAttribute("progressWeight");
178
179 if ($tempVal) {
180 $act->setProgressWeight($tempVal);
181 }
182 $tempVal = $curNode->getAttribute("completedByMeasure");
183
184 if ($tempVal) {
185 $act->setCompletedByMeasure(self::convert_to_bool($tempVal));
186 }
187 } elseif ($curNode->localName == "sequencing") {
188 $seqInfo = $curNode;
189 //get IDRef
190 $tempVal = preg_replace('/(%20)+/', ' ', trim($curNode->getAttribute("IDRef")));
191 //only execute for referenced sequencing parts
192 if ($tempVal) {
193 //init seqGlobal
194 $seqGlobal = null;
195
196 //get all sequencing nodes in collections
197 $sequencing = $seq->getElementsByTagName("sequencing");
198
199 //lookup the matching sequencing element
200 foreach ($sequencing as $element) {
201 if (preg_replace('/(%20)+/', ' ', trim($element->getAttribute("ID")))==$tempVal) {
202 $seqGlobal = $element;
203 }
204 }
205
206 //clone the global node
207 $seqInfo = $seqGlobal->cloneNode(true);
208
209 //back to the local node
210 $seqChildren = $curNode->childNodes;
211 for ($j = 0; $j < $seqChildren->length; $j++) {
212 //process local nodes
213 $curChild = $seqChildren->item($j);
214 if ($curChild->nodeType == XML_ELEMENT_NODE) {
215 //echo "\nFound Sequencing Element Node".$curChild->localName;
216 //add local to global sequencing info
217 $seqInfo->appendChild($curChild);
218 }
219 }
220 }
221 //extract the sequencing info, if we have one
222 //avoid working with
223 $act=$this->extractSeqInfo($seqInfo, $act);
224 }
225 }
226
227
228
229 $item=$children->item($i)->nodeValue;
230 }
231 //add class
232 //$c_act['_SeqActivity']=$act;
233 return $act;
234 }
buildNode($node, $seq, $doc)
extractSeqInfo($iNode, $ioAct)
static lookupElement($iNode, $iElement)
$i
Definition: disco.tpl.php:19

References $i, buildNode(), extractSeqInfo(), and lookupElement().

Referenced by buildNode(), and buildNodeSeqTree().

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

◆ buildNodeSeqTree()

SeqTreeBuilder::buildNodeSeqTree (   $file)

Definition at line 69 of file SeqTreeBuilder.php.

70 {
71 $doc = new DomDocument();
72 $doc->load($file);
73 $organizations = $doc->getElementsByTagName("organizations");
74
75 //lookup default organization id
76 $default=preg_replace('/(%20)+/', ' ', trim($organizations->item(0)->getAttribute("default")));
77
78 //get all organization nodes
79 $organization = $doc->getElementsByTagName("organization");
80
81 //lookup the default organization
82 foreach ($organization as $element) {
83 if (preg_replace('/(%20)+/', ' ', trim($element->getAttribute("identifier")))==$default) {
84 $default_organization = $element;
85 }
86 }
87
88 //read seqCollection
89 $seqCollection = $doc->getElementsByTagName("sequencingCollection")->item(0);
90
91 $root = $this->buildNode($default_organization, $seqCollection, $doc);
92
93 //return no data please check
94 $objectivesGlobalToSystem = $default_organization->getAttributeNS("http://www.adlnet.org/xsd/adlseq_v1p3", "objectivesGlobalToSystem");
95
96 $org = preg_replace('/(%20)+/', ' ', trim($default_organization->getAttribute("identifier")));
97
98 //default true
99 $globaltosystem = 1;
100
101 if ($objectivesGlobalToSystem=="false") {
102 $globaltosystem = 0;
103 }
104
105 //return no data please check
106 $dataGlobalToSystem = $default_organization->getAttributeNS("http://www.adlnet.org/xsd/adlcp_v1p3", "sharedDataGlobalToSystem");
107
108 //default true
109 $dataglobaltosystem = 1;
110
111 if ($dataGlobalToSystem=="false") {
112 $dataglobaltosystem = 0;
113 }
114
115 //assign SeqActivity to top node
116 $c_root['_SeqActivity']=$root;
117
118 $ret['global'] = $globaltosystem;
119 $ret['dataglobal'] = $dataglobaltosystem;
120 $ret['tree'] = $c_root;
121
122 return $ret;
123 }
if($source===NULL) $organizations
$ret
Definition: parser.php:6
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, $organizations, $ret, and buildNode().

+ Here is the call graph for this function:

◆ convert_to_bool()

static SeqTreeBuilder::convert_to_bool (   $string)
staticprivate

Definition at line 968 of file SeqTreeBuilder.php.

969 {
970 if (strtoupper($string)=="FALSE") {
971 return false;
972 } else {
973 return true;
974 }
975 }

Referenced by fillinADLSeqMaps(), getObjectiveMaps(), and getObjectives().

+ Here is the caller graph for this function:

◆ extractSeqInfo()

SeqTreeBuilder::extractSeqInfo (   $iNode,
  $ioAct 
)
private

Definition at line 237 of file SeqTreeBuilder.php.

238 {
239 //set sequencing information
240 $children = $iNode->childNodes;
241 for ($i = 0; $i < $children->length; $i++) {
242 $curNode = $children->item($i);
243 if ($curNode->nodeType == XML_ELEMENT_NODE) {
244 if ($curNode->localName == "controlMode") {
245 //look for choice
246 $tempVal=$curNode->getAttribute("choice");
247 if ($tempVal) {
248 $ioAct->setControlModeChoice(self::convert_to_bool($tempVal));
249 }
250 //look for choiceExit
251 $tempVal=$curNode->getAttribute("choiceExit");
252 if ($tempVal) {
253 $ioAct->setControlModeChoiceExit(self::convert_to_bool($tempVal));
254 }
255
256 //look for flow
257 $tempVal=$curNode->getAttribute("flow");
258 if ($tempVal) {
259 $ioAct->setControlModeFlow(self::convert_to_bool($tempVal));
260 }
261
262 // Look for 'forwardOnly'
263 $tempVal=$curNode->getAttribute("forwardOnly");
264 if ($tempVal) {
265 $ioAct->setControlForwardOnly(self::convert_to_bool($tempVal));
266 }
267
268 // Look for 'useCurrentAttemptObjectiveInfo'
269 $tempVal=$curNode->getAttribute("useCurrentAttemptObjectiveInfo");
270 if ($tempVal) {
271 $ioAct->setUseCurObjective(self::convert_to_bool($tempVal));
272 }
273
274 // Look for 'useCurrentAttemptProgressInfo'
275 $tempVal=$curNode->getAttribute("useCurrentAttemptProgressInfo");
276 if ($tempVal) {
277 $ioAct->setUseCurProgress(self::convert_to_bool($tempVal));
278 }
279 } elseif ($curNode->localName == "sequencingRules") {
280 $ioAct = $this->getSequencingRules($curNode, $ioAct);
281 } elseif ($curNode->localName == "limitConditions") {
282 // Look for 'useCurrentAttemptObjectiveInfo'
283 $tempVal=$curNode->getAttribute("attemptLimit");
284 if ($tempVal) {
285 $ioAct->setAttemptLimit($tempVal);
286 }
287
288 // Look for 'attemptAbsoluteDurationLimit'
289 $tempVal=$curNode->getAttribute("attemptAbsoluteDurationLimit");
290 if ($tempVal) {
291 $ioAct->setAttemptAbDur($tempVal);
292 }
293
294 // Look for 'attemptExperiencedDurationLimit'
295 $tempVal=$curNode->getAttribute("attemptExperiencedDurationLimit");
296 if ($tempVal) {
297 $ioAct->setAttemptExDur($tempVal);
298 }
299
300 // Look for 'activityAbsoluteDurationLimit'
301 $tempVal=$curNode->getAttribute("activityAbsoluteDurationLimit");
302 if ($tempVal) {
303 $ioAct->setActivityAbDur($tempVal);
304 }
305
306 // Look for 'activityExperiencedDurationLimit'
307 $tempVal=$curNode->getAttribute("activityExperiencedDurationLimit");
308 if ($tempVal) {
309 $ioAct->setActivityExDur($tempVal);
310 }
311
312 // Look for 'beginTimeLimit'
313 $tempVal=$curNode->getAttribute("beginTimeLimit");
314 if ($tempVal) {
315 $ioAct->setBeginTimeLimit($tempVal);
316 }
317
318 // Look for 'endTimeLimit'
319 $tempVal=$curNode->getAttribute("endTimeLimit");
320 if ($tempVal) {
321 $ioAct->setEndTimeLimit($tempVal);
322 }
323 } elseif ($curNode->localName == "auxiliaryResources") {
324 $ioAct = self::getAuxResources($curNode, $ioAct);
325 } elseif ($curNode->localName == "rollupRules") {
326 $ioAct = self::getRollupRules($curNode, $ioAct);
327 } elseif ($curNode->localName == "objectives" && $curNode->namespaceURI == "http://www.imsglobal.org/xsd/imsss") {
328 $ioAct = self::getObjectives($curNode, $ioAct);
329 } elseif ($curNode->localName == "objectives" && $curNode->namespaceURI == "http://www.adlnet.org/xsd/adlseq_v1p3") {
330 $ioAct = self::getADLSEQObjectives($curNode, $ioAct);
331 } elseif ($curNode->localName == "randomizationControls") {
332
333 // Look for 'randomizationTiming'
334 $tempVal=$curNode->getAttribute("randomizationTiming");
335 if ($tempVal) {
336 $ioAct->setRandomTiming($tempVal);
337 }
338
339 // Look for 'selectCount'
340 $tempVal=$curNode->getAttribute("selectCount");
341 if ($tempVal) {
342 $ioAct->setSelectCount($tempVal);
343 }
344
345 // Look for 'reorderChildren'
346 $tempVal=$curNode->getAttribute("reorderChildren");
347 if ($tempVal) {
348 $ioAct->setReorderChildren(self::convert_to_bool($tempVal));
349 }
350
351 // Look for 'selectionTiming'
352 $tempVal=$curNode->getAttribute("selectionTiming");
353 if ($tempVal) {
354 $ioAct->setSelectionTiming($tempVal);
355 }
356 } elseif ($curNode->localName == "deliveryControls") {
357
358 // Look for 'tracked'
359 $tempVal=$curNode->getAttribute("tracked");
360 if ($tempVal) {
361 $ioAct->setIsTracked(self::convert_to_bool($tempVal));
362 }
363
364 // Look for 'completionSetByContent'
365 $tempVal=$curNode->getAttribute("completionSetByContent");
366 if ($tempVal) {
367 $ioAct->setSetCompletion(self::convert_to_bool($tempVal));
368 }
369
370 // Look for 'objectiveSetByContent'
371 $tempVal=$curNode->getAttribute("objectiveSetByContent");
372 if ($tempVal) {
373 $ioAct->setSetObjective(self::convert_to_bool($tempVal));
374 }
375 } elseif ($curNode->localName == "constrainedChoiceConsiderations") {
376
377 // Look for 'preventActivation'
378 $tempVal=$curNode->getAttribute("preventActivation");
379 if ($tempVal) {
380 $ioAct->setPreventActivation(self::convert_to_bool($tempVal));
381 }
382
383 // Look for 'constrainChoice'
384 $tempVal=$curNode->getAttribute("constrainChoice");
385 if ($tempVal) {
386 $ioAct->setConstrainChoice(self::convert_to_bool($tempVal));
387 }
388 } elseif ($curNode->localName == "rollupConsiderations") {
389
390 // Look for 'requiredForSatisfied'
391 $tempVal=$curNode->getAttribute("requiredForSatisfied");
392 if ($tempVal) {
393 $ioAct->setRequiredForSatisfied($tempVal);
394 }
395
396 // Look for 'requiredForNotSatisfied'
397 $tempVal=$curNode->getAttribute("requiredForNotSatisfied");
398 if ($tempVal) {
399 $ioAct->setRequiredForNotSatisfied($tempVal);
400 }
401
402 // Look for 'requiredForCompleted'
403 $tempVal=$curNode->getAttribute("requiredForCompleted");
404 if ($tempVal) {
405 $ioAct->setRequiredForCompleted($tempVal);
406 }
407
408 // Look for 'requiredForIncomplete'
409 $tempVal=$curNode->getAttribute("requiredForIncomplete");
410 if ($tempVal) {
411 $ioAct->setRequiredForIncomplete($tempVal);
412 }
413
414 // Look for 'measureSatisfactionIfActive'
415 $tempVal=$curNode->getAttribute("measureSatisfactionIfActive");
416 if ($tempVal) {
417 $ioAct->setSatisfactionIfActive(self::convert_to_bool($tempVal));
418 }
419 }
420 } //end note-type check
421 } //end for-loop
422
423 return $ioAct;
424 }
static getADLSEQObjectives($iNode, $ioAct)
static getSequencingRules($iNode, $ioAct)
static getAuxResources($iNode, $ioAct)
static getObjectives($iNode, $ioAct)
static getRollupRules($iNode, $ioAct)

References $i, getADLSEQObjectives(), getAuxResources(), getObjectives(), getRollupRules(), and getSequencingRules().

Referenced by buildNode().

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

◆ extractSeqRuleConditions()

static SeqTreeBuilder::extractSeqRuleConditions (   $iNode)
static

Definition at line 866 of file SeqTreeBuilder.php.

867 {
868 $tempVal = null;
869 $condSet = new SeqConditionSet(false);
870
871 $conditions = array();
872 $tempVal=$iNode->getAttribute("conditionCombination");
873 if ($tempVal) {
874 $condSet->mCombination=$tempVal;
875 } else {
876 $condSet->mCombination=COMBINATION_ALL;
877 }
878 $condInfo = $iNode->childNodes;
879 for ($i = 0; $i < $condInfo->length; $i++) {
880 $curCond=$condInfo->item($i);
881 if ($curCond->nodeType == XML_ELEMENT_NODE) {
882 if ($curCond->localName == "ruleCondition") {
883 $cond = new SeqCondition();
884
885 //look for condition
886 $tempVal=$curCond->getAttribute("condition");
887 if ($tempVal) {
888 $cond->mCondition = $tempVal;
889 }
890
891 // Look for 'referencedObjective'
892 $tempVal=preg_replace('/(%20)+/', ' ', trim($curCond->getAttribute("referencedObjective")));
893 if ($tempVal) {
894 $cond->mObjID = $tempVal;
895 }
896
897 // Look for 'measureThreshold'
898 $tempVal=$curCond->getAttribute("measureThreshold");
899 if ($tempVal) {
900 $cond->mThreshold = $tempVal;
901 }
902
903 // Look for 'operator'
904 $tempVal = $curCond->getAttribute("operator");
905 if ($tempVal) {
906 if ($tempVal == 'not') {
907 $cond->mNot = true;
908 } else {
909 $cond->mNot = false;
910 }
911 }
912
913 //add class
914 $c_cond['_SeqCondition']=$cond;
915 array_push($conditions, $c_cond);
916 }
917 }
918 }
919
920 if (count($conditions)>0) {
921 $condSet->mConditions = $conditions;
922 } else {
923 $condSet->mConditions = null;
924 }
925 //add class
926 $c_condSet['_SeqConditionSet']=$condSet;
927 return $c_condSet;
928 }
const COMBINATION_ALL

References $i, and COMBINATION_ALL.

Referenced by getSequencingRules().

+ Here is the caller graph for this function:

◆ fillinADLSeqMaps()

static SeqTreeBuilder::fillinADLSeqMaps (   $iNode,
  $map 
)
static

Definition at line 556 of file SeqTreeBuilder.php.

557 {
558 if ($map->mGlobalObjID == null) {
559 $map->mGlobalObjID = preg_replace('/(%20)+/', ' ', trim($iNode->getAttribute("targetObjectiveID")));
560 }
561
562 $tempVal = $iNode->getAttribute("readRawScore");
563 if ($tempVal) {
564 $map->mReadRawScore = self::convert_to_bool($tempVal);
565 }
566
567 $tempVal = $iNode->getAttribute("readMinScore");
568 if ($tempVal) {
569 $map->mReadMinScore = self::convert_to_bool($tempVal);
570 }
571
572 $tempVal = $iNode->getAttribute("readMaxScore");
573 if ($tempVal) {
574 $map->mReadMaxScore = self::convert_to_bool($tempVal);
575 }
576
577 $tempVal = $iNode->getAttribute("readCompletionStatus");
578 if ($tempVal) {
579 $map->mReadCompletionStatus = self::convert_to_bool($tempVal);
580 }
581
582 $tempVal = $iNode->getAttribute("readProgressMeasure");
583 if ($tempVal) {
584 $map->mReadProgressMeasure = self::convert_to_bool($tempVal);
585 }
586
587 $tempVal = $iNode->getAttribute("writeRawScore");
588 if ($tempVal) {
589 $map->mWriteRawScore = self::convert_to_bool($tempVal);
590 }
591
592 $tempVal = $iNode->getAttribute("writeMinScore");
593 if ($tempVal) {
594 $map->mWriteMinScore = self::convert_to_bool($tempVal);
595 }
596
597 $tempVal = $iNode->getAttribute("writeMaxScore");
598 if ($tempVal) {
599 $map->mWriteMaxScore = self::convert_to_bool($tempVal);
600 }
601
602 $tempVal = $iNode->getAttribute("writeCompletionStatus");
603 if ($tempVal) {
604 $map->mWriteCompletionStatus = self::convert_to_bool($tempVal);
605 }
606
607 $tempVal = $iNode->getAttribute("writeProgressMeasure");
608 if ($tempVal) {
609 $map->mWriteProgressMeasure = self::convert_to_bool($tempVal);
610 }
611
612 return $map;
613 }
static convert_to_bool($string)

References convert_to_bool().

Referenced by getADLSeqMaps().

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

◆ getADLSeqMaps()

static SeqTreeBuilder::getADLSeqMaps (   $iNode,
  $curseqobj 
)
static

Definition at line 517 of file SeqTreeBuilder.php.

518 {
519 if (count($curseqobj->mMaps)==null) {
520 $curseqobj->mMaps = array();
521 }
522 $maps = $curseqobj->mMaps;
523
524 $children = $iNode->childNodes;
525 for ($i = 0; $i < $children->length; $i++) {
526 $curNode=$children->item($i);
527 if ($curNode->nodeType == XML_ELEMENT_NODE) {
528 if ($curNode->localName == "mapInfo") {
529 $map = new SeqObjectiveMap();
530 $curadltargetobjid = preg_replace('/(%20)+/', ' ', trim($curNode->getAttribute("targetObjectiveID")));
531 // if the adl map target id matches an imsssssss one, then add to the imsssss one
532 $matchingmapindex = -1;
533 for ($j = 0; $j < count($maps); $j++) {
534 if ($maps[$j]['_SeqObjectiveMap']->mGlobalObjID == $curadltargetobjid) {
535 $map = $maps[$j]['_SeqObjectiveMap'];
536 $matchingmapindex = $j;
537 }
538 }
539 // tom: if default access is dependent on map existence then this will need to know if an imsss:mapInfo existed
540 $map = self::fillinADLSeqMaps($curNode, $map);
541
542 if ($matchingmapindex > -1) {
543 $c_map['_SeqObjectiveMap']=$map;
544 $maps[$matchingmapindex] = $c_map;
545 } else {
546 $c_map['_SeqObjectiveMap']=$map;
547 array_push($maps, $c_map);
548 }
549 }
550 }
551 }
552 $curseqobj->mMaps = $maps;
553 return $curseqobj;
554 }
static fillinADLSeqMaps($iNode, $map)

References $i, and fillinADLSeqMaps().

Referenced by getADLSEQObjectives().

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

◆ getADLSEQObjectives()

static SeqTreeBuilder::getADLSEQObjectives (   $iNode,
  $ioAct 
)
static

Definition at line 478 of file SeqTreeBuilder.php.

479 {
480 global $ilLog;
481 $objectives = $ioAct->mObjectives;
482 $children = $iNode->childNodes;
483 for ($i = 0; $i < $children->length; $i++) {
484 $curNode=$children->item($i);
485 if ($curNode->nodeType == XML_ELEMENT_NODE) {
486 if ($curNode->localName == "objective") {
487 // get the objectiveID
488 $adlseqobjid = preg_replace('/(%20)+/', ' ', trim($curNode->getAttribute("objectiveID")));
489
490 // find the imsss objective with the same objectiveID
491 $curseqobj = null;
492 for ($j = 0; $j < count($objectives); $j++) {
493 $seqobj = $objectives[$j]['_SeqObjective'];
494 if ($seqobj->mObjID == $adlseqobjid) {
495 $curseqobj = $seqobj;
496 $curseqobjindex = $j;
497 break;
498 }
499 }
500
501 // if there's a current seq then let's add the maps
502 if ($curseqobj != null) {
503 // for each adlseq map info populate that mMaps with map info in the adlseq objective
504 $curseqobj = self::getADLSeqMaps($curNode, $curseqobj);
505 $seqobj = $curseqobj;
506 $objectives[$curseqobjindex]['_SeqObjective'] = $seqobj;
507 }
508 }
509 }
510 }
511 // before i leave what do i have to duplicate in SeqActivity or some other class?
512 // prolly just
513 $ioAct->setObjectives($objectives);
514 return $ioAct;
515 }
static getADLSeqMaps($iNode, $curseqobj)

References $i, $ilLog, and getADLSeqMaps().

Referenced by extractSeqInfo().

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

◆ getAuxResources()

static SeqTreeBuilder::getAuxResources (   $iNode,
  $ioAct 
)
static

Definition at line 930 of file SeqTreeBuilder.php.

931 {
932 $ok = true;
933 $tempVal = null;
934 $auxRes = array();
935 //get children
936 $children = $iNode->childNodes;
937
938 //find ressources
939 for ($i = 0; $i < $children->length; $i++) {
940 $curNode=$children->item($i);
941 if ($curNode->nodeType == XML_ELEMENT_NODE) {
942 if ($curNode->localName == "auxiliaryResource") {
943 //found it
945
946 // Get the resource's purpose
947 $tempVal=$curNode->getAttribute("purpose");
948 if ($tempVal) {
949 $res->mType = $tempVal;
950 }
951 // Get the resource's ID
952 $tempVal=preg_replace('/(%20)+/', ' ', trim($curNode->getAttribute("auxiliaryResourceID")));
953 if ($tempVal) {
954 $res->mResourceID = $tempVal;
955 }
956 array_push($auxRes, $res);
957 }
958 }
959 }
960 //add class
961 $c_auxRes['_ADLAuxiliaryResource']=$auxRes;
962 $ioAct->setAuxResources($c_auxRes);
963 return $ioAct;
964 }
foreach($_POST as $key=> $value) $res

References $i, $ok, and $res.

Referenced by extractSeqInfo().

+ Here is the caller graph for this function:

◆ getObjectiveMaps()

static SeqTreeBuilder::getObjectiveMaps (   $iNode)
static

Definition at line 615 of file SeqTreeBuilder.php.

616 {
617 $tempVal = null;
618 $maps = array();
619 $children = $iNode->childNodes;
620 for ($i = 0; $i < $children->length; $i++) {
621 $curNode=$children->item($i);
622 if ($curNode->nodeType == XML_ELEMENT_NODE) {
623 if ($curNode->localName == "mapInfo") {
624 $map = new SeqObjectiveMap();
625
626 // Look for 'targetObjectiveID'
627 $tempVal = preg_replace('/(%20)+/', ' ', trim($curNode->getAttribute("targetObjectiveID")));
628 if ($tempVal) {
629 $map->mGlobalObjID = $tempVal;
630 }
631
632 // Look for 'readSatisfiedStatus'
633 $tempVal = $curNode->getAttribute("readSatisfiedStatus");
634 if ($tempVal) {
635 $map->mReadStatus = self::convert_to_bool($tempVal);
636 }
637
638 // Look for 'readNormalizedMeasure'
639 $tempVal = $curNode->getAttribute("readNormalizedMeasure");
640 if ($tempVal) {
641 $map->mReadMeasure = self::convert_to_bool($tempVal);
642 }
643
644 // Look for 'writeSatisfiedStatus'
645 $tempVal = $curNode->getAttribute("writeSatisfiedStatus");
646 if ($tempVal) {
647 $map->mWriteStatus = self::convert_to_bool($tempVal);
648 }
649
650 // Look for 'writeNormalizedMeasure'
651 $tempVal = $curNode->getAttribute("writeNormalizedMeasure");
652 if ($tempVal) {
653 $map->mWriteMeasure = self::convert_to_bool($tempVal);
654 }
655 //add class
656 $c_map['_SeqObjectiveMap']=$map;
657 array_push($maps, $c_map);
658 }
659 }
660 }
661 if (count($maps)==null) {
662 $maps = null;
663 }
664 return $maps;
665 }

References $i, and convert_to_bool().

Referenced by getObjectives().

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

◆ getObjectives()

static SeqTreeBuilder::getObjectives (   $iNode,
  $ioAct 
)
static

Definition at line 427 of file SeqTreeBuilder.php.

428 {
429 global $ilLog;
430
431
432 $ok = true;
433 $tempVal = null;
434 $objectives = array();
435 $children = $iNode->childNodes;
436 for ($i = 0; $i < $children->length; $i++) {
437 $curNode=$children->item($i);
438 if ($curNode->nodeType == XML_ELEMENT_NODE) {
439 if ($curNode->localName == "primaryObjective" || $curNode->localName == "objective") {
440 $obj = new SeqObjective();
441 if ($curNode->localName == "primaryObjective") {
442 $obj->mContributesToRollup = true;
443 }
444
445 // Look for 'objectiveID'
446 $tempVal = preg_replace('/(%20)+/', ' ', trim($curNode->getAttribute("objectiveID")));
447 if ($tempVal) {
448 $obj->mObjID = $tempVal;
449 }
450
451 // Look for 'satisfiedByMeasure'
452 $tempVal = $curNode->getAttribute("satisfiedByMeasure");
453 if ($tempVal) {
454 $obj->mSatisfiedByMeasure = self::convert_to_bool($tempVal);
455 }
456 // Look for 'minNormalizedMeasure'
457 $tempVal=self::lookupElement($curNode, "minNormalizedMeasure");
458 if ($tempVal) {
459 $obj->mMinMeasure = $tempVal;
460 }
461
462 //get ObjectiveMaps
463 $maps = self::getObjectiveMaps($curNode);
464 if ($maps != null) {
465 $obj->mMaps = $maps;
466 }
467 //$obj->mContributesToRollup = true;
468 //add class
469 $c_obj['_SeqObjective'] = $obj;
470 array_push($objectives, $c_obj);
471 }
472 }
473 }
474 $ioAct->setObjectives($objectives);
475 return $ioAct;
476 }
static getObjectiveMaps($iNode)

References $i, $ilLog, $ok, convert_to_bool(), getObjectiveMaps(), and lookupElement().

Referenced by extractSeqInfo().

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

◆ getRollupRules()

static SeqTreeBuilder::getRollupRules (   $iNode,
  $ioAct 
)
static

Definition at line 667 of file SeqTreeBuilder.php.

668 {
669 $ok = true;
670 $tempVal = null;
671 $rollupRules = array();
672
673 // Look for 'rollupObjectiveSatisfied'
674 $tempVal = $iNode->getAttribute("rollupObjectiveSatisfied");
675 if ($tempVal) {
676 $ioAct->setIsObjRolledUp(self::convert_to_bool($tempVal));
677 }
678
679 // Look for 'objectiveMeasureWeight'
680 $tempVal = $iNode->getAttribute("objectiveMeasureWeight");
681 if ($tempVal) {
682 $ioAct->setObjMeasureWeight($tempVal);
683 }
684 // Look for 'rollupProgressCompletion'
685 $tempVal = $iNode->getAttribute("rollupProgressCompletion");
686 if ($tempVal) {
687 $ioAct->setIsProgressRolledUp(self::convert_to_bool($tempVal));
688 }
689 $children = $iNode->childNodes;
690 for ($i = 0; $i < $children->length; $i++) {
691 $curNode=$children->item($i);
692 if ($curNode->nodeType == XML_ELEMENT_NODE) {
693 if ($curNode->localName == "rollupRule") {
694 $rule = new SeqRollupRule();
695
696 // Look for 'childActivitySet'
697 $tempVal=$curNode->getAttribute("childActivitySet");
698 if ($tempVal) {
699 $rule->mChildActivitySet = $tempVal;
700 }
701 // Look for 'minimumCount'
702 $tempVal=$curNode->getAttribute("minimumCount");
703 if ($tempVal) {
704 $rule->mMinCount = $tempVal;
705 }
706
707 // Look for 'minimumPercent'
708 $tempVal=$curNode->getAttribute("minimumPercent");
709 if ($tempVal) {
710 $rule->mMinPercent = $tempVal;
711 }
712 $rule->mConditions['_SeqConditionSet'] = new SeqConditionSet(true);
713 $conditions = array();
714 $ruleInfo = $curNode->childNodes;
715 for ($j = 0; $j < $ruleInfo->length; $j++) {
716 $curRule=$ruleInfo->item($j);
717 //check for element
718 if ($curRule->nodeType == XML_ELEMENT_NODE) {
719 if ($curRule->localName == "rollupConditions") {
720 $tempVal = $curRule->getAttribute("conditionCombination");
721 if ($tempVal) {
722 $rule->mConditions['_SeqConditionSet']->mCombination = $tempVal;
723 } else {
724 $rule->mConditions['_SeqConditionSet']->mCombination = COMBINATION_ANY;
725 }
726 $conds = $curRule->childNodes;
727 for ($k = 0; $k < $conds->length; $k++) {
728 $con=$conds->item($k);
729 if ($con->nodeType == XML_ELEMENT_NODE) {
730 if ($con->localName == "rollupCondition") {
731 $cond = new SeqCondition();
732 // Look for 'condition'
733 $tempVal = $con->getAttribute("condition");
734 if ($tempVal) {
735 $cond->mCondition=$tempVal;
736 }
737 // Look for 'operator'
738 $tempVal = $con->getAttribute("operator");
739 if ($tempVal) {
740 if ($tempVal=='not') {
741 $cond->mNot = true;
742 } else {
743 $cond->mNot = false;
744 }
745 }
746 //add class
747 $c_cond['_SeqCondition'] = $cond;
748 array_push($conditions, $c_cond);
749 }
750 }
751 }
752 } elseif ($curRule->localName == "rollupAction") {
753 $tempVal = $curRule->getAttribute("action");
754 if ($tempVal) {
755 $rule->setRollupAction($tempVal);
756 }
757 }
758 }
759 }
760 // Add the conditions to the condition set for the rule
761 $rule->mConditions['_SeqConditionSet']->mConditions = $conditions;
762
763 // Add the rule to the ruleset
764 //add class
765 $c_rule['_SeqRollupRule']=$rule;
766 array_push($rollupRules, $c_rule);
767 }
768 }
769 }
770
771 if ($rollupRules != null) {
772 $rules = new SeqRollupRuleset($rollupRules);
773 // Set the Activity's rollup rules
774 //add class
775 $c_rules['_SeqRollupRuleset']=$rules;
776 $ioAct->setRollupRules($c_rules);
777 }
778
779 return $ioAct;
780 }
const COMBINATION_ANY
$rule
Definition: showstats.php:43

References $i, $ok, $rule, and COMBINATION_ANY.

Referenced by extractSeqInfo().

+ Here is the caller graph for this function:

◆ getSequencingRules()

static SeqTreeBuilder::getSequencingRules (   $iNode,
  $ioAct 
)
static

Definition at line 783 of file SeqTreeBuilder.php.

784 {
785 //local variables
786 $ok = true;
787 $tempVal = null;
788
789 $preRules = array();
790 $exitRules = array();
791 $postRules = array();
792
793 //get children
794 $children = $iNode->childNodes;
795
796 //find sequencing rules
797 for ($i = 0; $i < $children->length; $i++) {
798 $curNode=$children->item($i);
799 if ($curNode->nodeType == XML_ELEMENT_NODE) {
800 if ($curNode->localName == "preConditionRule" || $curNode->localName == "exitConditionRule" || $curNode->localName == "postConditionRule") {
801 $rule = new SeqRule();
802 $ruleInfo = $curNode->childNodes;
803 for ($j = 0; $j < $ruleInfo->length; $j++) {
804 $curRule=$ruleInfo->item($j);
805 //echo "$curRule->localName\n";
806 if ($curRule->nodeType == XML_ELEMENT_NODE) {
807 if ($curRule->localName == "ruleConditions") {
808 $rule->mConditions = self::extractSeqRuleConditions($curRule);
809 } elseif ($curRule->localName == "ruleAction") {
810 $tempVal=$curRule->getAttribute("action");
811 if ($tempVal) {
812 $rule->mAction = $tempVal;
813 }
814 }
815 }
816 }//end for inner
817 if ($rule->mConditions != null && $rule->mAction != null) {
818 //changed from ADL Code..
819 if ($curNode->localName == "preConditionRule") {
820 //echo "ADD PRE";
821 //add class
822 $c_rule['_SeqRule'] = $rule;
823 array_push($preRules, $c_rule);
824 }
825 if ($curNode->localName == "exitConditionRule") {
826 //echo "ADD EXIT";
827 //add class
828 $c_rule['_SeqRule'] = $rule;
829 array_push($exitRules, $c_rule);
830 }
831 if ($curNode->localName == "postConditionRule") {
832 //echo "ADD POST";
833 //add class
834 $c_rule['_SeqRule'] = $rule;
835 array_push($postRules, $c_rule);
836 }
837 }
838 } //end if preCondition
839 } //end if ELEMENT
840 }
841
842 if (count($preRules) > 0) {
843 $rules = new SeqRuleset($preRules);
844 //add class
845 $c_rules['_SeqRuleset']=$rules;
846 $ioAct->setPreSeqRules($c_rules);
847 }
848
849 if (count($exitRules) > 0) {
850 $rules = new SeqRuleset($exitRules);
851 //add class
852 $c_rules['_SeqRuleset']=$rules;
853 $ioAct->setExitSeqRules($c_rules);
854 }
855 if (count($postRules) > 0) {
856 $rules = new SeqRuleset($postRules);
857 //add class
858 $c_rules['_SeqRuleset']=$rules;
859 $ioAct->setPostSeqRules($c_rules);
860 }
861 //echo json_encode($ioAct);
862
863 return $ioAct;
864 }
static extractSeqRuleConditions($iNode)

References $i, $ok, $rule, and extractSeqRuleConditions().

Referenced by extractSeqInfo().

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

◆ lookupElement()

static SeqTreeBuilder::lookupElement (   $iNode,
  $iElement 
)
staticprivate

Definition at line 978 of file SeqTreeBuilder.php.

979 {
980 $value = null;
981 $curNode = null;
982 $children = null;
983
984 if ($iNode != null && $iElement != null) {
985 $children = $iNode->childNodes;
986 for ($i = 0; $i < $children->length; $i++) {
987 $curNode = $children->item($i);
988 if (($curNode->nodeType == XML_ELEMENT_NODE)) {
989 if ($curNode->localName == $iElement) {
990 break;
991 }
992 }
993 }
994 if ($curNode != null) {
995 $comp = $curNode->localName;
996 if ($comp != null) {
997 if ($comp != $iElement) {
998 $curNode = null;
999 }
1000 } else {
1001 $curNode = null;
1002 }
1003 }
1004 } else {
1005 //$iElement is null
1006 $curNode = $iNode;
1007 }
1008
1009 if ($curNode != null) {
1010 $children = $curNode->childNodes;
1011 if ($children != null) {
1012 for ($i = 0; $i < $children->length; $i++) {
1013 $curNode = $children->item($i);
1014 // make sure we have a 'text' element
1015 if (($curNode->nodeType == XML_TEXT_NODE) ||($curNode->nodeType == XML_CDATA_SECTION_NODE)) {
1016 $value = $value . $curNode->nodeValue;
1017 }
1018 }
1019 }
1020 }
1021 return $value;
1022 }

References $i.

Referenced by buildNode(), and getObjectives().

+ Here is the caller graph for this function:

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