Revision 22383f95
Added by Andreas Kohlbecker almost 7 years ago
modules/cdm_dataportal/includes/pages.inc | ||
---|---|---|
431 | 431 |
|
432 | 432 |
$page_part = variable_get('cdm_dataportal_taxonpage_tabs', 1) ? $page_part : 'all'; |
433 | 433 |
|
434 |
$synonymy_as_tab = variable_get(CDM_SYNONYMY_AS_TAB, CDM_SYNONYMY_AS_TAB_DEFAULT) === 1; |
|
435 |
if(!$synonymy_as_tab){ |
|
436 |
unset($tabsToDisplay["Synonymy"]); |
|
437 |
} |
|
438 |
|
|
434 | 439 |
$media = _load_media_for_taxon($taxon); |
435 | 440 |
|
436 | 441 |
|
... | ... | |
456 | 461 |
taxon_page_tabs_hidden('keys'); |
457 | 462 |
} |
458 | 463 |
|
459 |
// --- GET TaxonNodeAgentRelations --- //
|
|
460 |
$current_classification_uuid = get_current_classification_uuid();
|
|
461 |
$taxon_node_agent_relations_pager = cdm_ws_get(CDM_WS_PORTAL_TAXON_TAXONNODEAGENTRELATIONS,
|
|
462 |
array(
|
|
463 |
$taxon->uuid,
|
|
464 |
$current_classification_uuid,
|
|
465 |
),
|
|
466 |
"pageSize=1&pageIndex=0"// we are only interested into the count so we are fetching only one item, o is not possible!
|
|
467 |
);
|
|
468 |
if (!$taxon_node_agent_relations_pager || $taxon_node_agent_relations_pager->count == 0){
|
|
469 |
taxon_page_tabs_hidden('experts');
|
|
470 |
}
|
|
464 |
// --- GET TaxonNodeAgentRelations --- // |
|
465 |
$current_classification_uuid = get_current_classification_uuid(); |
|
466 |
$taxon_node_agent_relations_pager = cdm_ws_get(CDM_WS_PORTAL_TAXON_TAXONNODEAGENTRELATIONS, |
|
467 |
array( |
|
468 |
$taxon->uuid, |
|
469 |
$current_classification_uuid, |
|
470 |
), |
|
471 |
"pageSize=1&pageIndex=0"// we are only interested into the count so we are fetching only one item, o is not possible! |
|
472 |
); |
|
473 |
if (!$taxon_node_agent_relations_pager || $taxon_node_agent_relations_pager->count == 0){ |
|
474 |
taxon_page_tabs_hidden('experts'); |
|
475 |
} |
|
471 | 476 |
|
472 |
if ($tabsToDisplay["Synonymy"] == '0') {
|
|
477 |
if (!isset($tabsToDisplay["Synonymy"]) || $tabsToDisplay["Synonymy"] == '0') {
|
|
473 | 478 |
taxon_page_tabs_hidden('synonymy'); |
474 | 479 |
} |
475 | 480 |
|
... | ... | |
485 | 490 |
$merged_tree = merged_taxon_feature_tree($taxon); |
486 | 491 |
|
487 | 492 |
|
488 |
$render_array['general'] = compose_cdm_taxon_page_profile($taxon, $merged_tree, $media); |
|
493 |
$render_array['general'] = compose_cdm_taxon_page_profile($taxon, $merged_tree, $media, !$synonymy_as_tab);
|
|
489 | 494 |
$render_array['general']['#weight'] = $weight++; |
490 | 495 |
$render_array['general']['#prefix'] = '<div id="general" class="page-part">'; |
491 | 496 |
$render_array['general']['#suffix'] = '</div>'; |
... | ... | |
525 | 530 |
} |
526 | 531 |
|
527 | 532 |
// --- PAGE PART: SYNONYMY --- // |
528 |
if (($page_part == 'synonymy' || $page_part == 'all')) {
|
|
533 |
if ((($page_part == 'synonymy' || $page_part == 'all') && $synonymy_as_tab)) {
|
|
529 | 534 |
$synonymy_html = '<div id="synonymy" class="page-part">'; |
530 | 535 |
if ($page_part == 'all') { |
531 | 536 |
$synonymy_html .= '<h2>' . t(cdm_taxonpage_tab_label('Synonymy')) . '</h2>'; |
... | ... | |
656 | 661 |
* |
657 | 662 |
* @ingroup compose |
658 | 663 |
*/ |
659 |
function compose_cdm_taxon_page_profile($taxon, $merged_tree, $media) { |
|
664 |
function compose_cdm_taxon_page_profile($taxon, $merged_tree, $media, $add_synonymy) {
|
|
660 | 665 |
|
661 | 666 |
$render_array = array(); |
662 | 667 |
|
... | ... | |
713 | 718 |
} |
714 | 719 |
} |
715 | 720 |
|
721 |
if($add_synonymy){ |
|
722 |
$render_array['synonymy'] = markup_to_render_array( |
|
723 |
theme('cdm_taxon_page_synonymy', array('taxon' => $taxon, 'addAcceptedTaxon' => true)), |
|
724 |
-102 |
|
725 |
); |
|
726 |
} |
|
727 |
|
|
716 | 728 |
$pseudo_feature_blocks = array(); |
717 | 729 |
$pseudo_feature_block_toc_items = array(); |
718 | 730 |
|
modules/cdm_dataportal/settings.php | ||
---|---|---|
112 | 112 |
define('DISTRIBUTION_ORDER_MODE_DEFAULT', 'TREE'); |
113 | 113 |
define('DISTRIBUTION_TREE_OMIT_LEVELS', 'distribution_tree_omit_levels'); |
114 | 114 |
|
115 |
define('CDM_SYNONYMY_AS_TAB', 'cdm_synonymy_as_tab'); |
|
116 |
define('CDM_SYNONYMY_AS_TAB_DEFAULT', 1); |
|
117 |
|
|
115 | 118 |
/** |
116 | 119 |
* Returns the array of implemented taxon page tabs. |
117 | 120 |
* The array has fixed integer keys which must not be changed. |
118 | 121 |
*/ |
119 | 122 |
function get_taxon_tabs_list() { |
120 |
return array(
|
|
123 |
$opts = array(
|
|
121 | 124 |
0 => 'General', |
122 | 125 |
1 => 'Synonymy', |
123 | 126 |
2 => 'Images', |
... | ... | |
125 | 128 |
4 => 'Keys', |
126 | 129 |
5 => 'Experts', |
127 | 130 |
); |
131 |
if(variable_get(CDM_SYNONYMY_AS_TAB, CDM_SYNONYMY_AS_TAB_DEFAULT) !== 1){ |
|
132 |
// skip the Synonymy if it is shown in the general tab |
|
133 |
unset($opts[1]); |
|
134 |
} |
|
135 |
return $opts; |
|
128 | 136 |
} |
129 | 137 |
|
130 | 138 |
define('CDM_TAXONPAGE_TAB_WEIGHT', 'cdm_taxonpage_tab_weight'); |
... | ... | |
1873 | 1881 |
'#type' => 'checkbox', |
1874 | 1882 |
'#title' => t('Tabbed taxon page'), |
1875 | 1883 |
'#default_value' => variable_get('cdm_dataportal_taxonpage_tabs', 1), |
1876 |
'#description' => t('<p>If selected split the taxon page into individual
|
|
1884 |
'#description' => t('If selected split the taxon page into individual |
|
1877 | 1885 |
tabs for description, images, synonymy and specimens. If not the taxon |
1878 |
data is rendered as a long single page without tabs.</p>'), |
|
1886 |
data is rendered as a long single page without tabs.'), |
|
1887 |
); |
|
1888 |
|
|
1889 |
$form['taxon_tabs'][CDM_SYNONYMY_AS_TAB] = array( |
|
1890 |
'#type' => 'checkbox', |
|
1891 |
'#title' => t('Synonymy as tab'), |
|
1892 |
'#default_value' => variable_get(CDM_SYNONYMY_AS_TAB, CDM_SYNONYMY_AS_TAB_DEFAULT), |
|
1893 |
'#description' => t('The synonymy can be moved to its own tab. This is only applicable when the tabbed taxon page option is activated.'), |
|
1894 |
'#disabled' => variable_get('cdm_dataportal_taxonpage_tabs', 1) !== 1 |
|
1879 | 1895 |
); |
1880 | 1896 |
|
1881 | 1897 |
$form['taxon_tabs']['cdm_taxonpage_tabs_visibility'] = array( |
Also available in: Unified diff
fix #6820 synonymy can be placed in the general page instead of being a tab