Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 require_once("SeqActivity.php");
00052
00053 require_once("SeqRule.php");
00054 require_once("SeqRuleset.php");
00055
00056 require_once("SeqCondition.php");
00057 require_once("SeqConditionSet.php");
00058
00059 require_once("SeqObjective.php");
00060 require_once("SeqObjectiveMap.php");
00061
00062 require_once("SeqRollupRule.php");
00063 require_once("SeqRollupRuleset.php");
00064
00065 require_once("ADLAuxiliaryResource.php");
00066
00067 class SeqTreeBuilder{
00068
00069 public function buildNodeSeqTree($file){
00070
00071 $doc = new DomDocument();
00072 $doc->load($file);
00073 $organizations = $doc->getElementsByTagName("organizations");
00074
00075
00076 $default=$organizations->item(0)->getAttribute("default");
00077
00078
00079 $organization = $doc->getElementsByTagName("organization");
00080
00081
00082 foreach ($organization as $element) {
00083 if ($element->getAttribute("identifier")==$default) {
00084 $default_organization = $element;
00085 }
00086 }
00087
00088
00089 $seqCollection = $doc->getElementsByTagName("sequencingCollection")->item(0);
00090
00091 $root = $this->buildNode($default_organization,$seqCollection,$doc);
00092
00093
00094 $objectivesGlobalToSystem = $default_organization->getAttributeNS("http://www.adlnet.org/xsd/adlseq_v1p3","objectivesGlobalToSystem");
00095
00096 $org = $default_organization->getAttribute("identifier");
00097
00098
00099 $globaltosystem = 1;
00100
00101 if ($objectivesGlobalToSystem=="false") {
00102 $globaltosystem = 0;
00103 }
00104
00105
00106 $c_root['_SeqActivity']=$root;
00107
00108 $ret['global'] = $globaltosystem;
00109 $ret['tree'] = $c_root;
00110
00111 return $ret;
00112
00113 }
00114
00115
00116
00117 private function buildNode($node,$seq,$doc) {
00118
00119
00120 $act = new SeqActivity();
00121
00122
00123
00124 $act->setID($node->getAttribute("identifier"));
00125
00126 $tempVal = $node->getAttribute("identifierref");
00127 if ($tempVal){
00128 $act->setResourceID($tempVal);
00129 }
00130
00131 $tempVal = $node->getAttribute("isvisible");
00132
00133
00134 if ($tempVal){
00135 $act->setIsVisible(self::convert_to_bool($tempVal));
00136 }
00137
00138
00139
00140 $children = $node->childNodes;
00141
00142 for ($i = 0; $i < $children->length; $i++ ) {
00143
00144 $curNode=$children->item($i);
00145
00146
00147 if ($curNode->nodeType == XML_ELEMENT_NODE) {
00148
00149 if ($curNode->localName == "item") {
00150
00151 $c_nestedAct=null;
00152 $nestedAct = new SeqActivity();
00153 $nestedAct = $this->buildNode($curNode,$seq,$doc);
00154 if ($nestedAct != null ) {
00155 $act->AddChild($nestedAct);
00156 }
00157 }
00158 else if ($curNode->localName == "title") {
00159 $act->setTitle($this->lookupElement($curNode,null));
00160 }
00161 else if ($curNode->localName == "sequencing") {
00162 $seqInfo = $curNode;
00163
00164 $tempVal = $curNode->getAttribute("IDRef");
00165
00166 if ($tempVal) {
00167
00168 $seqGlobal = null;
00169
00170
00171 $sequencing = $seq->getElementsByTagName("sequencing");
00172
00173
00174 foreach ($sequencing as $element) {
00175 if ($element->getAttribute("ID")==$tempVal) {
00176 $seqGlobal = $element;
00177 }
00178 }
00179
00180
00181 $seqInfo = $seqGlobal->cloneNode(TRUE);
00182
00183
00184 $seqChildren = $curNode->childNodes;
00185 for ($j = 0; $j < $seqChildren->length; $j++ ) {
00186
00187 $curChild = $seqChildren->item($j);
00188 if ( $curChild->nodeType == XML_ELEMENT_NODE ) {
00189
00190
00191 $seqInfo->appendChild($curChild);
00192
00193 }
00194 }
00195 }
00196
00197
00198 $act=$this->extractSeqInfo($seqInfo, $act);
00199
00200 }
00201 }
00202
00203
00204
00205 $item=$children->item($i)->nodeValue;
00206 }
00207
00208
00209 return $act;
00210
00211 }
00212
00213
00214 private function extractSeqInfo($iNode, $ioAct) {
00215
00216 $children = $iNode->childNodes;
00217 for ( $i = 0; $i < $children->length; $i++ ) {
00218 $curNode = $children->item($i);
00219 if ( $curNode->nodeType == XML_ELEMENT_NODE ) {
00220 if ($curNode->localName == "controlMode") {
00221
00222 $tempVal=$curNode->getAttribute("choice");
00223 if ($tempVal) {
00224 $ioAct->setControlModeChoice(self::convert_to_bool($tempVal));
00225 }
00226
00227 $tempVal=$curNode->getAttribute("choiceExit");
00228 if ($tempVal) {
00229 $ioAct->setControlModeChoiceExit(self::convert_to_bool($tempVal));
00230 }
00231
00232
00233 $tempVal=$curNode->getAttribute("flow");
00234 if ($tempVal) {
00235 $ioAct->setControlModeFlow(self::convert_to_bool($tempVal));
00236 }
00237
00238
00239 $tempVal=$curNode->getAttribute("forwardOnly");
00240 if ($tempVal) {
00241 $ioAct->setControlForwardOnly(self::convert_to_bool($tempVal));
00242 }
00243
00244
00245 $tempVal=$curNode->getAttribute("useCurrentAttemptObjectiveInfo");
00246 if ($tempVal) {
00247 $ioAct->setUseCurObjective(self::convert_to_bool($tempVal));
00248 }
00249
00250
00251 $tempVal=$curNode->getAttribute("useCurrentAttemptProgressInfo");
00252 if ($tempVal) {
00253 $ioAct->setUseCurProgress(self::convert_to_bool($tempVal));
00254 }
00255
00256 }
00257
00258 else if ($curNode->localName == "sequencingRules") {
00259 $ioAct = $this->getSequencingRules($curNode,$ioAct);
00260
00261 }
00262
00263 else if ($curNode->localName == "limitConditions") {
00264
00265 $tempVal=$curNode->getAttribute("attemptLimit");
00266 if ($tempVal) {
00267 $ioAct->setAttemptLimit($tempVal);
00268 }
00269
00270
00271 $tempVal=$curNode->getAttribute("attemptAbsoluteDurationLimit");
00272 if ($tempVal) {
00273 $ioAct->setAttemptAbDur($tempVal);
00274 }
00275
00276
00277 $tempVal=$curNode->getAttribute("attemptExperiencedDurationLimit");
00278 if ($tempVal) {
00279 $ioAct->setAttemptExDur($tempVal);
00280 }
00281
00282
00283 $tempVal=$curNode->getAttribute("activityAbsoluteDurationLimit");
00284 if ($tempVal) {
00285 $ioAct->setActivityAbDur($tempVal);
00286 }
00287
00288
00289 $tempVal=$curNode->getAttribute("activityExperiencedDurationLimit");
00290 if ($tempVal) {
00291 $ioAct->setActivityExDur($tempVal);
00292 }
00293
00294
00295 $tempVal=$curNode->getAttribute("beginTimeLimit");
00296 if ($tempVal) {
00297 $ioAct->setBeginTimeLimit($tempVal);
00298 }
00299
00300
00301 $tempVal=$curNode->getAttribute("endTimeLimit");
00302 if ($tempVal) {
00303 $ioAct->setEndTimeLimit($tempVal);
00304 }
00305 }
00306 else if ($curNode->localName == "auxiliaryResources") {
00307 $ioAct = self::getAuxResources($curNode, $ioAct);
00308 }
00309
00310 else if ($curNode->localName == "rollupRules") {
00311 $ioAct = self::getRollupRules($curNode, $ioAct);
00312 }
00313
00314 else if ($curNode->localName == "objectives") {
00315 $ioAct = self::getObjectives($curNode,$ioAct);
00316 }
00317
00318 else if ($curNode->localName == "randomizationControls") {
00319
00320
00321 $tempVal=$curNode->getAttribute("randomizationTiming");
00322 if ($tempVal) {
00323 $ioAct->setRandomTiming($tempVal);
00324 }
00325
00326
00327 $tempVal=$curNode->getAttribute("selectCount");
00328 if ($tempVal) {
00329 $ioAct->setSelectCount($tempVal);
00330 }
00331
00332
00333 $tempVal=$curNode->getAttribute("reorderChildren");
00334 if ($tempVal) {
00335 $ioAct->setReorderChildren(self::convert_to_bool($tempVal));
00336 }
00337
00338
00339 $tempVal=$curNode->getAttribute("selectionTiming");
00340 if ($tempVal) {
00341 $ioAct->setSelectionTiming($tempVal);
00342 }
00343 }
00344 else if ($curNode->localName == "deliveryControls") {
00345
00346
00347 $tempVal=$curNode->getAttribute("tracked");
00348 if ($tempVal) {
00349 $ioAct->setIsTracked(self::convert_to_bool($tempVal));
00350 }
00351
00352
00353 $tempVal=$curNode->getAttribute("completionSetByContent");
00354 if ($tempVal) {
00355 $ioAct->setSetCompletion(self::convert_to_bool($tempVal));
00356 }
00357
00358
00359 $tempVal=$curNode->getAttribute("objectiveSetByContent");
00360 if ($tempVal) {
00361 $ioAct->setSetObjective(self::convert_to_bool($tempVal));
00362 }
00363 }
00364 else if ($curNode->localName == "constrainedChoiceConsiderations") {
00365
00366
00367 $tempVal=$curNode->getAttribute("preventActivation");
00368 if ($tempVal) {
00369 $ioAct->setPreventActivation(self::convert_to_bool($tempVal));
00370 }
00371
00372
00373 $tempVal=$curNode->getAttribute("constrainChoice");
00374 if ($tempVal) {
00375 $ioAct->setConstrainChoice(self::convert_to_bool($tempVal));
00376 }
00377 }
00378 else if ($curNode->localName == "rollupConsiderations") {
00379
00380
00381 $tempVal=$curNode->getAttribute("requiredForSatisfied");
00382 if ($tempVal) {
00383 $ioAct->setRequiredForSatisfied($tempVal);
00384 }
00385
00386
00387 $tempVal=$curNode->getAttribute("requiredForNotSatisfied");
00388 if ($tempVal) {
00389 $ioAct->setRequiredForNotSatisfied($tempVal);
00390 }
00391
00392
00393 $tempVal=$curNode->getAttribute("requiredForCompleted");
00394 if ($tempVal) {
00395 $ioAct->setRequiredForCompleted($tempVal);
00396 }
00397
00398
00399 $tempVal=$curNode->getAttribute("requiredForIncomplete");
00400 if ($tempVal) {
00401 $ioAct->setRequiredForIncomplete($tempVal);
00402 }
00403
00404
00405 $tempVal=$curNode->getAttribute("measureSatisfactionIfActive");
00406 if ($tempVal) {
00407 $ioAct->setSatisfactionIfActive(self::convert_to_bool($tempVal));
00408 }
00409 }
00410
00411
00412
00413 }
00414
00415 }
00416
00417 return $ioAct;
00418 }
00419
00420
00421 public static function getObjectives ($iNode,$ioAct) {
00422 $ok = true;
00423 $tempVal = null;
00424 $objectives = array();
00425 $children = $iNode->childNodes;
00426 for ($i = 0; $i < $children->length; $i++ ) {
00427 $curNode=$children->item($i);
00428 if ($curNode->nodeType == XML_ELEMENT_NODE) {
00429 if ($curNode->localName == "primaryObjective" || $curNode->localName == "objective" ) {
00430
00431 $obj = new SeqObjective();
00432 if ($curNode->localName == "primaryObjective") {
00433 $obj->mContributesToRollup = true;
00434 }
00435
00436
00437 $tempVal = $curNode->getAttribute("objectiveID");
00438 if($tempVal) {
00439 $obj->mObjID = $tempVal;
00440 }
00441
00442
00443 $tempVal = $curNode->getAttribute("satisfiedByMeasure");
00444 if($tempVal) {
00445 $obj->mSatisfiedByMeasure = self::convert_to_bool($tempVal);
00446 }
00447
00448 $tempVal=self::lookupElement($curNode,"minNormalizedMeasure");
00449 if($tempVal) {
00450 $obj->mMinMeasure = $tempVal;
00451 }
00452
00453
00454 $maps = self::getObjectiveMaps($curNode);
00455 if ( $maps != null ){
00456 $obj->mMaps = $maps;
00457 }
00458
00459
00460 $c_obj['_SeqObjective'] = $obj;
00461 array_push($objectives,$c_obj);
00462 }
00463 }
00464 }
00465 $ioAct->setObjectives($objectives);
00466 return $ioAct;
00467 }
00468
00469
00470 public static function getObjectiveMaps($iNode) {
00471 $tempVal = null;
00472 $maps = array();
00473 $children = $iNode->childNodes;
00474 for ($i = 0; $i < $children->length; $i++ ) {
00475 $curNode=$children->item($i);
00476 if ($curNode->nodeType == XML_ELEMENT_NODE) {
00477 if ($curNode->localName == "mapInfo") {
00478 $map = new SeqObjectiveMap();
00479
00480
00481 $tempVal = $curNode->getAttribute("targetObjectiveID");
00482 if($tempVal) {
00483 $map->mGlobalObjID = $tempVal;
00484 }
00485
00486
00487 $tempVal = $curNode->getAttribute("readSatisfiedStatus");
00488 if($tempVal) {
00489 $map->mReadStatus = self::convert_to_bool($tempVal);
00490 }
00491
00492
00493 $tempVal = $curNode->getAttribute("readNormalizedMeasure");
00494 if($tempVal) {
00495 $map->mReadMeasure = self::convert_to_bool($tempVal);
00496 }
00497
00498
00499 $tempVal = $curNode->getAttribute("writeSatisfiedStatus");
00500 if($tempVal) {
00501 $map->mWriteStatus = self::convert_to_bool($tempVal);
00502 }
00503
00504
00505 $tempVal = $curNode->getAttribute("writeNormalizedMeasure");
00506 if($tempVal) {
00507 $map->mWriteMeasure = self::convert_to_bool($tempVal);
00508 }
00509
00510 $c_map['_SeqObjectiveMap']=$map;
00511 array_push($maps,$c_map);
00512 }
00513 }
00514 }
00515 if (count($maps)==null) {
00516 $maps = null;
00517 }
00518 return $maps;
00519 }
00520
00521 public static function getRollupRules($iNode, $ioAct) {
00522 $ok = true;
00523 $tempVal = null;
00524 $rollupRules = array();
00525
00526
00527 $tempVal = $iNode->getAttribute("rollupObjectiveSatisfied");
00528 if($tempVal) {
00529 $ioAct->setIsObjRolledUp(self::convert_to_bool($tempVal));
00530 }
00531
00532
00533 $tempVal = $iNode->getAttribute("objectiveMeasureWeight");
00534 if($tempVal) {
00535 $ioAct->setObjMeasureWeight($tempVal);
00536
00537 }
00538
00539 $tempVal = $iNode->getAttribute("rollupProgressCompletion");
00540 if($tempVal) {
00541 $ioAct->setIsProgressRolledUp(self::convert_to_bool($tempVal));
00542
00543 }
00544 $children = $iNode->childNodes;
00545 for ($i = 0; $i < $children->length; $i++ ) {
00546 $curNode=$children->item($i);
00547 if ($curNode->nodeType == XML_ELEMENT_NODE) {
00548 if ($curNode->localName == "rollupRule") {
00549 $rule = new SeqRollupRule();
00550
00551
00552 $tempVal=$curNode->getAttribute("childActivitySet");
00553 if($tempVal) {
00554 $rule->mChildActivitySet = $tempVal;
00555 }
00556
00557 $tempVal=$curNode->getAttribute("minimumCount");
00558 if($tempVal) {
00559 $rule->mMinCount = $tempVal;
00560 }
00561
00562
00563 $tempVal=$curNode->getAttribute("minimumPercent");
00564 if($tempVal) {
00565 $rule->mMinPercent = $tempVal;
00566 }
00567 $rule->mConditions['_SeqConditionSet'] = new SeqConditionSet(true);
00568 $conditions = array();
00569 $ruleInfo = $curNode->childNodes;
00570 for ($j = 0; $j < $ruleInfo->length; $j++ ) {
00571 $curRule=$ruleInfo->item($j);
00572
00573 if ($curRule->nodeType == XML_ELEMENT_NODE) {
00574 if ($curRule->localName == "rollupConditions") {
00575 $tempVal = $curRule->getAttribute("conditionCombination");
00576 if($tempVal) {
00577 $rule->mConditions['_SeqConditionSet']->mCombination = $tempVal;
00578 } else {
00579 $rule->mConditions['_SeqConditionSet']->mCombination = COMBINATION_ANY;
00580 }
00581 $conds = $curRule->childNodes;
00582 for ($k = 0; $k < $conds->length; $k++ ) {
00583 $con=$conds->item($k);
00584 if ($con->nodeType == XML_ELEMENT_NODE) {
00585 if ($con->localName == "rollupCondition") {
00586 $cond = new SeqCondition();
00587
00588 $tempVal = $con->getAttribute("condition");
00589 if($tempVal) {
00590 $cond->mCondition=$tempVal;
00591 }
00592
00593 $tempVal = $con->getAttribute("operator");
00594 if($tempVal) {
00595 if($tempVal=='not') {$cond->mNot = true;} else {$cond->mNot = false;}
00596 }
00597
00598 $c_cond['_SeqCondition'] = $cond;
00599 array_push($conditions,$c_cond);
00600 }
00601
00602 }
00603 }
00604 }
00605 else if ($curRule->localName == "rollupAction") {
00606 $tempVal = $curRule->getAttribute("action");
00607 if ($tempVal) {
00608 $rule->setRollupAction($tempVal);
00609 }
00610
00611 }
00612
00613 }
00614 }
00615
00616 $rule->mConditions['_SeqConditionSet']->mConditions = $conditions;
00617
00618
00619
00620 $c_rule['_SeqRollupRule']=$rule;
00621 array_push($rollupRules,$c_rule);
00622 }
00623 }
00624 }
00625
00626 if ( $rollupRules != null ) {
00627 $rules = new SeqRollupRuleset($rollupRules);
00628
00629
00630 $c_rules['_SeqRollupRuleset']=$rules;
00631 $ioAct->setRollupRules($c_rules);
00632 }
00633
00634 return $ioAct;
00635 }
00636
00637
00638 public static function getSequencingRules($iNode,$ioAct) {
00639
00640 $ok = true;
00641 $tempVal = null;
00642
00643 $preRules = array();
00644 $exitRules = array();
00645 $postRules = array();
00646
00647
00648 $children = $iNode->childNodes;
00649
00650
00651 for ($i = 0; $i < $children->length; $i++ ) {
00652 $curNode=$children->item($i);
00653 if ($curNode->nodeType == XML_ELEMENT_NODE) {
00654 if ($curNode->localName == "preConditionRule" || $curNode->localName == "exitConditionRule" || $curNode->localName == "postConditionRule" ) {
00655 $rule = new SeqRule();
00656 $ruleInfo = $curNode->childNodes;
00657 for ($j = 0; $j < $ruleInfo->length; $j++ ){
00658 $curRule=$ruleInfo->item($j);
00659
00660 if ($curRule->nodeType == XML_ELEMENT_NODE) {
00661 if ($curRule->localName == "ruleConditions") {
00662 $rule->mConditions = self::extractSeqRuleConditions($curRule);
00663 }
00664 else if($curRule->localName == "ruleAction"){
00665 $tempVal=$curRule->getAttribute("action");
00666 if($tempVal) {
00667 $rule->mAction = $tempVal;
00668 }
00669 }
00670
00671 }
00672 }
00673 if ( $rule->mConditions != null && $rule->mAction != null ) {
00674
00675 if ($curNode->localName == "preConditionRule") {
00676
00677
00678 $c_rule['_SeqRule'] = $rule;
00679 array_push($preRules,$c_rule);
00680 }
00681 if ($curNode->localName == "exitConditionRule") {
00682
00683
00684 $c_rule['_SeqRule'] = $rule;
00685 array_push($exitRules,$c_rule);
00686 }
00687 if ($curNode->localName == "postConditionRule") {
00688
00689
00690 $c_rule['_SeqRule'] = $rule;
00691 array_push($postRules,$c_rule);
00692 }
00693 }
00694 }
00695
00696 }
00697 }
00698
00699 if ( count($preRules) > 0 ) {
00700 $rules = new SeqRuleset($preRules);
00701
00702 $c_rules['_SeqRuleset']=$rules;
00703 $ioAct->setPreSeqRules($c_rules);
00704
00705 }
00706
00707 if ( count($exitRules) > 0 ){
00708 $rules = new SeqRuleset($exitRules);
00709
00710 $c_rules['_SeqRuleset']=$rules;
00711 $ioAct->setExitSeqRules($c_rules);
00712 }
00713 if ( count($postRules) > 0 ){
00714 $rules = new SeqRuleset($postRules);
00715
00716 $c_rules['_SeqRuleset']=$rules;
00717 $ioAct->setPostSeqRules($c_rules);
00718 }
00719
00720
00721 return $ioAct;
00722
00723 }
00724
00725 public static function extractSeqRuleConditions($iNode) {
00726 $tempVal = null;
00727 $condSet = new SeqConditionSet(false);
00728
00729 $conditions = array();
00730 $tempVal=$iNode->getAttribute("conditionCombination");
00731 if ($tempVal) {
00732 $condSet->mCombination=$tempVal;
00733 } else {
00734 $condSet->mCombination=COMBINATION_ALL;
00735 }
00736 $condInfo = $iNode->childNodes;
00737 for ($i = 0; $i < $condInfo->length; $i++ ) {
00738 $curCond=$condInfo->item($i);
00739 if ($curCond->nodeType == XML_ELEMENT_NODE) {
00740 if ($curCond->localName == "ruleCondition") {
00741 $cond = new SeqCondition();
00742
00743
00744 $tempVal=$curCond->getAttribute("condition");
00745 if ($tempVal) {
00746 $cond->mCondition = $tempVal;
00747 }
00748
00749
00750 $tempVal=$curCond->getAttribute("referencedObjective");
00751 if ($tempVal) {
00752 $cond->mObjID = $tempVal;
00753 }
00754
00755
00756 $tempVal=$curCond->getAttribute("measureThreshold");
00757 if ($tempVal) {
00758 $cond->mThreshold = $tempVal;
00759 }
00760
00761
00762 $tempVal = $curCond->getAttribute("operator");
00763 if ($tempVal) {
00764 if ($tempVal == 'not') {
00765 $cond->mNot = true;
00766 } else {
00767 $cond->mNot = false;
00768 }
00769 }
00770
00771
00772 $c_cond['_SeqCondition']=$cond;
00773 array_push($conditions,$c_cond);
00774
00775 }
00776 }
00777 }
00778
00779 if (count($conditions)>0) {
00780 $condSet->mConditions = $conditions;
00781 } else {
00782 $condSet->mConditions = null;
00783 }
00784
00785 $c_condSet['_SeqConditionSet']=$condSet;
00786 return $c_condSet;
00787 }
00788
00789 public static function getAuxResources($iNode, $ioAct) {
00790 $ok = true;
00791 $tempVal = null;
00792 $auxRes = array();
00793
00794 $children = $iNode->childNodes;
00795
00796
00797 for ($i = 0; $i < $children->length; $i++ ) {
00798 $curNode=$children->item($i);
00799 if ($curNode->nodeType == XML_ELEMENT_NODE) {
00800 if ($curNode->localName == "auxiliaryResource") {
00801
00802 $res = new ADLAuxiliaryResource();
00803
00804
00805 $tempVal=$curNode->getAttribute("purpose");
00806 if ($tempVal) {
00807 $res->mType = $tempVal;
00808 }
00809
00810 $tempVal=$curNode->getAttribute("auxiliaryResourceID");
00811 if ($tempVal) {
00812 $res->mResourceID = $tempVal;
00813 }
00814 array_push($auxRes,$res);
00815 }
00816 }
00817 }
00818
00819 $c_auxRes['_ADLAuxiliaryResource']=$auxRes;
00820 $ioAct->setAuxResources($c_auxRes);
00821 return $ioAct;
00822 }
00823
00824
00825
00826 private static function convert_to_bool($string) {
00827 if (strtoupper($string)=="FALSE") {
00828 return false;
00829 } else {
00830 return true;
00831 }
00832 }
00833
00834
00835 private function lookupElement($iNode, $iElement){
00836 $value = null;
00837 $curNode = null;
00838 $children = null;
00839
00840 if ( $iNode != null && $iElement != null ){
00841 $children = $iNode->childNodes;
00842 for ($i = 0; $i < $children->length; $i++ ) {
00843 $curNode = $children->item($i);
00844 if ( ($curNode->nodeType == XML_ELEMENT_NODE)) {
00845 if ($curNode->localName == $iElement) {
00846 break;
00847 }
00848 }
00849
00850 }
00851 if ($curNode != null ) {
00852 $comp = $curNode->localName;
00853 if ($comp != null) {
00854 if ($comp != $iElement) {
00855 $curNode = null;
00856 }
00857 } else {
00858 $curNode = null;
00859
00860 }
00861 }
00862
00863 }
00864 else {
00865
00866 $curNode = $iNode;
00867 }
00868
00869 if ( $curNode != null )
00870 {
00871 $children = $curNode->childNodes;
00872 if ( $children != null ) {
00873 for ($i = 0; $i < $children->length; $i++ ) {
00874 $curNode = $children->item($i);
00875
00876 if ( ($curNode->nodeType == XML_TEXT_NODE) ||($curNode->nodeType == XML_CDATA_SECTION_NODE) )
00877 {
00878 $value = $value.$curNode->nodeValue;
00879 }
00880 }
00881 }
00882 }
00883 return $value;
00884 }
00885
00886
00887 }
00888
00889 ?>