ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 
 lookupElement ($iNode, $iElement)
 

Static Private Member Functions

static convert_to_bool ($string)
 

Detailed Description

Definition at line 67 of file SeqTreeBuilder.php.

Member Function Documentation

◆ buildNode()

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

Definition at line 128 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
154 $curNode=$children->item($i);
155 //elements only
156
157 if ($curNode->nodeType == XML_ELEMENT_NODE) {
158 //only items are nested
159 if ($curNode->localName == "item") {
160 //init;
161 $c_nestedAct=null;
162 $nestedAct = new SeqActivity();
163 $nestedAct = $this->buildNode($curNode,$seq,$doc);
164 if ($nestedAct != null ) {
165 $act->AddChild($nestedAct);
166 }
167 }
168 else if ($curNode->localName == "title") {
169 $act->setTitle($this->lookupElement($curNode,null));
170 }
171 else if ($curNode->localName == "completionThreshold"){
172 $tempVal = $curNode->getAttribute("minProgressMeasure");
173
174 if ($tempVal){
175 $act->setCompletionThreshold($tempVal);
176 }
177 else if ($curNode->nodeValue != null && $curNode->nodeValue != '') {
178 $act->setCompletionThreshold($curNode->nodeValue);
179 }
180
181 $tempVal = $curNode->getAttribute("progressWeight");
182
183 if ($tempVal){
184 $act->setProgressWeight($tempVal);
185 }
186 $tempVal = $curNode->getAttribute("completedByMeasure");
187
188 if ($tempVal){
189 $act->setCompletedByMeasure(self::convert_to_bool($tempVal));
190 }
191 }
192 else if ($curNode->localName == "sequencing") {
193 $seqInfo = $curNode;
194 //get IDRef
195 $tempVal = preg_replace('/(%20)+/', ' ', trim($curNode->getAttribute("IDRef")));
196 //only execute for referenced sequencing parts
197 if ($tempVal) {
198 //init seqGlobal
199 $seqGlobal = null;
200
201 //get all sequencing nodes in collections
202 $sequencing = $seq->getElementsByTagName("sequencing");
203
204 //lookup the matching sequencing element
205 foreach ($sequencing as $element) {
206 if (preg_replace('/(%20)+/', ' ', trim($element->getAttribute("ID")))==$tempVal) {
207 $seqGlobal = $element;
208 }
209 }
210
211 //clone the global node
212 $seqInfo = $seqGlobal->cloneNode(TRUE);
213
214 //back to the local node
215 $seqChildren = $curNode->childNodes;
216 for ($j = 0; $j < $seqChildren->length; $j++ ) {
217 //process local nodes
218 $curChild = $seqChildren->item($j);
219 if ( $curChild->nodeType == XML_ELEMENT_NODE ) {
220 //echo "\nFound Sequencing Element Node".$curChild->localName;
221 //add local to global sequencing info
222 $seqInfo->appendChild($curChild);
223
224 }
225 }
226 }
227 //extract the sequencing info, if we have one
228 //avoid working with
229 $act=$this->extractSeqInfo($seqInfo, $act);
230
231 }
232 }
233
234
235
236 $item=$children->item($i)->nodeValue;
237 }
238 //add class
239 //$c_act['_SeqActivity']=$act;
240 return $act;
241
242 }
buildNode($node, $seq, $doc)
lookupElement($iNode, $iElement)
extractSeqInfo($iNode, $ioAct)

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

69 {
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
124 }
print $file

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

+ Here is the call graph for this function:

◆ convert_to_bool()

static SeqTreeBuilder::convert_to_bool (   $string)
staticprivate

Definition at line 997 of file SeqTreeBuilder.php.

997 {
998 if (strtoupper($string)=="FALSE") {
999 return false;
1000 } else {
1001 return true;
1002 }
1003 }

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

+ Here is the caller graph for this function:

◆ extractSeqInfo()

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

Definition at line 245 of file SeqTreeBuilder.php.

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

References 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 894 of file SeqTreeBuilder.php.

894 {
895
896 $tempVal = null;
897 $condSet = new SeqConditionSet(false);
898
899 $conditions = array();
900 $tempVal=$iNode->getAttribute("conditionCombination");
901 if ($tempVal) {
902 $condSet->mCombination=$tempVal;
903 } else {
904 $condSet->mCombination=COMBINATION_ALL;
905 }
906 $condInfo = $iNode->childNodes;
907 for ($i = 0; $i < $condInfo->length; $i++ ) {
908 $curCond=$condInfo->item($i);
909 if ($curCond->nodeType == XML_ELEMENT_NODE) {
910 if ($curCond->localName == "ruleCondition") {
911 $cond = new SeqCondition();
912
913 //look for condition
914 $tempVal=$curCond->getAttribute("condition");
915 if ($tempVal) {
916 $cond->mCondition = $tempVal;
917 }
918
919 // Look for 'referencedObjective'
920 $tempVal=preg_replace('/(%20)+/', ' ', trim($curCond->getAttribute("referencedObjective")));
921 if ($tempVal) {
922 $cond->mObjID = $tempVal;
923
924 }
925
926 // Look for 'measureThreshold'
927 $tempVal=$curCond->getAttribute("measureThreshold");
928 if ($tempVal) {
929 $cond->mThreshold = $tempVal;
930 }
931
932 // Look for 'operator'
933 $tempVal = $curCond->getAttribute("operator");
934 if ($tempVal) {
935 if ($tempVal == 'not') {
936 $cond->mNot = true;
937 } else {
938 $cond->mNot = false;
939 }
940 }
941
942 //add class
943 $c_cond['_SeqCondition']=$cond;
944 array_push($conditions,$c_cond);
945
946 }
947 }
948 }
949
950 if (count($conditions)>0) {
951 $condSet->mConditions = $conditions;
952 } else {
953 $condSet->mConditions = null;
954 }
955 //add class
956 $c_condSet['_SeqConditionSet']=$condSet;
957 return $c_condSet;
958 }
const COMBINATION_ALL

References COMBINATION_ALL.

Referenced by getSequencingRules().

+ Here is the caller graph for this function:

◆ fillinADLSeqMaps()

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

Definition at line 582 of file SeqTreeBuilder.php.

582 {
583
584 if($map->mGlobalObjID == null) $map->mGlobalObjID = preg_replace('/(%20)+/', ' ', trim($iNode->getAttribute("targetObjectiveID")));
585
586 $tempVal = $iNode->getAttribute("readRawScore");
587 if($tempVal) {
588 $map->mReadRawScore = self::convert_to_bool($tempVal);
589 }
590
591 $tempVal = $iNode->getAttribute("readMinScore");
592 if($tempVal) {
593 $map->mReadMinScore = self::convert_to_bool($tempVal);
594 }
595
596 $tempVal = $iNode->getAttribute("readMaxScore");
597 if($tempVal) {
598 $map->mReadMaxScore = self::convert_to_bool($tempVal);
599 }
600
601 $tempVal = $iNode->getAttribute("readCompletionStatus");
602 if($tempVal) {
603 $map->mReadCompletionStatus = self::convert_to_bool($tempVal);
604 }
605
606 $tempVal = $iNode->getAttribute("readProgressMeasure");
607 if($tempVal) {
608 $map->mReadProgressMeasure = self::convert_to_bool($tempVal);
609 }
610
611 $tempVal = $iNode->getAttribute("writeRawScore");
612 if($tempVal) {
613 $map->mWriteRawScore = self::convert_to_bool($tempVal);
614 }
615
616 $tempVal = $iNode->getAttribute("writeMinScore");
617 if($tempVal) {
618 $map->mWriteMinScore = self::convert_to_bool($tempVal);
619 }
620
621 $tempVal = $iNode->getAttribute("writeMaxScore");
622 if($tempVal) {
623 $map->mWriteMaxScore = self::convert_to_bool($tempVal);
624 }
625
626 $tempVal = $iNode->getAttribute("writeCompletionStatus");
627 if($tempVal) {
628 $map->mWriteCompletionStatus = self::convert_to_bool($tempVal);
629 }
630
631 $tempVal = $iNode->getAttribute("writeProgressMeasure");
632 if($tempVal) {
633 $map->mWriteProgressMeasure = self::convert_to_bool($tempVal);
634 }
635
636 return $map;
637 }
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 545 of file SeqTreeBuilder.php.

545 {
546 if (count($curseqobj->mMaps)==null) $curseqobj->mMaps = array();
547 $maps = $curseqobj->mMaps;
548
549 $children = $iNode->childNodes;
550 for ($i = 0; $i < $children->length; $i++ ) {
551 $curNode=$children->item($i);
552 if ($curNode->nodeType == XML_ELEMENT_NODE) {
553 if ($curNode->localName == "mapInfo") {
554 $map = new SeqObjectiveMap();
555 $curadltargetobjid = preg_replace('/(%20)+/', ' ', trim($curNode->getAttribute("targetObjectiveID")));
556 // if the adl map target id matches an imsssssss one, then add to the imsssss one
557 $matchingmapindex = -1;
558 for ( $j = 0; $j < count($maps); $j++ ){
559 if ($maps[$j]['_SeqObjectiveMap']->mGlobalObjID == $curadltargetobjid){
560 $map = $maps[$j]['_SeqObjectiveMap'];
561 $matchingmapindex = $j;
562 }
563 }
564// tom: if default access is dependent on map existence then this will need to know if an imsss:mapInfo existed
565 $map = self::fillinADLSeqMaps($curNode, $map);
566
567 if ( $matchingmapindex > -1 ){
568 $c_map['_SeqObjectiveMap']=$map;
569 $maps[$matchingmapindex] = $c_map;
570 }
571 else{
572 $c_map['_SeqObjectiveMap']=$map;
573 array_push($maps, $c_map);
574 }
575 }
576 }
577 }
578 $curseqobj->mMaps = $maps;
579 return $curseqobj;
580 }
static fillinADLSeqMaps($iNode, $map)

References 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 506 of file SeqTreeBuilder.php.

506 {
507 global $ilLog;
508 $objectives = $ioAct->mObjectives;
509 $children = $iNode->childNodes;
510 for ($i = 0; $i < $children->length; $i++ ) {
511 $curNode=$children->item($i);
512 if ($curNode->nodeType == XML_ELEMENT_NODE) {
513 if ($curNode->localName == "objective" ) {
514 // get the objectiveID
515 $adlseqobjid = preg_replace('/(%20)+/', ' ', trim($curNode->getAttribute("objectiveID")));
516
517 // find the imsss objective with the same objectiveID
518 $curseqobj = null;
519 for ( $j = 0; $j < count($objectives); $j++ ){
520 $seqobj = $objectives[$j]['_SeqObjective'];
521 if ( $seqobj->mObjID == $adlseqobjid ){
522 $curseqobj = $seqobj;
523 $curseqobjindex = $j;
524 break;
525 }
526 }
527
528 // if there's a current seq then let's add the maps
529 if ( $curseqobj != null ){
530 // for each adlseq map info populate that mMaps with map info in the adlseq objective
531 $curseqobj = self::getADLSeqMaps($curNode, $curseqobj);
532 $seqobj = $curseqobj;
533 $objectives[$curseqobjindex]['_SeqObjective'] = $seqobj;
534 }
535
536 }
537 }
538 }
539 // before i leave what do i have to duplicate in SeqActivity or some other class?
540 // prolly just
541 $ioAct->setObjectives($objectives);
542 return $ioAct;
543 }
static getADLSeqMaps($iNode, $curseqobj)

References $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 960 of file SeqTreeBuilder.php.

960 {
961 $ok = true;
962 $tempVal = null;
963 $auxRes = array();
964 //get children
965 $children = $iNode->childNodes;
966
967 //find ressources
968 for ($i = 0; $i < $children->length; $i++ ) {
969 $curNode=$children->item($i);
970 if ($curNode->nodeType == XML_ELEMENT_NODE) {
971 if ($curNode->localName == "auxiliaryResource") {
972 //found it
974
975 // Get the resource's purpose
976 $tempVal=$curNode->getAttribute("purpose");
977 if ($tempVal) {
978 $res->mType = $tempVal;
979 }
980 // Get the resource's ID
981 $tempVal=preg_replace('/(%20)+/', ' ', trim($curNode->getAttribute("auxiliaryResourceID")));
982 if ($tempVal) {
983 $res->mResourceID = $tempVal;
984 }
985 array_push($auxRes,$res);
986 }
987 }
988 }
989 //add class
990 $c_auxRes['_ADLAuxiliaryResource']=$auxRes;
991 $ioAct->setAuxResources($c_auxRes);
992 return $ioAct;
993 }

References $ok, and $res.

Referenced by extractSeqInfo().

+ Here is the caller graph for this function:

◆ getObjectiveMaps()

static SeqTreeBuilder::getObjectiveMaps (   $iNode)
static

Definition at line 639 of file SeqTreeBuilder.php.

639 {
640 $tempVal = null;
641 $maps = array();
642 $children = $iNode->childNodes;
643 for ($i = 0; $i < $children->length; $i++ ) {
644 $curNode=$children->item($i);
645 if ($curNode->nodeType == XML_ELEMENT_NODE) {
646 if ($curNode->localName == "mapInfo") {
647 $map = new SeqObjectiveMap();
648
649 // Look for 'targetObjectiveID'
650 $tempVal = preg_replace('/(%20)+/', ' ', trim($curNode->getAttribute("targetObjectiveID")));
651 if($tempVal) {
652 $map->mGlobalObjID = $tempVal;
653 }
654
655 // Look for 'readSatisfiedStatus'
656 $tempVal = $curNode->getAttribute("readSatisfiedStatus");
657 if($tempVal) {
658 $map->mReadStatus = self::convert_to_bool($tempVal);
659 }
660
661 // Look for 'readNormalizedMeasure'
662 $tempVal = $curNode->getAttribute("readNormalizedMeasure");
663 if($tempVal) {
664 $map->mReadMeasure = self::convert_to_bool($tempVal);
665 }
666
667 // Look for 'writeSatisfiedStatus'
668 $tempVal = $curNode->getAttribute("writeSatisfiedStatus");
669 if($tempVal) {
670 $map->mWriteStatus = self::convert_to_bool($tempVal);
671 }
672
673 // Look for 'writeNormalizedMeasure'
674 $tempVal = $curNode->getAttribute("writeNormalizedMeasure");
675 if($tempVal) {
676 $map->mWriteMeasure = self::convert_to_bool($tempVal);
677 }
678 //add class
679 $c_map['_SeqObjectiveMap']=$map;
680 array_push($maps,$c_map);
681 }
682 }
683 }
684 if (count($maps)==null) {
685 $maps = null;
686 }
687 return $maps;
688 }

References 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 455 of file SeqTreeBuilder.php.

455 {
456 global $ilLog;
457
458
459 $ok = true;
460 $tempVal = null;
461 $objectives = array();
462 $children = $iNode->childNodes;
463 for ($i = 0; $i < $children->length; $i++ ) {
464 $curNode=$children->item($i);
465 if ($curNode->nodeType == XML_ELEMENT_NODE) {
466 if ($curNode->localName == "primaryObjective" || $curNode->localName == "objective" ) {
467
468 $obj = new SeqObjective();
469 if ($curNode->localName == "primaryObjective") {
470 $obj->mContributesToRollup = true;
471 }
472
473 // Look for 'objectiveID'
474 $tempVal = preg_replace('/(%20)+/', ' ', trim($curNode->getAttribute("objectiveID")));
475 if($tempVal) {
476 $obj->mObjID = $tempVal;
477 }
478
479 // Look for 'satisfiedByMeasure'
480 $tempVal = $curNode->getAttribute("satisfiedByMeasure");
481 if($tempVal) {
482 $obj->mSatisfiedByMeasure = self::convert_to_bool($tempVal);
483 }
484 // Look for 'minNormalizedMeasure'
485 $tempVal=self::lookupElement($curNode,"minNormalizedMeasure");
486 if($tempVal) {
487 $obj->mMinMeasure = $tempVal;
488 }
489
490 //get ObjectiveMaps
491 $maps = self::getObjectiveMaps($curNode);
492 if ( $maps != null ){
493 $obj->mMaps = $maps;
494 }
495 //$obj->mContributesToRollup = true;
496 //add class
497 $c_obj['_SeqObjective'] = $obj;
498 array_push($objectives,$c_obj);
499 }
500 }
501 }
502 $ioAct->setObjectives($objectives);
503 return $ioAct;
504 }
static getObjectiveMaps($iNode)

References $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 690 of file SeqTreeBuilder.php.

690 {
691 $ok = true;
692 $tempVal = null;
693 $rollupRules = array();
694
695 // Look for 'rollupObjectiveSatisfied'
696 $tempVal = $iNode->getAttribute("rollupObjectiveSatisfied");
697 if($tempVal) {
698 $ioAct->setIsObjRolledUp(self::convert_to_bool($tempVal));
699 }
700
701 // Look for 'objectiveMeasureWeight'
702 $tempVal = $iNode->getAttribute("objectiveMeasureWeight");
703 if($tempVal) {
704 $ioAct->setObjMeasureWeight($tempVal);
705
706 }
707 // Look for 'rollupProgressCompletion'
708 $tempVal = $iNode->getAttribute("rollupProgressCompletion");
709 if($tempVal) {
710 $ioAct->setIsProgressRolledUp(self::convert_to_bool($tempVal));
711
712 }
713 $children = $iNode->childNodes;
714 for ($i = 0; $i < $children->length; $i++ ) {
715 $curNode=$children->item($i);
716 if ($curNode->nodeType == XML_ELEMENT_NODE) {
717 if ($curNode->localName == "rollupRule") {
718 $rule = new SeqRollupRule();
719
720 // Look for 'childActivitySet'
721 $tempVal=$curNode->getAttribute("childActivitySet");
722 if($tempVal) {
723 $rule->mChildActivitySet = $tempVal;
724 }
725 // Look for 'minimumCount'
726 $tempVal=$curNode->getAttribute("minimumCount");
727 if($tempVal) {
728 $rule->mMinCount = $tempVal;
729 }
730
731 // Look for 'minimumPercent'
732 $tempVal=$curNode->getAttribute("minimumPercent");
733 if($tempVal) {
734 $rule->mMinPercent = $tempVal;
735 }
736 $rule->mConditions['_SeqConditionSet'] = new SeqConditionSet(true);
737 $conditions = array();
738 $ruleInfo = $curNode->childNodes;
739 for ($j = 0; $j < $ruleInfo->length; $j++ ) {
740 $curRule=$ruleInfo->item($j);
741 //check for element
742 if ($curRule->nodeType == XML_ELEMENT_NODE) {
743 if ($curRule->localName == "rollupConditions") {
744 $tempVal = $curRule->getAttribute("conditionCombination");
745 if($tempVal) {
746 $rule->mConditions['_SeqConditionSet']->mCombination = $tempVal;
747 } else {
748 $rule->mConditions['_SeqConditionSet']->mCombination = COMBINATION_ANY;
749 }
750 $conds = $curRule->childNodes;
751 for ($k = 0; $k < $conds->length; $k++ ) {
752 $con=$conds->item($k);
753 if ($con->nodeType == XML_ELEMENT_NODE) {
754 if ($con->localName == "rollupCondition") {
755 $cond = new SeqCondition();
756 // Look for 'condition'
757 $tempVal = $con->getAttribute("condition");
758 if($tempVal) {
759 $cond->mCondition=$tempVal;
760 }
761 // Look for 'operator'
762 $tempVal = $con->getAttribute("operator");
763 if($tempVal) {
764 if($tempVal=='not') {$cond->mNot = true;} else {$cond->mNot = false;}
765 }
766 //add class
767 $c_cond['_SeqCondition'] = $cond;
768 array_push($conditions,$c_cond);
769 }
770
771 }
772 }
773 }
774 else if ($curRule->localName == "rollupAction") {
775 $tempVal = $curRule->getAttribute("action");
776 if ($tempVal) {
777 $rule->setRollupAction($tempVal);
778 }
779
780 }
781
782 }
783 }
784 // Add the conditions to the condition set for the rule
785 $rule->mConditions['_SeqConditionSet']->mConditions = $conditions;
786
787 // Add the rule to the ruleset
788 //add class
789 $c_rule['_SeqRollupRule']=$rule;
790 array_push($rollupRules,$c_rule);
791 }
792 }
793 }
794
795 if ( $rollupRules != null ) {
796 $rules = new SeqRollupRuleset($rollupRules);
797 // Set the Activity's rollup rules
798 //add class
799 $c_rules['_SeqRollupRuleset']=$rules;
800 $ioAct->setRollupRules($c_rules);
801 }
802
803 return $ioAct;
804 }
const COMBINATION_ANY

References $ok, and COMBINATION_ANY.

Referenced by extractSeqInfo().

+ Here is the caller graph for this function:

◆ getSequencingRules()

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

Definition at line 807 of file SeqTreeBuilder.php.

807 {
808 //local variables
809 $ok = true;
810 $tempVal = null;
811
812 $preRules = array();
813 $exitRules = array();
814 $postRules = array();
815
816 //get children
817 $children = $iNode->childNodes;
818
819 //find sequencing rules
820 for ($i = 0; $i < $children->length; $i++ ) {
821 $curNode=$children->item($i);
822 if ($curNode->nodeType == XML_ELEMENT_NODE) {
823 if ($curNode->localName == "preConditionRule" || $curNode->localName == "exitConditionRule" || $curNode->localName == "postConditionRule" ) {
824 $rule = new SeqRule();
825 $ruleInfo = $curNode->childNodes;
826 for ($j = 0; $j < $ruleInfo->length; $j++ ){
827 $curRule=$ruleInfo->item($j);
828 //echo "$curRule->localName\n";
829 if ($curRule->nodeType == XML_ELEMENT_NODE) {
830 if ($curRule->localName == "ruleConditions") {
831 $rule->mConditions = self::extractSeqRuleConditions($curRule);
832 }
833 else if($curRule->localName == "ruleAction"){
834 $tempVal=$curRule->getAttribute("action");
835 if($tempVal) {
836 $rule->mAction = $tempVal;
837 }
838 }
839
840 }
841 }//end for inner
842 if ( $rule->mConditions != null && $rule->mAction != null ) {
843 //changed from ADL Code..
844 if ($curNode->localName == "preConditionRule") {
845 //echo "ADD PRE";
846 //add class
847 $c_rule['_SeqRule'] = $rule;
848 array_push($preRules,$c_rule);
849 }
850 if ($curNode->localName == "exitConditionRule") {
851 //echo "ADD EXIT";
852 //add class
853 $c_rule['_SeqRule'] = $rule;
854 array_push($exitRules,$c_rule);
855 }
856 if ($curNode->localName == "postConditionRule") {
857 //echo "ADD POST";
858 //add class
859 $c_rule['_SeqRule'] = $rule;
860 array_push($postRules,$c_rule);
861 }
862 }
863 } //end if preCondition
864
865 } //end if ELEMENT
866 }
867
868 if ( count($preRules) > 0 ) {
869 $rules = new SeqRuleset($preRules);
870 //add class
871 $c_rules['_SeqRuleset']=$rules;
872 $ioAct->setPreSeqRules($c_rules);
873
874 }
875
876 if ( count($exitRules) > 0 ){
877 $rules = new SeqRuleset($exitRules);
878 //add class
879 $c_rules['_SeqRuleset']=$rules;
880 $ioAct->setExitSeqRules($c_rules);
881 }
882 if ( count($postRules) > 0 ){
883 $rules = new SeqRuleset($postRules);
884 //add class
885 $c_rules['_SeqRuleset']=$rules;
886 $ioAct->setPostSeqRules($c_rules);
887 }
888 //echo json_encode($ioAct);
889
890 return $ioAct;
891
892 }
static extractSeqRuleConditions($iNode)

References $ok, and extractSeqRuleConditions().

Referenced by extractSeqInfo().

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

◆ lookupElement()

SeqTreeBuilder::lookupElement (   $iNode,
  $iElement 
)
private

Definition at line 1006 of file SeqTreeBuilder.php.

1006 {
1007 $value = null;
1008 $curNode = null;
1009 $children = null;
1010
1011 if ( $iNode != null && $iElement != null ){
1012 $children = $iNode->childNodes;
1013 for ($i = 0; $i < $children->length; $i++ ) {
1014 $curNode = $children->item($i);
1015 if ( ($curNode->nodeType == XML_ELEMENT_NODE)) {
1016 if ($curNode->localName == $iElement) {
1017 break;
1018 }
1019 }
1020
1021 }
1022 if ($curNode != null ) {
1023 $comp = $curNode->localName;
1024 if ($comp != null) {
1025 if ($comp != $iElement) {
1026 $curNode = null;
1027 }
1028 } else {
1029 $curNode = null;
1030
1031 }
1032 }
1033
1034 }
1035 else {
1036 //$iElement is null
1037 $curNode = $iNode;
1038 }
1039
1040 if ( $curNode != null )
1041 {
1042 $children = $curNode->childNodes;
1043 if ( $children != null ) {
1044 for ($i = 0; $i < $children->length; $i++ ) {
1045 $curNode = $children->item($i);
1046 // make sure we have a 'text' element
1047 if ( ($curNode->nodeType == XML_TEXT_NODE) ||($curNode->nodeType == XML_CDATA_SECTION_NODE) )
1048 {
1049 $value = $value.$curNode->nodeValue;
1050 }
1051 }
1052 }
1053 }
1054 return $value;
1055 }

Referenced by buildNode(), and getObjectives().

+ Here is the caller graph for this function:

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