Revision 5189a8ec
Added by Andreas Kohlbecker over 10 years ago
7.x/themes/palmweb_2/template.php | ||
---|---|---|
80 | 80 |
|
81 | 81 |
} |
82 | 82 |
|
83 |
/** |
|
84 |
* @todo Please document this function. |
|
85 |
* @see http://drupal.org/node/1354 |
|
86 |
*/ |
|
87 |
function palmweb_2_cdm_feature_nodesTOC($variables){ |
|
88 |
$featureNodes = $variables['featureNodes']; |
|
89 |
$out = ''; |
|
90 |
|
|
91 |
global $theme; |
|
92 |
|
|
93 |
$out .= '<ul>'; |
|
94 |
$countFeatures = 0; |
|
95 |
$numberOfChildren = count(cdm_ws_get(CDM_WS_PORTAL_TAXONOMY_CHILDNODES_OF_TAXON, array ( |
|
96 |
get_taxonomictree_uuid_selected(), |
|
97 |
substr(strrchr($_GET["q"],'/'), 1), |
|
98 |
))); |
|
99 |
if ($numberOfChildren != 0) { |
|
100 |
$out .= '<li>'; |
|
101 |
$out .= l(t(theme('cdm_feature_name', array('feature_name' => 'Number of Taxa'))), $_GET['q'], array( |
|
102 |
'attributes' => array('class' => array('toc')), |
|
103 |
'fragment' => generalizeString('Number Of Taxa'), |
|
104 |
)); |
|
105 |
$out .= '</li>'; |
|
106 |
} |
|
107 |
foreach ($featureNodes as $node) { |
|
108 |
if (hasFeatureNodeDescriptionElements($node)) { |
|
109 |
$featureRepresentation = isset($node->feature->representation_L10n) ? $node->feature->representation_L10n : 'Feature'; |
|
110 |
|
|
111 |
// HACK to implement images for taxa, should be removed. |
|
112 |
if ($node->feature->uuid != UUID_IMAGE && $node->feature->uuid != UUID_USE) { |
|
113 |
$countFeatures++; |
|
114 |
$countFeatures++; |
|
115 |
$out .= '<li>' . l(t(theme('cdm_feature_name', array('feature_name' => $featureRepresentation))), $_GET['q'], |
|
116 |
array('attributes' => array('class' => array('toc')),'fragment' => generalizeString($featureRepresentation))) . '</li>'; |
|
117 |
} |
|
118 |
} |
|
119 |
} |
|
120 |
// Setting the Anchor to the Bibliography section if the option is enabled. |
|
121 |
$show_bibliography = variable_get('cdm_show_bibliography', 1); |
|
122 |
|
|
123 |
$markerTypes['markerTypes'] = UUID_MARKERTYPE_USE; |
|
124 |
$useDescriptions = cdm_ws_get(CDM_WS_PORTAL_TAXON_DESCRIPTIONS, substr(strrchr($_GET["q"], '/'), 1), queryString($markerTypes)); |
|
125 |
if (!empty($useDescriptions)) { |
|
126 |
$out .= '<li>'; |
|
127 |
$out .= l(t(theme('cdm_feature_name', array('feature_name' => 'Uses'))), $_GET['q'], array( |
|
128 |
'attributes' => array('class' => array('toc')), |
|
129 |
'fragment' => 'userecords', |
|
130 |
)); |
|
131 |
$out .= '</li>'; |
|
132 |
} |
|
133 |
|
|
134 |
if ($show_bibliography && $countFeatures != 0) { |
|
135 |
$out .= '<li>' . l(t(theme('cdm_feature_name', array('feature_name' => 'Bibliography'))), $_GET['q'], array('attributes' => array('class' => array('toc')), 'fragment' => 'bibliography')) . '</li>'; |
|
136 |
} |
|
137 |
$out .= '</ul>'; |
|
138 |
return $out; |
|
139 |
} |
|
140 |
|
|
141 | 83 |
/** |
142 | 84 |
* @todo Please document this function. |
143 | 85 |
* @see http://drupal.org/node/1354 |
Also available in: Unified diff
creating hook_cdm_feature_node_toc_items_alter() for palmweb and creating a palmweb module and documentation of api hooks