51 require_once(
"SeqActivity.php");
53 require_once(
"SeqRule.php");
54 require_once(
"SeqRuleset.php");
56 require_once(
"SeqCondition.php");
57 require_once(
"SeqConditionSet.php");
59 require_once(
"SeqObjective.php");
60 require_once(
"SeqObjectiveMap.php");
62 require_once(
"SeqRollupRule.php");
63 require_once(
"SeqRollupRuleset.php");
65 require_once(
"ADLAuxiliaryResource.php");
71 $doc =
new DomDocument();
73 $organizations = $doc->getElementsByTagName(
"organizations");
76 $default=$organizations->item(0)->getAttribute(
"default");
79 $organization = $doc->getElementsByTagName(
"organization");
82 foreach ($organization as $element) {
83 if ($element->getAttribute(
"identifier")==$default) {
84 $default_organization = $element;
89 $seqCollection = $doc->getElementsByTagName(
"sequencingCollection")->item(0);
91 $root = $this->
buildNode($default_organization,$seqCollection,$doc);
94 $objectivesGlobalToSystem = $default_organization->getAttributeNS(
"http://www.adlnet.org/xsd/adlseq_v1p3",
"objectivesGlobalToSystem");
96 $org = $default_organization->getAttribute(
"identifier");
101 if ($objectivesGlobalToSystem==
"false") {
106 $c_root[
'_SeqActivity']=$root;
108 $ret[
'global'] = $globaltosystem;
109 $ret[
'tree'] = $c_root;
124 $act->setID($node->getAttribute(
"identifier"));
126 $tempVal = $node->getAttribute(
"identifierref");
128 $act->setResourceID($tempVal);
131 $tempVal = $node->getAttribute(
"isvisible");
135 $act->setIsVisible(self::convert_to_bool($tempVal));
140 $children = $node->childNodes;
142 for ($i = 0; $i < $children->length; $i++ ) {
144 $curNode=$children->item($i);
147 if ($curNode->nodeType == XML_ELEMENT_NODE) {
149 if ($curNode->localName ==
"item") {
153 $nestedAct = $this->
buildNode($curNode,$seq,$doc);
154 if ($nestedAct != null ) {
155 $act->AddChild($nestedAct);
158 else if ($curNode->localName ==
"title") {
161 else if ($curNode->localName ==
"sequencing") {
164 $tempVal = $curNode->getAttribute(
"IDRef");
171 $sequencing = $seq->getElementsByTagName(
"sequencing");
174 foreach ($sequencing as $element) {
175 if ($element->getAttribute(
"ID")==$tempVal) {
176 $seqGlobal = $element;
181 $seqInfo = $seqGlobal->cloneNode(TRUE);
184 $seqChildren = $curNode->childNodes;
185 for ($j = 0; $j < $seqChildren->length; $j++ ) {
187 $curChild = $seqChildren->item($j);
188 if ( $curChild->nodeType == XML_ELEMENT_NODE ) {
191 $seqInfo->appendChild($curChild);
205 $item=$children->item($i)->nodeValue;
216 $children = $iNode->childNodes;
217 for ( $i = 0; $i < $children->length; $i++ ) {
218 $curNode = $children->item($i);
219 if ( $curNode->nodeType == XML_ELEMENT_NODE ) {
220 if ($curNode->localName ==
"controlMode") {
222 $tempVal=$curNode->getAttribute(
"choice");
224 $ioAct->setControlModeChoice(self::convert_to_bool($tempVal));
227 $tempVal=$curNode->getAttribute(
"choiceExit");
229 $ioAct->setControlModeChoiceExit(self::convert_to_bool($tempVal));
233 $tempVal=$curNode->getAttribute(
"flow");
235 $ioAct->setControlModeFlow(self::convert_to_bool($tempVal));
239 $tempVal=$curNode->getAttribute(
"forwardOnly");
241 $ioAct->setControlForwardOnly(self::convert_to_bool($tempVal));
245 $tempVal=$curNode->getAttribute(
"useCurrentAttemptObjectiveInfo");
247 $ioAct->setUseCurObjective(self::convert_to_bool($tempVal));
251 $tempVal=$curNode->getAttribute(
"useCurrentAttemptProgressInfo");
253 $ioAct->setUseCurProgress(self::convert_to_bool($tempVal));
258 else if ($curNode->localName ==
"sequencingRules") {
263 else if ($curNode->localName ==
"limitConditions") {
265 $tempVal=$curNode->getAttribute(
"attemptLimit");
267 $ioAct->setAttemptLimit($tempVal);
271 $tempVal=$curNode->getAttribute(
"attemptAbsoluteDurationLimit");
273 $ioAct->setAttemptAbDur($tempVal);
277 $tempVal=$curNode->getAttribute(
"attemptExperiencedDurationLimit");
279 $ioAct->setAttemptExDur($tempVal);
283 $tempVal=$curNode->getAttribute(
"activityAbsoluteDurationLimit");
285 $ioAct->setActivityAbDur($tempVal);
289 $tempVal=$curNode->getAttribute(
"activityExperiencedDurationLimit");
291 $ioAct->setActivityExDur($tempVal);
295 $tempVal=$curNode->getAttribute(
"beginTimeLimit");
297 $ioAct->setBeginTimeLimit($tempVal);
301 $tempVal=$curNode->getAttribute(
"endTimeLimit");
303 $ioAct->setEndTimeLimit($tempVal);
306 else if ($curNode->localName ==
"auxiliaryResources") {
310 else if ($curNode->localName ==
"rollupRules") {
314 else if ($curNode->localName ==
"objectives") {
318 else if ($curNode->localName ==
"randomizationControls") {
321 $tempVal=$curNode->getAttribute(
"randomizationTiming");
323 $ioAct->setRandomTiming($tempVal);
327 $tempVal=$curNode->getAttribute(
"selectCount");
329 $ioAct->setSelectCount($tempVal);
333 $tempVal=$curNode->getAttribute(
"reorderChildren");
335 $ioAct->setReorderChildren(self::convert_to_bool($tempVal));
339 $tempVal=$curNode->getAttribute(
"selectionTiming");
341 $ioAct->setSelectionTiming($tempVal);
344 else if ($curNode->localName ==
"deliveryControls") {
347 $tempVal=$curNode->getAttribute(
"tracked");
349 $ioAct->setIsTracked(self::convert_to_bool($tempVal));
353 $tempVal=$curNode->getAttribute(
"completionSetByContent");
355 $ioAct->setSetCompletion(self::convert_to_bool($tempVal));
359 $tempVal=$curNode->getAttribute(
"objectiveSetByContent");
361 $ioAct->setSetObjective(self::convert_to_bool($tempVal));
364 else if ($curNode->localName ==
"constrainedChoiceConsiderations") {
367 $tempVal=$curNode->getAttribute(
"preventActivation");
369 $ioAct->setPreventActivation(self::convert_to_bool($tempVal));
373 $tempVal=$curNode->getAttribute(
"constrainChoice");
375 $ioAct->setConstrainChoice(self::convert_to_bool($tempVal));
378 else if ($curNode->localName ==
"rollupConsiderations") {
381 $tempVal=$curNode->getAttribute(
"requiredForSatisfied");
383 $ioAct->setRequiredForSatisfied($tempVal);
387 $tempVal=$curNode->getAttribute(
"requiredForNotSatisfied");
389 $ioAct->setRequiredForNotSatisfied($tempVal);
393 $tempVal=$curNode->getAttribute(
"requiredForCompleted");
395 $ioAct->setRequiredForCompleted($tempVal);
399 $tempVal=$curNode->getAttribute(
"requiredForIncomplete");
401 $ioAct->setRequiredForIncomplete($tempVal);
405 $tempVal=$curNode->getAttribute(
"measureSatisfactionIfActive");
407 $ioAct->setSatisfactionIfActive(self::convert_to_bool($tempVal));
424 $objectives = array();
425 $children = $iNode->childNodes;
426 for ($i = 0; $i < $children->length; $i++ ) {
427 $curNode=$children->item($i);
428 if ($curNode->nodeType == XML_ELEMENT_NODE) {
429 if ($curNode->localName ==
"primaryObjective" || $curNode->localName ==
"objective" ) {
432 if ($curNode->localName ==
"primaryObjective") {
433 $obj->mContributesToRollup =
true;
437 $tempVal = $curNode->getAttribute(
"objectiveID");
439 $obj->mObjID = $tempVal;
443 $tempVal = $curNode->getAttribute(
"satisfiedByMeasure");
450 $obj->mMinMeasure = $tempVal;
455 if ( $maps != null ){
460 $c_obj[
'_SeqObjective'] = $obj;
461 array_push($objectives,$c_obj);
465 $ioAct->setObjectives($objectives);
473 $children = $iNode->childNodes;
474 for ($i = 0; $i < $children->length; $i++ ) {
475 $curNode=$children->item($i);
476 if ($curNode->nodeType == XML_ELEMENT_NODE) {
477 if ($curNode->localName ==
"mapInfo") {
481 $tempVal = $curNode->getAttribute(
"targetObjectiveID");
483 $map->mGlobalObjID = $tempVal;
487 $tempVal = $curNode->getAttribute(
"readSatisfiedStatus");
493 $tempVal = $curNode->getAttribute(
"readNormalizedMeasure");
499 $tempVal = $curNode->getAttribute(
"writeSatisfiedStatus");
505 $tempVal = $curNode->getAttribute(
"writeNormalizedMeasure");
510 $c_map[
'_SeqObjectiveMap']=
$map;
511 array_push($maps,$c_map);
515 if (count($maps)==null) {
524 $rollupRules = array();
527 $tempVal = $iNode->getAttribute(
"rollupObjectiveSatisfied");
529 $ioAct->setIsObjRolledUp(self::convert_to_bool($tempVal));
533 $tempVal = $iNode->getAttribute(
"objectiveMeasureWeight");
535 $ioAct->setObjMeasureWeight($tempVal);
539 $tempVal = $iNode->getAttribute(
"rollupProgressCompletion");
541 $ioAct->setIsProgressRolledUp(self::convert_to_bool($tempVal));
544 $children = $iNode->childNodes;
545 for ($i = 0; $i < $children->length; $i++ ) {
546 $curNode=$children->item($i);
547 if ($curNode->nodeType == XML_ELEMENT_NODE) {
548 if ($curNode->localName ==
"rollupRule") {
552 $tempVal=$curNode->getAttribute(
"childActivitySet");
554 $rule->mChildActivitySet = $tempVal;
557 $tempVal=$curNode->getAttribute(
"minimumCount");
559 $rule->mMinCount = $tempVal;
563 $tempVal=$curNode->getAttribute(
"minimumPercent");
565 $rule->mMinPercent = $tempVal;
568 $conditions = array();
569 $ruleInfo = $curNode->childNodes;
570 for ($j = 0; $j < $ruleInfo->length; $j++ ) {
571 $curRule=$ruleInfo->item($j);
573 if ($curRule->nodeType == XML_ELEMENT_NODE) {
574 if ($curRule->localName ==
"rollupConditions") {
575 $tempVal = $curRule->getAttribute(
"conditionCombination");
577 $rule->mConditions[
'_SeqConditionSet']->mCombination = $tempVal;
579 $rule->mConditions[
'_SeqConditionSet']->mCombination =
COMBINATION_ANY;
581 $conds = $curRule->childNodes;
582 for ($k = 0; $k < $conds->length; $k++ ) {
583 $con=$conds->item($k);
584 if ($con->nodeType == XML_ELEMENT_NODE) {
585 if ($con->localName ==
"rollupCondition") {
588 $tempVal = $con->getAttribute(
"condition");
590 $cond->mCondition=$tempVal;
593 $tempVal = $con->getAttribute(
"operator");
595 if($tempVal==
'not') {$cond->mNot =
true;}
else {$cond->mNot =
false;}
598 $c_cond[
'_SeqCondition'] = $cond;
599 array_push($conditions,$c_cond);
605 else if ($curRule->localName ==
"rollupAction") {
606 $tempVal = $curRule->getAttribute(
"action");
608 $rule->setRollupAction($tempVal);
616 $rule->mConditions[
'_SeqConditionSet']->mConditions = $conditions;
620 $c_rule[
'_SeqRollupRule']=$rule;
621 array_push($rollupRules,$c_rule);
626 if ( $rollupRules != null ) {
630 $c_rules[
'_SeqRollupRuleset']=$rules;
631 $ioAct->setRollupRules($c_rules);
644 $exitRules = array();
645 $postRules = array();
648 $children = $iNode->childNodes;
651 for ($i = 0; $i < $children->length; $i++ ) {
652 $curNode=$children->item($i);
653 if ($curNode->nodeType == XML_ELEMENT_NODE) {
654 if ($curNode->localName ==
"preConditionRule" || $curNode->localName ==
"exitConditionRule" || $curNode->localName ==
"postConditionRule" ) {
656 $ruleInfo = $curNode->childNodes;
657 for ($j = 0; $j < $ruleInfo->length; $j++ ){
658 $curRule=$ruleInfo->item($j);
660 if ($curRule->nodeType == XML_ELEMENT_NODE) {
661 if ($curRule->localName ==
"ruleConditions") {
664 else if($curRule->localName ==
"ruleAction"){
665 $tempVal=$curRule->getAttribute(
"action");
667 $rule->mAction = $tempVal;
673 if ( $rule->mConditions != null && $rule->mAction != null ) {
675 if ($curNode->localName ==
"preConditionRule") {
678 $c_rule[
'_SeqRule'] = $rule;
679 array_push($preRules,$c_rule);
681 if ($curNode->localName ==
"exitConditionRule") {
684 $c_rule[
'_SeqRule'] = $rule;
685 array_push($exitRules,$c_rule);
687 if ($curNode->localName ==
"postConditionRule") {
690 $c_rule[
'_SeqRule'] = $rule;
691 array_push($postRules,$c_rule);
699 if ( count($preRules) > 0 ) {
702 $c_rules[
'_SeqRuleset']=$rules;
703 $ioAct->setPreSeqRules($c_rules);
707 if ( count($exitRules) > 0 ){
710 $c_rules[
'_SeqRuleset']=$rules;
711 $ioAct->setExitSeqRules($c_rules);
713 if ( count($postRules) > 0 ){
716 $c_rules[
'_SeqRuleset']=$rules;
717 $ioAct->setPostSeqRules($c_rules);
729 $conditions = array();
730 $tempVal=$iNode->getAttribute(
"conditionCombination");
732 $condSet->mCombination=$tempVal;
736 $condInfo = $iNode->childNodes;
737 for ($i = 0; $i < $condInfo->length; $i++ ) {
738 $curCond=$condInfo->item($i);
739 if ($curCond->nodeType == XML_ELEMENT_NODE) {
740 if ($curCond->localName ==
"ruleCondition") {
744 $tempVal=$curCond->getAttribute(
"condition");
746 $cond->mCondition = $tempVal;
750 $tempVal=$curCond->getAttribute(
"referencedObjective");
752 $cond->mObjID = $tempVal;
756 $tempVal=$curCond->getAttribute(
"measureThreshold");
758 $cond->mThreshold = $tempVal;
762 $tempVal = $curCond->getAttribute(
"operator");
764 if ($tempVal ==
'not') {
772 $c_cond[
'_SeqCondition']=$cond;
773 array_push($conditions,$c_cond);
779 if (count($conditions)>0) {
780 $condSet->mConditions = $conditions;
782 $condSet->mConditions = null;
785 $c_condSet[
'_SeqConditionSet']=$condSet;
794 $children = $iNode->childNodes;
797 for ($i = 0; $i < $children->length; $i++ ) {
798 $curNode=$children->item($i);
799 if ($curNode->nodeType == XML_ELEMENT_NODE) {
800 if ($curNode->localName ==
"auxiliaryResource") {
805 $tempVal=$curNode->getAttribute(
"purpose");
807 $res->mType = $tempVal;
810 $tempVal=$curNode->getAttribute(
"auxiliaryResourceID");
812 $res->mResourceID = $tempVal;
814 array_push($auxRes,
$res);
819 $c_auxRes[
'_ADLAuxiliaryResource']=$auxRes;
820 $ioAct->setAuxResources($c_auxRes);
827 if (strtoupper($string)==
"FALSE") {
840 if ( $iNode != null && $iElement != null ){
841 $children = $iNode->childNodes;
842 for ($i = 0; $i < $children->length; $i++ ) {
843 $curNode = $children->item($i);
844 if ( ($curNode->nodeType == XML_ELEMENT_NODE)) {
845 if ($curNode->localName == $iElement) {
851 if ($curNode != null ) {
852 $comp = $curNode->localName;
854 if ($comp != $iElement) {
869 if ( $curNode != null )
871 $children = $curNode->childNodes;
872 if ( $children != null ) {
873 for ($i = 0; $i < $children->length; $i++ ) {
874 $curNode = $children->item($i);
876 if ( ($curNode->nodeType == XML_TEXT_NODE) ||($curNode->nodeType == XML_CDATA_SECTION_NODE) )
878 $value = $value.$curNode->nodeValue;