Commit 4d8105717abbeb61e4bc861b7b1505c2a0abff7e
1 parent
8b6bb092
Exists in
master
and in
95 other branches
add rank for Ephemerides and PlanetsProperties
Showing
1 changed file
with
45 additions
and
19 deletions
Show diff stats
update_amda/makeTree.php
... | ... | @@ -39,26 +39,52 @@ |
39 | 39 | |
40 | 40 | if (is_array($cmpArr)) |
41 | 41 | { |
42 | - $targetMis = $mission->getAttribute('target'); | |
43 | - $index = $cmpArr[$targetMis]; | |
44 | - if ($index) | |
45 | - $nodeNew->setAttribute('rank',$index); | |
46 | - else $nodeNew->setAttribute('rank', 999); | |
47 | - | |
48 | - $observatories = $nodeNew->getElementsByTagName('observatory'); | |
49 | - if ($observatories->length > 0) | |
50 | - { | |
51 | - foreach ($observatories as $obs) | |
52 | - { | |
53 | - if ($obs->hasAttribute('target')) | |
54 | - { | |
55 | - $target = $obs->getAttribute('target'); | |
56 | - $index = $cmpArr[$target]; | |
57 | - if ($index && $target != $targetMis) | |
58 | - $obs->setAttribute('rank',$index); | |
59 | - } | |
60 | - } | |
42 | + if ($mission->getAttribute('xml:id') == 'Ephemerides') { // Planets and Moons | |
43 | + $datasets = $nodeNew->getElementsByTagName('dataset'); | |
44 | + foreach ($datasets as $ds ) { | |
45 | + $target = $ds->getAttribute('target'); | |
46 | + $index = $cmpArr[$target]; | |
47 | + if ($index) { | |
48 | + if ( $ds->parentNode->tagName == 'datasetGroup' ) { | |
49 | + if (!$ds->parentNode->hasAttribute('rank')) { | |
50 | + $ds->parentNode->setAttribute('rank',$index); | |
51 | + } | |
52 | + } else { | |
53 | + $ds->setAttribute('rank',$index); | |
54 | + } | |
55 | + } | |
56 | + } | |
61 | 57 | } |
58 | + else if ($mission->getAttribute('xml:id') == 'PlanetsProperties') { | |
59 | + $instruments = $nodeNew->getElementsByTagName('instrument'); | |
60 | + foreach ($instruments as $ins ) { | |
61 | + $target = $ins->getAttribute('name'); | |
62 | + $index = $cmpArr[$target]; | |
63 | + if ($index) | |
64 | + $ins->setAttribute('rank',$index); | |
65 | + } | |
66 | + } | |
67 | + | |
68 | + $targetMis = $mission->getAttribute('target'); | |
69 | + $index = $cmpArr[$targetMis]; | |
70 | + if ($index) | |
71 | + $nodeNew->setAttribute('rank',$index); | |
72 | + else $nodeNew->setAttribute('rank', 999); | |
73 | + | |
74 | + $observatories = $nodeNew->getElementsByTagName('observatory'); | |
75 | + if ($observatories->length > 0) | |
76 | + { | |
77 | + foreach ($observatories as $obs) | |
78 | + { | |
79 | + if ($obs->hasAttribute('target')) | |
80 | + { | |
81 | + $target = $obs->getAttribute('target'); | |
82 | + $index = $cmpArr[$target]; | |
83 | + if ($index && $target != $targetMis) | |
84 | + $obs->setAttribute('rank',$index); | |
85 | + } | |
86 | + } | |
87 | + } | |
62 | 88 | } |
63 | 89 | //TODO set propre restriction |
64 | 90 | $Amda->appendChild($nodeNew); |
... | ... |