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_toc_items_alter()
|
23
|
*/
|
24
|
function palmweb_cdm_feature_node_toc_items_alter($items){
|
25
|
|
26
|
$http_request_params = drupal_get_query_parameters();
|
27
|
$countFeatures = count($items);
|
28
|
|
29
|
// number of taxa
|
30
|
$numberOfChildren = count(cdm_ws_get(CDM_WS_PORTAL_TAXONOMY_CHILDNODES_OF_TAXON, array (
|
31
|
get_taxonomictree_uuid_selected(),
|
32
|
substr(strrchr($_GET["q"],'/'), 1),
|
33
|
)));
|
34
|
if ($numberOfChildren != 0) {
|
35
|
array_unshift($items,
|
36
|
l(
|
37
|
t(theme('cdm_feature_name', array('feature_name' => 'Number of Taxa'))),
|
38
|
$_GET['q'],
|
39
|
array(
|
40
|
'query' => $http_request_params,
|
41
|
'attributes' => array('class' => array('toc')),
|
42
|
'fragment' => generalizeString('Number Of Taxa'),
|
43
|
)
|
44
|
)
|
45
|
);
|
46
|
}
|
47
|
|
48
|
// Setting the Anchor to the Bibliography section if the option is enabled.
|
49
|
$show_bibliography = variable_get('cdm_show_bibliography', 1);
|
50
|
|
51
|
$markerTypes['markerTypes'] = UUID_MARKERTYPE_USE;
|
52
|
$useDescriptions = cdm_ws_get(CDM_WS_PORTAL_TAXON_DESCRIPTIONS, substr(strrchr($_GET["q"], '/'), 1), queryString($markerTypes));
|
53
|
if (!empty($useDescriptions)) {
|
54
|
$items[] = l(
|
55
|
t(theme('cdm_feature_name', array('feature_name' => 'Uses'))),
|
56
|
$_GET['q'],
|
57
|
array(
|
58
|
'query' => $http_request_params,
|
59
|
'attributes' => array('class' => array('toc')),
|
60
|
'fragment' => 'userecords'
|
61
|
)
|
62
|
);
|
63
|
}
|
64
|
|
65
|
if ($show_bibliography && $countFeatures != 0) {
|
66
|
$items[] = l(
|
67
|
t(theme('cdm_feature_name', array('feature_name' => 'Bibliography'))),
|
68
|
$_GET['q'],
|
69
|
array(
|
70
|
'query' => $http_request_params,
|
71
|
'attributes' => array('class' => array('toc')),
|
72
|
'fragment' => 'bibliography'
|
73
|
)
|
74
|
);
|
75
|
}
|
76
|
return $items;
|
77
|
}
|