Revision 7663cd0b
Added by Andreas Kohlbecker over 8 years ago
modules/cdm_dataportal/includes/pages.inc | ||
---|---|---|
451 | 451 |
taxon_page_tabs_hidden('keys'); |
452 | 452 |
} |
453 | 453 |
|
454 |
if ($tabsToDisplay["Synonymy"] == '0') { |
|
454 |
// --- GET TaxonNodeAgentRelations --- // |
|
455 |
$current_classification_uuid = get_current_classification_uuid(); |
|
456 |
$taxon_node_agent_relations_pager = cdm_ws_get(CDM_WS_PORTAL_TAXON_TAXONNODEAGENTRELATIONS, |
|
457 |
array( |
|
458 |
$taxon->uuid, |
|
459 |
$current_classification_uuid, |
|
460 |
), |
|
461 |
"pageSize=1&pageIndex=0"// we are only interested into the count so we are fetching only one item, o is not possible! |
|
462 |
); |
|
463 |
if (!$taxon_node_agent_relations_pager || $taxon_node_agent_relations_pager->count == 0){ |
|
464 |
taxon_page_tabs_hidden('experts'); |
|
465 |
} |
|
466 |
|
|
467 |
if ($tabsToDisplay["Synonymy"] == '0') { |
|
455 | 468 |
taxon_page_tabs_hidden('synonymy'); |
456 | 469 |
} |
457 | 470 |
|
... | ... | |
545 | 558 |
$render_array['keys'] = markup_to_render_array($keys_html, $weight++); |
546 | 559 |
} |
547 | 560 |
|
561 |
// --- PAGE PART: EXPERTS --- // |
|
562 |
|
|
563 |
if (array_search('experts', taxon_page_tabs_hidden()) === FALSE && ($page_part == 'experts' || $page_part == 'all')) { |
|
564 |
$render_array['experts'] = array( |
|
565 |
'#prefix' => '<div id="experts" class="page-part">' . ($page_part == 'all' ? '<h2>' . t('Experts') . '</h2>' : ''), |
|
566 |
'content' => compose_cdm_taxon_page_experts($taxon), // returns render array |
|
567 |
'#suffix' => '</div>', |
|
568 |
); |
|
569 |
} |
|
570 |
|
|
571 |
// ------------------ END OF PARTS -------------- // |
|
548 | 572 |
|
549 | 573 |
// adjust weights of page and toc elements according to the settings |
550 | 574 |
$taxontabs_weights = get_array_variable_merged('cdm_taxonpage_tabs_weight', CDM_TAXONPAGE_TAB_WEIGHT_DEFAULT); |
... | ... | |
730 | 754 |
return $render_array; |
731 | 755 |
} |
732 | 756 |
|
757 |
function compose_cdm_taxon_page_experts($taxon){ |
|
758 |
|
|
759 |
$render_array = array(); |
|
760 |
if(!isset($taxon->uuid)){ |
|
761 |
return $render_array; |
|
762 |
} |
|
763 |
|
|
764 |
$current_classification_uuid = get_current_classification_uuid(); |
|
765 |
// TODO use cdm_ws_fetchall below but this failes! needs fix! |
|
766 |
$taxon_node_agent_relations = cdm_ws_get(CDM_WS_PORTAL_TAXON_TAXONNODEAGENTRELATIONS, |
|
767 |
array( |
|
768 |
$taxon->uuid, |
|
769 |
$current_classification_uuid |
|
770 |
) |
|
771 |
); |
|
772 |
|
|
773 |
|
|
774 |
$header = array( |
|
775 |
array('data' => t('Expert')), |
|
776 |
array('data' => t('Role')) |
|
777 |
); |
|
778 |
$rows = array(); |
|
779 |
|
|
780 |
|
|
781 |
foreach($taxon_node_agent_relations->records as $taxon_node_agent_relation){ |
|
782 |
$rows[] = array( |
|
783 |
|
|
784 |
'data' => array( |
|
785 |
$taxon_node_agent_relation->agent->titleCache, |
|
786 |
$taxon_node_agent_relation->type->representation_L10n |
|
787 |
), |
|
788 |
//'class' => array(html_class_attribute_ref($taxon_node_agent_relation->agent)), |
|
789 |
|
|
790 |
); |
|
791 |
} |
|
792 |
|
|
793 |
|
|
794 |
$render_array['experts_table'] = array( |
|
795 |
'#theme' => 'table', |
|
796 |
'#header' => $header, |
|
797 |
'#rows' => $rows, |
|
798 |
); |
|
799 |
|
|
800 |
|
|
801 |
return $render_array; |
|
802 |
} |
|
803 |
|
|
733 | 804 |
|
734 | 805 |
/** |
735 |
* Manages the tab to be hidden in the taxon page. |
|
806 |
* Manages the tabs to be hidden in the taxon page.
|
|
736 | 807 |
* |
737 | 808 |
* The tabs are identified by their last menu link path element: |
738 | 809 |
* - description |
... | ... | |
745 | 816 |
* managed by drupal_static(). |
746 | 817 |
* |
747 | 818 |
* @param string $add_tab |
748 |
* Optinal parameter. The given string will be added to the array of tabs |
|
819 |
* Optional parameter. The given string will be added to the array of tabs
|
|
749 | 820 |
* |
750 | 821 |
* @return |
751 | 822 |
* The array of tabs |
Also available in: Unified diff
#4313 first implementation of the taxon experts tab