913 |
913 |
if (is_array($ordered_areas) && count($ordered_areas) > 0) {
|
914 |
914 |
foreach ($ordered_areas as $element_level1) {
|
915 |
915 |
// Level1.
|
916 |
|
if ($element_level1->data) {
|
917 |
|
$out .= '<dt>' . $element_level1->data->area->representation_L10n . ':</dt> ';
|
918 |
|
}
|
|
916 |
$out .= '<dt>' . $element_level1->nodeId->representation_L10n . ':</dt> ';
|
919 |
917 |
$out .= '<dd>';
|
920 |
918 |
|
921 |
919 |
// Level3.
|
922 |
920 |
foreach ($element_level1->children as $element_level3) {
|
923 |
|
if ($element_level3->data) {
|
924 |
|
$text_l3 = $element_level3->data->area->representation_L10n;
|
925 |
|
}
|
|
921 |
$text_l3 = $element_level3->nodeId->representation_L10n;
|
926 |
922 |
$fnKeysLevel3Str = '';
|
927 |
923 |
$fnKeysLevel3 = cdm_annotations_as_footnotekeys($element_level3->data);
|
928 |
|
foreach ($element_level3->data->sources as $source) {
|
929 |
|
if (_is_original_source_type($source)) {
|
930 |
|
$fn_key3 = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_OriginalSource', array('source' => $source, 'doLink' => FALSE)));
|
931 |
|
cdm_add_footnote_to_array($fnKeysLevel3, $fn_key3);
|
|
924 |
if (isset($element_level3->data[0])) {
|
|
925 |
foreach ($element_level3->data as $description_level3){
|
|
926 |
foreach ($description_level3->sources as $source) {
|
|
927 |
if (_is_original_source_type($source)) {
|
|
928 |
$fn_key3 = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_OriginalSource', array('source' => $source, 'doLink' => FALSE)));
|
|
929 |
cdm_add_footnote_to_array($fnKeysLevel3, $fn_key3);
|
|
930 |
}
|
|
931 |
}
|
932 |
932 |
}
|
933 |
933 |
}
|
934 |
934 |
// Level4.
|
935 |
935 |
$l4_regions = array();
|
936 |
936 |
foreach ($element_level3->children as $element_level4) {
|
937 |
|
if ($element_level4->data) {
|
938 |
|
$text_l4 = $element_level4->data->area->representation_L10n;
|
939 |
|
$l4_regions[$element_level3->data->area->representation_L10n] = '';
|
|
937 |
if (isset($element_level4->data[0])) {
|
|
938 |
$text_l4 = $element_level4->nodeId->representation_L10n;
|
|
939 |
$l4_regions[$element_level3->nodeId->representation_L10n] = array();
|
940 |
940 |
$fnKeysLevel4Str = '';
|
941 |
|
$fnKeysLevel4 = cdm_annotations_as_footnotekeys($element_level4->data);
|
942 |
|
foreach ($element_level4->data->sources as $source) {
|
943 |
|
if (_is_original_source_type($source)) {
|
944 |
|
$fn_key4 = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_OriginalSource', array('source' => $source, 'doLink' => FALSE)));
|
945 |
|
cdm_add_footnote_to_array($fnKeysLevel4, $fn_key4);
|
|
941 |
foreach($element_level4->data as $description_level4) {
|
|
942 |
$fnKeysLevel4 = cdm_annotations_as_footnotekeys($description_level4);
|
|
943 |
foreach ($description_level4->sources as $source) {
|
|
944 |
if (_is_original_source_type($source)) {
|
|
945 |
$fn_key4 = FootnoteManager::addNewFootnote(
|
|
946 |
RenderHints::getFootnoteListKey(),
|
|
947 |
theme('cdm_OriginalSource', array('source' => $source, 'doLink' => FALSE)));
|
|
948 |
cdm_add_footnote_to_array($fnKeysLevel4, $fn_key4);
|
|
949 |
}
|
|
950 |
}
|
|
951 |
usort($fnKeysLevel4, "footnotes_key_compare");
|
|
952 |
if(!isset( $l4_regions[$text_l4])){
|
|
953 |
$l4_regions[$text_l4] = $fnKeysLevel4;
|
|
954 |
} else {
|
|
955 |
$l4_regions[$text_l4] = array_merge($l4_regions[$text_l4], $fnKeysLevel4);
|
946 |
956 |
}
|
947 |
957 |
}
|
948 |
|
usort($fnKeysLevel4, "footnotes_key_compare");
|
949 |
|
$l4_regions[$text_l4] = $fnKeysLevel4;
|
950 |
958 |
}
|
951 |
959 |
}// Level4.
|
952 |
960 |
// Managing level3 and level4 for generating the right output.
|
... | ... | |
956 |
964 |
cdm_add_footnote_to_array($l4_regions[$key4], $key3);
|
957 |
965 |
}
|
958 |
966 |
}
|
959 |
|
if ($element_level3->numberOfChildren == 1 && $text_l3 == $element_level3->children[0]->data->area->representation_L10n) {
|
|
967 |
if ($element_level3->numberOfChildren == 1 && $text_l3 == $element_level3->children[0]->nodeId->representation_L10n) {
|
960 |
968 |
// var_dump($element_level3->children[0]->data->area->representation_L10n);
|
961 |
969 |
$fnStr = '';
|
962 |
970 |
$region = array_pop($l4_regions);
|
... | ... | |
968 |
976 |
if (substr($out, -3) == ' ; ') {
|
969 |
977 |
$out = substr($out, 0, -3) . '; ';
|
970 |
978 |
}
|
971 |
|
}
|
972 |
|
else {
|
|
979 |
} else {
|
973 |
980 |
$fnKeysLevel3Str = '';
|
974 |
981 |
foreach ($fnKeysLevel3 as $key) {
|
975 |
982 |
$fnKeysLevel3Str .= theme('cdm_footnote_key', array('footnoteKey' => $key, 'separator' => ($fnKeysLevel3Str ? $separator : '')));
|
... | ... | |
978 |
985 |
foreach ($l4_regions as $key => $value) {
|
979 |
986 |
$fnKeysLevel4Str = '';
|
980 |
987 |
if (is_array($l4_regions[$key])) {
|
981 |
|
foreach ($l4_regions[$key] as $fnkey) {// Warning why?
|
|
988 |
foreach ($l4_regions[$key] as $fnkey) {
|
982 |
989 |
$fnKeysLevel4Str .= theme('cdm_footnote_key', array('footnoteKey' => $fnkey, 'separator' => ($fnKeysLevel4Str ? $separator : '')));
|
983 |
990 |
}
|
984 |
991 |
}
|
adapting portal to refactored distribution tree implementation in cdmlib, fixes problems in #3475 #2562 #3893