1 |
5189a8ec
|
Andreas Kohlbecker
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* Extensions to the cdm dataportal module specific for the Palmweb project
|
5 |
|
|
*
|
6 |
|
|
* @copyright
|
7 |
|
|
* (C) 2007-2013 EDIT
|
8 |
|
|
* European Distributed Institute of Taxonomy
|
9 |
|
|
* http://www.e-taxonomy.eu
|
10 |
|
|
*
|
11 |
|
|
* The contents of this module are subject to the Mozilla
|
12 |
|
|
* Public License Version 1.1.
|
13 |
|
|
* @see http://www.mozilla.org/MPL/MPL-1.1.html
|
14 |
|
|
*
|
15 |
|
|
* @author
|
16 |
|
|
* - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
|
17 |
|
|
* - Alex Theys
|
18 |
|
|
*/
|
19 |
|
|
|
20 |
|
|
|
21 |
dd1c109a
|
Andreas Kohlbecker
|
/**
|
22 |
9aff46e4
|
Andreas Kohlbecker
|
* Implements hook_cdm_feature_node_blocks_alter()
|
23 |
dd1c109a
|
Andreas Kohlbecker
|
*
|
24 |
|
|
*/
|
25 |
9aff46e4
|
Andreas Kohlbecker
|
function palmweb_cdm_feature_node_blocks_alter(&$block_list, $taxon){
|
26 |
5189a8ec
|
Andreas Kohlbecker
|
|
27 |
9aff46e4
|
Andreas Kohlbecker
|
if($taxon) {
|
28 |
|
|
// taxon is only given if called from within the taxon general page part
|
29 |
7663cd0b
|
Andreas Kohlbecker
|
$numberOfChildren = count(cdm_ws_get(CDM_WS_PORTAL_TAXONOMY_CHILDNODES_OF_TAXON, array (get_current_classification_uuid(), $taxon->uuid)));
|
30 |
9aff46e4
|
Andreas Kohlbecker
|
$subRank = 'sub taxa';
|
31 |
|
|
if ($taxon->name->rank->titleCache == "Genus") {
|
32 |
|
|
$subRank = "species";
|
33 |
|
|
} else if ($taxon->name->rank->titleCache == "Species") {
|
34 |
|
|
if($numberOfChildren==1){
|
35 |
|
|
$subRank = "infraspecific taxon";
|
36 |
|
|
}
|
37 |
|
|
else {
|
38 |
|
|
$subRank = "infraspecific taxa";
|
39 |
|
|
}
|
40 |
|
|
}
|
41 |
|
|
if ($numberOfChildren > 0) {
|
42 |
|
|
$block = feature_block('Number of Taxa');
|
43 |
c651d3b1
|
Andreas Kohlbecker
|
// FIXME use compose_feature_block_wrap_elements() in next line
|
44 |
9aff46e4
|
Andreas Kohlbecker
|
$block->content = array(markup_to_render_array('<ul class="feature-block-elements"><li>' . $numberOfChildren . " " . $subRank . '</li></ul>'));
|
45 |
|
|
array_unshift($block_list, $block);
|
46 |
|
|
cdm_toc_list_add_item('Number of Taxa', 'number-of-taxa', NULL, TRUE);
|
47 |
|
|
}
|
48 |
dd1c109a
|
Andreas Kohlbecker
|
}
|
49 |
5189a8ec
|
Andreas Kohlbecker
|
|
50 |
9aff46e4
|
Andreas Kohlbecker
|
return $block_list;
|
51 |
|
|
}
|