Revision 80e0aa8e
Added by Andreas Kohlbecker about 14 years ago
themes/garland_diptera/template.php | ||
---|---|---|
7 | 7 |
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed. |
8 | 8 |
*/ |
9 | 9 |
function phptemplate_body_class($sidebar_left, $sidebar_right) { |
10 |
if ($sidebar_left != '' && $sidebar_right != '') {
|
|
11 |
$class = 'sidebars';
|
|
12 |
}
|
|
13 |
else {
|
|
14 |
if ($sidebar_left != '') {
|
|
15 |
$class = 'sidebar-left';
|
|
16 |
}
|
|
17 |
if ($sidebar_right != '') {
|
|
18 |
$class = 'sidebar-right';
|
|
19 |
}
|
|
20 |
}
|
|
10 |
if ($sidebar_left != '' && $sidebar_right != '') {
|
|
11 |
$class = 'sidebars';
|
|
12 |
}
|
|
13 |
else {
|
|
14 |
if ($sidebar_left != '') {
|
|
15 |
$class = 'sidebar-left';
|
|
16 |
}
|
|
17 |
if ($sidebar_right != '') {
|
|
18 |
$class = 'sidebar-right';
|
|
19 |
}
|
|
20 |
}
|
|
21 | 21 |
|
22 |
if (isset($class)) {
|
|
23 |
print ' class="'. $class .'"';
|
|
24 |
}
|
|
22 |
if (isset($class)) {
|
|
23 |
print ' class="'. $class .'"';
|
|
24 |
}
|
|
25 | 25 |
} |
26 | 26 |
|
27 | 27 |
/** |
... | ... | |
32 | 32 |
* @return a string containing the breadcrumb output. |
33 | 33 |
*/ |
34 | 34 |
function phptemplate_breadcrumb($breadcrumb) { |
35 |
if (!empty($breadcrumb)) {
|
|
36 |
return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
|
|
37 |
}
|
|
35 |
if (!empty($breadcrumb)) {
|
|
36 |
return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
|
|
37 |
}
|
|
38 | 38 |
} |
39 | 39 |
|
40 | 40 |
/** |
41 | 41 |
* Allow themable wrapping of all comments. |
42 | 42 |
*/ |
43 | 43 |
function phptemplate_comment_wrapper($content, $type = null) { |
44 |
static $node_type;
|
|
45 |
if (isset($type)) $node_type = $type;
|
|
44 |
static $node_type;
|
|
45 |
if (isset($type)) $node_type = $type;
|
|
46 | 46 |
|
47 |
if (!$content || $node_type == 'forum') {
|
|
48 |
return '<div id="comments">'. $content . '</div>';
|
|
49 |
}
|
|
50 |
else {
|
|
51 |
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
|
|
52 |
}
|
|
47 |
if (!$content || $node_type == 'forum') {
|
|
48 |
return '<div id="comments">'. $content . '</div>';
|
|
49 |
}
|
|
50 |
else {
|
|
51 |
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
|
|
52 |
}
|
|
53 | 53 |
} |
54 | 54 |
|
55 | 55 |
/** |
56 | 56 |
* Override or insert PHPTemplate variables into the templates. |
57 | 57 |
*/ |
58 | 58 |
function _phptemplate_variables($hook, $vars) { |
59 |
if ($hook == 'page') {
|
|
59 |
if ($hook == 'page') {
|
|
60 | 60 |
|
61 |
if ($secondary = menu_secondary_local_tasks()) {
|
|
62 |
$output = '<span class="clear"></span>';
|
|
63 |
$output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
|
|
64 |
$vars['tabs2'] = $output;
|
|
65 |
}
|
|
61 |
if ($secondary = menu_secondary_local_tasks()) {
|
|
62 |
$output = '<span class="clear"></span>';
|
|
63 |
$output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
|
|
64 |
$vars['tabs2'] = $output;
|
|
65 |
}
|
|
66 | 66 |
|
67 |
// Hook into color.module
|
|
68 |
if (module_exists('color')) {
|
|
69 |
_color_page_alter($vars);
|
|
70 |
}
|
|
71 |
return $vars;
|
|
72 |
}
|
|
73 |
return array();
|
|
67 |
// Hook into color.module
|
|
68 |
if (module_exists('color')) {
|
|
69 |
_color_page_alter($vars);
|
|
70 |
}
|
|
71 |
return $vars;
|
|
72 |
}
|
|
73 |
return array();
|
|
74 | 74 |
} |
75 | 75 |
|
76 | 76 |
/** |
... | ... | |
80 | 80 |
* @ingroup themeable |
81 | 81 |
*/ |
82 | 82 |
function phptemplate_menu_local_tasks() { |
83 |
$output = '';
|
|
83 |
$output = '';
|
|
84 | 84 |
|
85 |
if ($primary = menu_primary_local_tasks()) {
|
|
86 |
$output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
|
|
87 |
}
|
|
85 |
if ($primary = menu_primary_local_tasks()) {
|
|
86 |
$output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
|
|
87 |
}
|
|
88 | 88 |
|
89 |
return $output;
|
|
89 |
return $output;
|
|
90 | 90 |
} |
91 | 91 |
|
92 | 92 |
/** |
... | ... | |
143 | 143 |
|
144 | 144 |
function garland_diptera_cdm_descriptionElements($descriptionElements){ |
145 | 145 |
|
146 |
$outArray = array();
|
|
147 |
$glue = '';
|
|
148 |
$sortOutArray = false;
|
|
149 |
$enclosingHtml = 'ul';
|
|
150 |
|
|
146 |
$outArray = array();
|
|
147 |
$glue = '';
|
|
148 |
$sortOutArray = false;
|
|
149 |
$enclosingHtml = 'ul';
|
|
150 |
|
|
151 | 151 |
$citations = array(); |
152 | 152 |
|
153 |
// only for diptera
|
|
154 |
if(isset($descriptionElements[0]) && $descriptionElements[0]->feature->uuid == UUID_CITATION ) {
|
|
155 |
foreach($descriptionElements as $element){
|
|
156 |
$tokens = split(":", $element->multilanguageText_L10n->text);
|
|
157 |
if(count($tokens) == 2){
|
|
158 |
// token[0]: taxon name; token[1]: note;
|
|
159 |
$element->multilanguageText_L10n->text = $tokens[1] . ' [<span class="name">' . $tokens[0] . '</span>]';
|
|
160 |
}
|
|
161 |
if(isset($element->citation->datePublished->start)){
|
|
162 |
$elementMap[partialToYear($element->citation->datePublished->start)] = $element;
|
|
163 |
} else {
|
|
164 |
$elementMap[] = $element;
|
|
165 |
}
|
|
166 |
}
|
|
167 |
$success = ksort($elementMap);
|
|
168 |
$descriptionElements = $elementMap;
|
|
169 |
}
|
|
170 |
// ---
|
|
153 |
// only for diptera
|
|
154 |
if(isset($descriptionElements[0]) && $descriptionElements[0]->feature->uuid == UUID_CITATION ) {
|
|
155 |
foreach($descriptionElements as $element){
|
|
156 |
$tokens = split(":", $element->multilanguageText_L10n->text);
|
|
157 |
if(count($tokens) == 2){
|
|
158 |
// token[0]: taxon name; token[1]: note;
|
|
159 |
$element->multilanguageText_L10n->text = $tokens[1] . ' [<span class="name">' . $tokens[0] . '</span>]';
|
|
160 |
}
|
|
161 |
if(isset($element->citation->datePublished->start)){
|
|
162 |
$elementMap[partialToYear($element->citation->datePublished->start)] = $element;
|
|
163 |
} else {
|
|
164 |
$elementMap[] = $element;
|
|
165 |
}
|
|
166 |
}
|
|
167 |
$success = ksort($elementMap);
|
|
168 |
$descriptionElements = $elementMap;
|
|
169 |
}
|
|
170 |
// ---
|
|
171 | 171 |
usort($descriptionElements, 'compare_citations'); |
172 |
foreach($descriptionElements as $element){
|
|
173 |
if($element->class == 'TextData'){
|
|
174 |
$asListElement = true;
|
|
175 |
$outArray[] = theme('cdm_descriptionElementTextData', $element, $asListElement);
|
|
176 |
}else if($element->class == 'Distribution'){
|
|
177 |
if( !array_search($element->area->representation_L10n, $outArray)){
|
|
178 |
$outArray[] = $element->area->representation_L10n;
|
|
179 |
$glue = ', ';
|
|
180 |
$sortOutArray = true;
|
|
181 |
$enclosingHtml = 'p';
|
|
182 |
}
|
|
183 |
}else{
|
|
184 |
$outArray[] = '<li>No method for rendering unknown description class: '.$element->classType.'</li>';
|
|
185 |
}
|
|
186 |
}
|
|
172 |
foreach($descriptionElements as $element){
|
|
173 |
if($element->class == 'TextData'){
|
|
174 |
$asListElement = true;
|
|
175 |
$outArray[] = theme('cdm_descriptionElementTextData', $element, $asListElement);
|
|
176 |
}else if($element->class == 'Distribution'){
|
|
177 |
if( !array_search($element->area->representation_L10n, $outArray)){
|
|
178 |
$outArray[] = $element->area->representation_L10n;
|
|
179 |
$glue = ', ';
|
|
180 |
$sortOutArray = true;
|
|
181 |
$enclosingHtml = 'p';
|
|
182 |
}
|
|
183 |
}else{
|
|
184 |
$outArray[] = '<li>No method for rendering unknown description class: '.$element->classType.'</li>';
|
|
185 |
}
|
|
186 |
}
|
|
187 | 187 |
|
188 |
return theme('cdm_descriptionElementArray', $outArray, $feature, $glue, $sortOutArray, $enclosingHtml);
|
|
188 |
return theme('cdm_descriptionElementArray', $outArray, $feature, $glue, $sortOutArray, $enclosingHtml);
|
|
189 | 189 |
} |
190 | 190 |
|
191 | 191 |
/** |
192 | 192 |
* Allows theaming of the taxon page tabs |
193 |
* |
|
193 |
*
|
|
194 | 194 |
* @param $tabname |
195 | 195 |
* @return unknown_type |
196 | 196 |
*/ |
197 | 197 |
function garland_diptera_cdm_taxonpage_tab($tabname){ |
198 |
switch($tabname){
|
|
199 |
case 'Synonymy' : return t('Nomenclature'); break;
|
|
200 |
default : return t($tabname);
|
|
201 |
}
|
|
198 |
switch($tabname){
|
|
199 |
case 'Synonymy' : return t('Nomenclature'); break;
|
|
200 |
default : return t($tabname);
|
|
201 |
}
|
|
202 | 202 |
} |
203 | 203 |
|
204 | 204 |
function garland_diptera_cdm_feature_name($feature_name){ |
205 |
switch($feature_name){
|
|
206 |
case "Citation": return t("Citations");
|
|
205 |
switch($feature_name){
|
|
206 |
case "Citation": return t("Citations");
|
|
207 | 207 |
case 'Has orthographic variant': return t("Misspellings"); |
208 |
default: return t(ucfirst($feature_name));
|
|
209 |
}
|
|
208 |
default: return t(ucfirst($feature_name));
|
|
209 |
}
|
|
210 | 210 |
} |
211 | 211 |
|
212 | 212 |
|
213 | 213 |
function garland_diptera_get_partDefinition($nameType){ |
214 |
|
|
215 |
if($nameType == 'ZoologicalName'){
|
|
216 |
return array(
|
|
214 |
|
|
215 |
if($nameType == 'ZoologicalName'){
|
|
216 |
return array(
|
|
217 | 217 |
'namePart' => array( |
218 | 218 |
'name' => true |
219 |
),
|
|
219 |
),
|
|
220 | 220 |
'nameAuthorPart' => array( |
221 | 221 |
'name' => true, |
222 | 222 |
'authors' => true |
223 |
),
|
|
223 |
),
|
|
224 | 224 |
'referencePart' => array( |
225 | 225 |
'authors' => true, |
226 | 226 |
'microreference' => true |
227 |
),
|
|
227 |
),
|
|
228 | 228 |
'statusPart' => array( |
229 | 229 |
'status' => true, |
230 |
),
|
|
230 |
),
|
|
231 | 231 |
'descriptionPart' => array( |
232 | 232 |
'description' => true, |
233 |
),
|
|
234 |
);
|
|
235 |
}
|
|
236 |
return false;
|
|
233 |
),
|
|
234 |
);
|
|
235 |
}
|
|
236 |
return false;
|
|
237 | 237 |
} |
238 | 238 |
|
239 | 239 |
function garland_diptera_get_nameRenderTemplate($renderPath){ |
240 |
|
|
241 |
switch ($renderPath){
|
|
242 |
case 'taxon_page_title':
|
|
243 |
$template = array(
|
|
240 |
|
|
241 |
switch ($renderPath){
|
|
242 |
case 'taxon_page_title':
|
|
243 |
$template = array(
|
|
244 | 244 |
'namePart' => array('#uri'=>true), |
245 |
);
|
|
246 |
break;
|
|
247 |
case 'acceptedFor':
|
|
248 |
case 'list_of_taxa':
|
|
249 |
$template = array(
|
|
245 |
);
|
|
246 |
break;
|
|
247 |
case 'acceptedFor':
|
|
248 |
case 'list_of_taxa':
|
|
249 |
$template = array(
|
|
250 | 250 |
'namePart' => array('#uri'=>true), |
251 | 251 |
'referencePart' => array('#uri'=>true), |
252 |
);
|
|
253 |
break;
|
|
254 |
case 'typedesignations':
|
|
255 |
$template = array(
|
|
252 |
);
|
|
253 |
break;
|
|
254 |
case 'typedesignations':
|
|
255 |
$template = array(
|
|
256 | 256 |
'namePart' => array('#uri'=>true), |
257 | 257 |
'referencePart' => array('#uri'=>true) |
258 |
);
|
|
259 |
break;
|
|
260 |
case 'taxon_page_synonymy':
|
|
261 |
case 'related_taxon':
|
|
262 |
default:
|
|
263 |
$template = array(
|
|
258 |
);
|
|
259 |
break;
|
|
260 |
case 'taxon_page_synonymy':
|
|
261 |
case 'related_taxon':
|
|
262 |
case '#DEFAULT':
|
|
263 |
$template = array(
|
|
264 | 264 |
'namePart' => array('#uri'=>true), |
265 | 265 |
'referencePart' => array('#uri'=>true), |
266 | 266 |
'statusPart' => true, |
267 | 267 |
'descriptionPart' => true |
268 |
);
|
|
269 |
}
|
|
270 |
return $template;
|
|
268 |
);
|
|
269 |
}
|
|
270 |
return $template;
|
|
271 | 271 |
} |
272 | 272 |
|
Also available in: Unified diff
improved general render mechanism + footnotes