Revision b011743c
Added by Andreas Kohlbecker over 5 years ago
modules/cdm_dataportal/cdm_api/cdm_api.module | ||
---|---|---|
1619 | 1619 |
|
1620 | 1620 |
// 1. scan this level |
1621 | 1621 |
foreach ($feature_tree_nodes as $node){ |
1622 |
if($node->feature->uuid == $feature_uuid){
|
|
1622 |
if($node->term->uuid == $feature_uuid){
|
|
1623 | 1623 |
return $node; |
1624 | 1624 |
} |
1625 | 1625 |
} |
... | ... | |
1671 | 1671 |
// Append corresponding elements to an additional node field: |
1672 | 1672 |
// $node->descriptionElements. |
1673 | 1673 |
foreach ($descriptionElements as $element) { |
1674 |
if ($element->feature->uuid == $node->feature->uuid) {
|
|
1674 |
if ($element->term->uuid == $node->term->uuid) {
|
|
1675 | 1675 |
if (!isset($node->descriptionElements)) { |
1676 | 1676 |
$node->descriptionElements = array(); |
1677 | 1677 |
} |
... | ... | |
2121 | 2121 |
|
2122 | 2122 |
foreach ($root_node->childNodes as $feature_node) { |
2123 | 2123 |
$out .= ($out ? $separator : ''); |
2124 |
if(!in_array($feature_node->feature->$field_name, $excludes)) {
|
|
2125 |
$out .= $feature_node->feature->$field_name;
|
|
2124 |
if(!in_array($feature_node->term->$field_name, $excludes)) {
|
|
2125 |
$out .= $feature_node->term->$field_name;
|
|
2126 | 2126 |
if (is_array($feature_node->childNodes) && count($feature_node->childNodes) > 0) { |
2127 | 2127 |
$childlabels = cdm_featureTree_elements_toString($feature_node, $separator, $field_name); |
2128 | 2128 |
if (strlen($childlabels)) { |
... | ... | |
2157 | 2157 |
if ($childIndent) { |
2158 | 2158 |
$indent_prefix = $childIndent . $node_char . " "; |
2159 | 2159 |
} |
2160 |
$options[$featureNode->feature->uuid] = $indent_prefix . $featureNode->feature->representation_L10n;
|
|
2160 |
$options[$featureNode->term->uuid] = $indent_prefix . $featureNode->term->representation_L10n;
|
|
2161 | 2161 |
if (isset($featureNode->childNodes) && is_array($featureNode->childNodes)) { |
2162 | 2162 |
// Foreach ($featureNode->childNodes as $childNode){ |
2163 | 2163 |
$childList = _featureTree_nodes_as_feature_options($featureNode, $node_char, $childIndentStr, $childIndent . $childIndentStr); |
modules/cdm_dataportal/cdm_csv_export/cdm_csv_export.module | ||
---|---|---|
137 | 137 |
$feature_tree = get_csv_featureTree(); |
138 | 138 |
if (isset($feature_tree->root->childNodes)) { |
139 | 139 |
foreach ($feature_tree->root->childNodes as $featureNode) { |
140 |
if (isset($featureNode->feature)) {
|
|
140 |
if (isset($featureNode->term)) {
|
|
141 | 141 |
|
142 | 142 |
// Must not exceed 45 characters !!! |
143 |
$subform_id = $featureNode->feature->uuid; //LAYOUT_SETTING_PREFIX .
|
|
143 |
$subform_id = $featureNode->term->uuid; //LAYOUT_SETTING_PREFIX .
|
|
144 | 144 |
// $settings = mixed_variable_get($subform_id, FEATURE_TREE_LAYOUT_DEFAULTS); |
145 | 145 |
// $systemDefaults = unserialize(FEATURE_TREE_LAYOUT_DEFAULTS); |
146 | 146 |
$form['redListField']['csvExportOptions'][$subform_id] = array( |
147 | 147 |
'#type' => 'checkbox', |
148 |
'#title' => $featureNode->feature->representation_L10n,
|
|
149 |
'#default_value' => $featureNode->feature->uuid,//$settings,
|
|
150 |
'#attributes' => array('value' => $featureNode->feature->uuid,
|
|
148 |
'#title' => $featureNode->term->representation_L10n,
|
|
149 |
'#default_value' => $featureNode->term->uuid,//$settings,
|
|
150 |
'#attributes' => array('value' => $featureNode->term->uuid,
|
|
151 | 151 |
'name' => 'features' |
152 | 152 |
), |
153 | 153 |
); |
modules/cdm_dataportal/includes/descriptions.inc | ||
---|---|---|
694 | 694 |
|
695 | 695 |
RenderHints::pushToRenderStack('feature_block'); |
696 | 696 |
// Create a drupal block for each feature |
697 |
foreach ($mergedFeatureNodes as $node) { |
|
697 |
foreach ($mergedFeatureNodes as $feature_node) {
|
|
698 | 698 |
|
699 |
if ((isset($node->descriptionElements['#type']) || |
|
700 |
has_feature_node_description_elements($node)) && $node->feature->uuid != UUID_IMAGE) { // skip empty or suppressed features
|
|
699 |
if ((isset($feature_node->descriptionElements['#type']) ||
|
|
700 |
has_feature_node_description_elements($feature_node)) && $feature_node->term->uuid != UUID_IMAGE) { // skip empty or suppressed features
|
|
701 | 701 |
|
702 |
RenderHints::pushToRenderStack($node->feature->uuid);
|
|
702 |
RenderHints::pushToRenderStack($feature_node->term->uuid);
|
|
703 | 703 |
|
704 |
$feature_name = cdm_term_representation($node->feature, 'Unnamed Feature');
|
|
705 |
$feature_block_settings = get_feature_block_settings($node->feature->uuid);
|
|
704 |
$feature_name = cdm_term_representation($feature_node->term, 'Unnamed Feature');
|
|
705 |
$feature_block_settings = get_feature_block_settings($feature_node->term->uuid);
|
|
706 | 706 |
|
707 | 707 |
|
708 |
$block = feature_block($feature_name, $node->feature);
|
|
708 |
$block = feature_block($feature_name, $feature_node->term);
|
|
709 | 709 |
$block->content = array(); |
710 | 710 |
$block_content_is_empty = TRUE; |
711 | 711 |
|
712 |
if(array_search($node->feature->uuid, $use_description_features) !== false) {
|
|
712 |
if(array_search($feature_node->term->uuid, $use_description_features) !== false) {
|
|
713 | 713 |
// do not show features which belong to the UseDescriptions, these are |
714 | 714 |
// handled by compose_feature_block_items_use_records() where the according descriptions are |
715 | 715 |
// fetched again separately. |
... | ... | |
720 | 720 |
/* |
721 | 721 |
* Content/DISTRIBUTION. |
722 | 722 |
*/ |
723 |
if ($node->feature->uuid == UUID_DISTRIBUTION) {
|
|
724 |
$block = compose_feature_block_distribution($taxon, $node->descriptionElements, $node->feature);
|
|
723 |
if ($feature_node->term->uuid == UUID_DISTRIBUTION) {
|
|
724 |
$block = compose_feature_block_distribution($taxon, $feature_node->descriptionElements, $feature_node->term);
|
|
725 | 725 |
$block_content_is_empty = FALSE; |
726 | 726 |
} |
727 | 727 |
|
728 | 728 |
/* |
729 | 729 |
* Content/COMMON_NAME. |
730 | 730 |
*/ |
731 |
else if ($node->feature->uuid == UUID_COMMON_NAME) {
|
|
732 |
$common_names_render_array = compose_feature_block_items_feature_common_name($node->descriptionElements, $node->feature);
|
|
731 |
else if ($feature_node->term->uuid == UUID_COMMON_NAME) {
|
|
732 |
$common_names_render_array = compose_feature_block_items_feature_common_name($feature_node->descriptionElements, $feature_node->term);
|
|
733 | 733 |
$block->content[] = $common_names_render_array; |
734 | 734 |
$block_content_is_empty = FALSE; |
735 | 735 |
} |
... | ... | |
737 | 737 |
/* |
738 | 738 |
* Content/Use Description (Use + UseRecord) |
739 | 739 |
*/ |
740 |
else if ($node->feature->uuid == UUID_USE_RECORD) {
|
|
741 |
$block->content[] = cdm_block_use_description_content($taxon->uuid, $node->feature);
|
|
740 |
else if ($feature_node->term->uuid == UUID_USE_RECORD) {
|
|
741 |
$block->content[] = cdm_block_use_description_content($taxon->uuid, $feature_node->term);
|
|
742 | 742 |
$block_content_is_empty = FALSE; |
743 | 743 |
} |
744 | 744 |
|
... | ... | |
751 | 751 |
$elements_render_array = array(); |
752 | 752 |
$child_elements_render_array = null; |
753 | 753 |
|
754 |
if (isset($node->descriptionElements[0])) { |
|
755 |
$elements_render_array = compose_feature_block_items_generic($node->descriptionElements, $node->feature);
|
|
754 |
if (isset($feature_node->descriptionElements[0])) {
|
|
755 |
$elements_render_array = compose_feature_block_items_generic($feature_node->descriptionElements, $feature_node->term);
|
|
756 | 756 |
} |
757 | 757 |
|
758 | 758 |
// Content/ALL OTHER FEATURES/Subordinate Features |
759 | 759 |
// subordinate features are printed inline in one floating text, |
760 | 760 |
// it is expected hat subordinate features can "contain" TextData, |
761 | 761 |
// Qualitative- and Qualitative- DescriptionElements |
762 |
if (isset($node->childNodes[0])) { |
|
763 |
$child_elements_render_array = compose_feature_block_items_nested($node, $media_list, $feature_block_settings); |
|
762 |
if (isset($feature_node->childNodes[0])) {
|
|
763 |
$child_elements_render_array = compose_feature_block_items_nested($feature_node, $media_list, $feature_block_settings);
|
|
764 | 764 |
$elements_render_array = array_merge($elements_render_array, $child_elements_render_array); |
765 | 765 |
} |
766 | 766 |
$block_content_is_empty = $block_content_is_empty && empty($media_list) && empty($elements_render_array); |
767 | 767 |
if(!$block_content_is_empty){ |
768 |
$block->content[] = compose_feature_block_wrap_elements($elements_render_array, $node->feature, $feature_block_settings['glue']);
|
|
769 |
$block->content[] = compose_feature_media_gallery($node, $media_list, $gallery_settings); |
|
768 |
$block->content[] = compose_feature_block_wrap_elements($elements_render_array, $feature_node->term, $feature_block_settings['glue']);
|
|
769 |
$block->content[] = compose_feature_media_gallery($feature_node, $media_list, $gallery_settings);
|
|
770 | 770 |
/* |
771 | 771 |
* Footnotes for the feature block |
772 | 772 |
*/ |
773 |
$block->content[] = markup_to_render_array(theme('cdm_footnotes', array('footnoteListKey' => 'BIBLIOGRAPHY-' . $node->feature->uuid)));
|
|
774 |
$block->content[] = markup_to_render_array(theme('cdm_footnotes', array('footnoteListKey' => $node->feature->uuid)));
|
|
775 |
$block->content[] = markup_to_render_array(theme('cdm_annotation_footnotes', array('footnoteListKey' => $node->feature->uuid)));
|
|
773 |
$block->content[] = markup_to_render_array(theme('cdm_footnotes', array('footnoteListKey' => 'BIBLIOGRAPHY-' . $feature_node->term->uuid)));
|
|
774 |
$block->content[] = markup_to_render_array(theme('cdm_footnotes', array('footnoteListKey' => $feature_node->term->uuid)));
|
|
775 |
$block->content[] = markup_to_render_array(theme('cdm_annotation_footnotes', array('footnoteListKey' => $feature_node->term->uuid)));
|
|
776 | 776 |
} |
777 | 777 |
} // END all other features |
778 | 778 |
|
779 | 779 |
// allows modifying the block contents via a the hook_cdm_feature_node_block_content_alter |
780 |
drupal_alter('cdm_feature_node_block_content', $block->content, $node->feature, $node->descriptionElements);
|
|
780 |
drupal_alter('cdm_feature_node_block_content', $block->content, $feature_node->term, $feature_node->descriptionElements);
|
|
781 | 781 |
|
782 | 782 |
if(!$block_content_is_empty){ // skip empty block content |
783 | 783 |
$block_list[] = $block; |
784 |
cdm_toc_list_add_item(cdm_term_representation($node->feature), $node->feature->uuid);
|
|
784 |
cdm_toc_list_add_item(cdm_term_representation($feature_node->term), $feature_node->term->uuid);
|
|
785 | 785 |
} // END: skip empty block content |
786 | 786 |
} // END: skip empty or suppressed features |
787 | 787 |
RenderHints::popFromRenderStack(); |
... | ... | |
799 | 799 |
* |
800 | 800 |
* This function is called recursively! |
801 | 801 |
* |
802 |
* @param $node |
|
802 |
* @param $feature_node
|
|
803 | 803 |
* The feature node. |
804 | 804 |
* @param array $media_list |
805 | 805 |
* List of CDM Media entities. All media of subordinate elements should be passed to the main feature.รค |
... | ... | |
813 | 813 |
* |
814 | 814 |
* @ingroup compose |
815 | 815 |
*/ |
816 |
function compose_feature_block_items_nested($node, &$media_list, $feature_block_settings, $main_feature = NULL) |
|
816 |
function compose_feature_block_items_nested($feature_node, &$media_list, $feature_block_settings, $main_feature = NULL)
|
|
817 | 817 |
{ |
818 | 818 |
|
819 | 819 |
if(!$main_feature){ |
820 |
$main_feature = $node->feature;
|
|
820 |
$main_feature = $feature_node->term;
|
|
821 | 821 |
} |
822 | 822 |
/* |
823 | 823 |
* TODO should be configurable, options; YES, NO, AUTOMATIC |
... | ... | |
826 | 826 |
$prepend_feature_label = false; |
827 | 827 |
|
828 | 828 |
$render_arrays = array(); |
829 |
foreach ($node->childNodes as $child_node) { |
|
829 |
foreach ($feature_node->childNodes as $child_node) {
|
|
830 | 830 |
if (isset($child_node->descriptionElements[0])) { |
831 | 831 |
foreach ($child_node->descriptionElements as $element) { |
832 | 832 |
|
... | ... | |
864 | 864 |
|
865 | 865 |
/** |
866 | 866 |
* |
867 |
* @param $node |
|
867 |
* @param $feature_node
|
|
868 | 868 |
* The merged feature three node which potentially contains media in its description elements. |
869 | 869 |
* @param $media_list |
870 | 870 |
* Additional media to be merged witht the media contained in the nodes description elements |
... | ... | |
873 | 873 |
* |
874 | 874 |
* @ingroup compose |
875 | 875 |
*/ |
876 |
function compose_feature_media_gallery($node, $media_list, $gallery_settings) { |
|
876 |
function compose_feature_media_gallery($feature_node, $media_list, $gallery_settings) {
|
|
877 | 877 |
|
878 |
if (isset($node->descriptionElements)) { |
|
879 |
$media_list = array_merge($media_list, cdm_dataportal_media_from_descriptionElements($node->descriptionElements)); |
|
878 |
if (isset($feature_node->descriptionElements)) {
|
|
879 |
$media_list = array_merge($media_list, cdm_dataportal_media_from_descriptionElements($feature_node->descriptionElements));
|
|
880 | 880 |
} |
881 | 881 |
|
882 | 882 |
$captionElements = array('title', 'rights'); |
... | ... | |
884 | 884 |
if (isset($media_list[0]) && isset($gallery_settings['cdm_dataportal_media_maxextend']) && isset($gallery_settings['cdm_dataportal_media_cols'])) { |
885 | 885 |
$gallery = compose_cdm_media_gallerie(array( |
886 | 886 |
'mediaList' => $media_list, |
887 |
'galleryName' => CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME . '_' . $node->feature->uuid,
|
|
887 |
'galleryName' => CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME . '_' . $feature_node->term->uuid,
|
|
888 | 888 |
'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'], |
889 | 889 |
'cols' => $gallery_settings['cdm_dataportal_media_cols'], |
890 | 890 |
'captionElements' => $captionElements, |
modules/cdm_dataportal/settings.php | ||
---|---|---|
2206 | 2206 |
|
2207 | 2207 |
// creating helper object to retrieve the default settings |
2208 | 2208 |
$featureNode = new stdClass(); |
2209 |
$featureNode->feature = new stdClass();
|
|
2210 |
$featureNode->feature->uuid="DEFAULT";
|
|
2211 |
$featureNode->feature->representation_L10n = "Default";
|
|
2209 |
$featureNode->term = new stdClass();
|
|
2210 |
$featureNode->term->uuid="DEFAULT";
|
|
2211 |
$featureNode->term->representation_L10n = "Default";
|
|
2212 | 2212 |
array_unshift($profile_feature_tree->root->childNodes, $featureNode); |
2213 | 2213 |
|
2214 | 2214 |
foreach ($profile_feature_tree->root->childNodes as $featureNode) { |
2215 | 2215 |
|
2216 |
if (!$feature_list_layout_settings_disabled && isset($featureNode->feature)) {
|
|
2216 |
if (!$feature_list_layout_settings_disabled && isset($featureNode->term)) {
|
|
2217 | 2217 |
|
2218 | 2218 |
// $subform_id must not exceed 45 characters, a uuid has 36 characters |
2219 |
$subform_id = $featureNode->feature->uuid;
|
|
2220 |
$feature_block_setting = get_feature_block_settings($featureNode->feature->uuid);
|
|
2219 |
$subform_id = $featureNode->term->uuid;
|
|
2220 |
$feature_block_setting = get_feature_block_settings($featureNode->term->uuid);
|
|
2221 | 2221 |
|
2222 | 2222 |
// $settings = mixed_variable_get($subform_id, FEATURE_TREE_LAYOUT_DEFAULTS); |
2223 | 2223 |
|
2224 | 2224 |
$form_feature_block_layout[$subform_id] = array( |
2225 | 2225 |
'#type' => 'fieldset', |
2226 | 2226 |
'#tree' => TRUE, |
2227 |
'#title' => $featureNode->feature->representation_L10n,
|
|
2227 |
'#title' => $featureNode->term->representation_L10n,
|
|
2228 | 2228 |
'#collapsible' => FALSE, |
2229 | 2229 |
'#collapsed' => FALSE, |
2230 | 2230 |
); |
2231 |
if($featureNode->feature->uuid == "DEFAULT"){
|
|
2231 |
if($featureNode->term->uuid == "DEFAULT"){
|
|
2232 | 2232 |
$form_feature_block_layout[$subform_id]['#description']='These are the defaults which apply to |
2233 | 2233 |
all feature blocks for which no specific settings have been defined. for consistency enabling links for <em>source |
2234 | 2234 |
references</em> and <em>names in source</em> is only possible in the defaults'; |
... | ... | |
2246 | 2246 |
), |
2247 | 2247 |
); |
2248 | 2248 |
|
2249 |
if($featureNode->feature->uuid == "DEFAULT"){
|
|
2249 |
if($featureNode->term->uuid == "DEFAULT"){
|
|
2250 | 2250 |
$form_feature_block_layout[$subform_id]['link_to_reference'] = array( |
2251 | 2251 |
'#type' => 'checkbox', |
2252 | 2252 |
'#title' => t('Link to reference'), |
modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme | ||
---|---|---|
68 | 68 |
*/ |
69 | 69 |
function theme_FeatureTree_hierarchy_children($variables) { |
70 | 70 |
|
71 |
$node = $variables['node']; |
|
71 |
$feature_node = $variables['node'];
|
|
72 | 72 |
$out = ''; |
73 |
if (isset($node->childNodes)) { |
|
73 |
if (isset($feature_node->childNodes)) {
|
|
74 | 74 |
|
75 |
foreach ($node->childNodes as $child_node) {
|
|
76 |
$out .= '<li>' . check_plain($child_node->feature->representation_L10n);
|
|
77 |
if (isset($child_node->childNodes) && count($child_node->childNodes) > 0) {
|
|
78 |
$out .= '<ul>' . theme('FeatureTree_hierarchy_children', array('node' => $child_node)) . '</ul>'; |
|
75 |
foreach ($feature_node->childNodes as $child_feature_node) {
|
|
76 |
$out .= '<li>' . check_plain($child_feature_node->term->representation_L10n);
|
|
77 |
if (isset($child_feature_node->childNodes) && count($child_feature_node->childNodes) > 0) {
|
|
78 |
$out .= '<ul>' . theme('FeatureTree_hierarchy_children', array('node' => $child_feature_node)) . '</ul>';
|
|
79 | 79 |
} |
80 | 80 |
$out .= '</li>'; |
81 | 81 |
} |
Also available in: Unified diff
ref #8166 adapting to change in FeatureNode property 'feature' becomes 'term'