Project

General

Profile

Download (1.61 KB) Statistics
| Branch: | Tag: | Revision:
1
<?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
  /**
22
   * Implements hook_cdm_feature_node_blocks_alter()
23
   *
24
   */
25
  function palmweb_cdm_feature_node_blocks_alter(&$block_list, $taxon){
26

    
27
    if($taxon) {
28
      // taxon is only given if called from within the taxon general page part
29
      $numberOfChildren = count(cdm_ws_get(CDM_WS_PORTAL_TAXONOMY_CHILDNODES_OF_TAXON, array (get_current_classification_uuid(), $taxon->uuid)));
30
      $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
        // FIXME use compose_feature_block_wrap_elements() in next line
44
        $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
    }
49

    
50
    return $block_list;
51
  }
(2-2/2)