1
|
<?php
|
2
|
// $Id$
|
3
|
|
4
|
/**
|
5
|
* Overrides of generic themeing functions in cdm_datportal.theme.php
|
6
|
*/
|
7
|
|
8
|
|
9
|
/**
|
10
|
* The description page is supposed to be the front page for a taxon.
|
11
|
*
|
12
|
* @param TaxonTO $taxonTO
|
13
|
* @return
|
14
|
*/
|
15
|
function garland_cichorieae_cdm_taxon_page_description($taxon, $mergedTrees, $media, $hideImages = false){
|
16
|
|
17
|
// description TOC
|
18
|
$out = theme('cdm_featureTreeTOCs', $mergedTrees);
|
19
|
|
20
|
// preferred image
|
21
|
// 2 lines hard coded for testing
|
22
|
if(!$hideImages){
|
23
|
|
24
|
//$defaultPreferredImage = drupal_get_path('theme', 'garland_cichorieae').'/images/nopic_400x300.jpg';
|
25
|
$defaultRepresentationPart = false;
|
26
|
$defaultRepresentationPart->width = 400;
|
27
|
$defaultRepresentationPart->height = 300;
|
28
|
$defaultRepresentationPart->uri = drupal_get_path('theme', 'garland_cichorieae').'/images/nopic_400x300.jpg';
|
29
|
|
30
|
$imageUriParams = '&width=400&height=300&quality=95&format=jpeg';
|
31
|
|
32
|
$imageMaxExtend = 400;
|
33
|
$out .= '<div class="preferredImage">'.theme('cdm_preferredImage', $media, $defaultRepresentationPart, $imageMaxExtend, $imageUriParams).'</div>';
|
34
|
}
|
35
|
|
36
|
// description
|
37
|
$out .= theme('cdm_featureTrees', $mergedTrees, $taxon);
|
38
|
|
39
|
return $out;
|
40
|
}
|
41
|
|
42
|
function garland_cichorieae_cdm_descriptionElementTextData($element){
|
43
|
|
44
|
$description = str_replace("\n", "<br/>", $element->multilanguageText_L10n->text);
|
45
|
$referenceCitation = '';
|
46
|
if($element->reference){
|
47
|
// disabling references for cichorieae description Elements because they all have faulty references
|
48
|
//$referenceCitation = '; '.theme('cdm_fullreference', $element->reference, TRUE);
|
49
|
}
|
50
|
return '<p class="descriptionText">' . $description . $referenceCitation.'</p>';
|
51
|
}
|
52
|
|
53
|
function garland_cichorieae_cdm_taxon_page_images($taxon, $media){
|
54
|
|
55
|
$flashLink = isset($media[0]);
|
56
|
|
57
|
if($flashLink){
|
58
|
|
59
|
$taggedName = $taxon->name->taggedName;
|
60
|
|
61
|
$nameArray = array();
|
62
|
foreach($taggedName as $taggedText){
|
63
|
if($taggedText->type == 'name'){
|
64
|
$nameArray[] = $taggedText->text;
|
65
|
}
|
66
|
}
|
67
|
|
68
|
$query = join("%5F", $nameArray) . '%20AND%20EditWP6%20AND%20jpg';
|
69
|
|
70
|
$out = '
|
71
|
|
72
|
<script type="text/javascript" src="http://media.bgbm.org/erez/js/fsiwriter.js"></script>
|
73
|
|
74
|
<script type="text/javascript">
|
75
|
<!--
|
76
|
writeFlashCode( "http://media.bgbm.org/erez/fsi/fsi.swf?&cfg=showcase_presets/showcase_info.fsi&effects=%26quality%3D95&showcase_query='.$query.'&skin=silver&showcase_labeltextheight=50&textbox_textfrom=IPTC_WP6&textbox_height=50¶m_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343&plugins=textbox,fullscreen",
|
77
|
"http://media.bgbm.org/erez/erez?src=erez-private/flashrequired.svg&tmp=Large&quality=97&width=620&height=400",
|
78
|
"width=620;height=400;bgcolor=454343;wmode=opaque");
|
79
|
// -->
|
80
|
</script>
|
81
|
<noscript>
|
82
|
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="470" height="400">
|
83
|
<param name="movie" value="http://media.bgbm.org/erez/fsi/fsi.swf?&cfg=showcase_presets/showcase_info.fsi&effects=%26quality%3D95&showcase_query='.$query.'&skin=silver&showcase_labeltextheight=50&textbox_textfrom=IPTC_WP6&textbox_height=50¶m_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343plugins=textbox,fullscreen"/>
|
84
|
<param name="bgcolor" value="454343" />
|
85
|
<param name="wmode" value="opaque" />
|
86
|
<param name="allowscriptaccess" value="always" />
|
87
|
<param name="allowfullscreen" value="true" />
|
88
|
<param name="quality" value="high" />
|
89
|
<embed src="http://media.bgbm.org/erez/fsi/fsi.swf?&cfg=showcase_presets/showcase_info.fsi&effects=%26quality%3D95&showcase_query='.$query.'&skin=silver&showcase_labeltextheight=50&textbox_textfrom=IPTC_WP6&textbox_height=50¶m_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343plugins=PrintSave,textbox,fullscreen"
|
90
|
width="620"
|
91
|
height="400"
|
92
|
bgcolor="454343"
|
93
|
wmode="opaque"
|
94
|
allowscriptaccess="always"
|
95
|
allowfullscreen="true"
|
96
|
quality="high"
|
97
|
type="application/x-shockwave-flash"
|
98
|
pluginspage="http://www.adobe.com/go/getflashplayer">
|
99
|
</embed>
|
100
|
</object>
|
101
|
|
102
|
</noscript>';
|
103
|
|
104
|
}else{
|
105
|
$out = 'No images available.';
|
106
|
|
107
|
}
|
108
|
return $out;
|
109
|
}
|
110
|
|
111
|
function garland_cichorieae_cdm_taxon_page_images_cichorieae_copyright(){
|
112
|
$out = '<div id="cichorieae-copyright">';
|
113
|
$out .= '<p>';
|
114
|
$out .= '© Images used on this website remain copyright of the individual photographer.<br> To obtain permission to use images in publications or websites please contact the network at <a href="edit-wp6-cichorieae@bgbm.org">edit-wp6-cichorieae@bgbm.org</a>. Images may be used for personal use, such as PowerPoint presentations, without permission.';
|
115
|
$out .= '</p>';
|
116
|
$out .= '</div>';
|
117
|
|
118
|
return $out;
|
119
|
}
|
120
|
|
121
|
/**
|
122
|
* @overrides theme_cdm_taggedtext2html in order to replace t.infr and t.infgen. with '[unranked]'
|
123
|
*/
|
124
|
function garland_cichorieae_cdm_taggedtext2html(array &$taggedtxt, $tag = 'span', $glue = ' ', $skiptags = array()){
|
125
|
$out = '';
|
126
|
$i = 0;
|
127
|
foreach($taggedtxt as $tt){
|
128
|
if(!in_array($tt->type, $skiptags) && strlen($tt->text) > 0){
|
129
|
$out .= (strlen($out) > 0 && ++$i < count($taggedtxt)? $glue : '').'<'.$tag.' class="'.$tt->type.'">';
|
130
|
if($tt->type == "rank" && ($tt->text == "t.infr." || $tt->text == "t.infgen.")){
|
131
|
$out .= t('[unranked]');
|
132
|
}else{
|
133
|
$out .= t($tt->text);
|
134
|
}
|
135
|
$out .= '</'.$tag.'>';
|
136
|
}
|
137
|
}
|
138
|
return $out;
|
139
|
}
|
140
|
|
141
|
function garland_cichorieae_cdm_descriptionElementArray($elementArray, $feature, $glue = '', $sortArray = false, $enclosingHtml = 'ul'){
|
142
|
$enclosingHtml = 'div';
|
143
|
$out = '<'.$enclosingHtml.' class="description" id="'.$feature->representation_L10n.'">';
|
144
|
|
145
|
if($sortArray) sort($elementArray);
|
146
|
|
147
|
$out .= join($elementArray, $glue);
|
148
|
|
149
|
$out .= '</'.$enclosingHtml.'>';
|
150
|
return $out;
|
151
|
}
|
152
|
|
153
|
|
154
|
/**
|
155
|
* all reference links switched of
|
156
|
*/
|
157
|
function garland_cichorieae_cdm_nomenclaturalReferenceSTO($referenceSTO, $doLink = FALSE, $cssClass = '', $separator = '<br />' , $enclosingTag = 'li'){
|
158
|
|
159
|
$doLink = FALSE;
|
160
|
|
161
|
if(isset($referenceSTO->microReference)){
|
162
|
// it is a ReferenceTO
|
163
|
$nomref_citation = theme('cdm_fullreference', $referenceSTO);
|
164
|
} else {
|
165
|
// it is ReferenceSTO
|
166
|
$nomref_citation = $referenceSTO->fullCitation;
|
167
|
}
|
168
|
|
169
|
$is_IN_reference = str_beginsWith($nomref_citation, 'in');
|
170
|
|
171
|
if($doLink){
|
172
|
$nomref_citation = l($nomref_citation, "/cdm_dataportal/reference/".$referenceSTO->uuid, array(), NULL, NULL, FALSE, TRUE);
|
173
|
}
|
174
|
|
175
|
if(!empty($nomref_citation)){
|
176
|
$nomref_citation = ($is_IN_reference ? ' ':', ') . $nomref_citation;
|
177
|
}
|
178
|
|
179
|
return $nomref_citation;
|
180
|
}
|
181
|
|
182
|
|
183
|
/***** GARLAND OVERRIDES ******/
|
184
|
|
185
|
/**
|
186
|
* Sets the body-tag class attribute.
|
187
|
*
|
188
|
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
|
189
|
*/
|
190
|
function phptemplate_body_class($sidebar_left, $sidebar_right) {
|
191
|
if ($sidebar_left != '' && $sidebar_right != '') {
|
192
|
$class = 'sidebars';
|
193
|
}
|
194
|
else {
|
195
|
if ($sidebar_left != '') {
|
196
|
$class = 'sidebar-left';
|
197
|
}
|
198
|
if ($sidebar_right != '') {
|
199
|
$class = 'sidebar-right';
|
200
|
}
|
201
|
}
|
202
|
|
203
|
if (isset($class)) {
|
204
|
print ' class="'. $class .'"';
|
205
|
}
|
206
|
}
|
207
|
|
208
|
/**
|
209
|
* Return a themed breadcrumb trail.
|
210
|
*
|
211
|
* @param $breadcrumb
|
212
|
* An array containing the breadcrumb links.
|
213
|
* @return a string containing the breadcrumb output.
|
214
|
*/
|
215
|
function phptemplate_breadcrumb($breadcrumb) {
|
216
|
if (!empty($breadcrumb)) {
|
217
|
return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
|
218
|
}
|
219
|
}
|
220
|
|
221
|
/**
|
222
|
* Allow themable wrapping of all comments.
|
223
|
*/
|
224
|
function phptemplate_comment_wrapper($content, $type = null) {
|
225
|
static $node_type;
|
226
|
if (isset($type)) $node_type = $type;
|
227
|
|
228
|
if (!$content || $node_type == 'forum') {
|
229
|
return '<div id="comments">'. $content . '</div>';
|
230
|
}
|
231
|
else {
|
232
|
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
|
233
|
}
|
234
|
}
|
235
|
|
236
|
/**
|
237
|
* Override or insert PHPTemplate variables into the templates.
|
238
|
*/
|
239
|
function _phptemplate_variables($hook, $vars) {
|
240
|
if ($hook == 'page') {
|
241
|
|
242
|
if ($secondary = menu_secondary_local_tasks()) {
|
243
|
$output = '<span class="clear"></span>';
|
244
|
$output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
|
245
|
$vars['tabs2'] = $output;
|
246
|
}
|
247
|
|
248
|
// Hook into color.module
|
249
|
if (module_exists('color')) {
|
250
|
_color_page_alter($vars);
|
251
|
}
|
252
|
return $vars;
|
253
|
}
|
254
|
return array();
|
255
|
}
|
256
|
|
257
|
/**
|
258
|
* Returns the rendered local tasks. The default implementation renders
|
259
|
* them as tabs.
|
260
|
*
|
261
|
* @ingroup themeable
|
262
|
*/
|
263
|
function phptemplate_menu_local_tasks() {
|
264
|
$output = '';
|
265
|
|
266
|
if ($primary = menu_primary_local_tasks()) {
|
267
|
$output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
|
268
|
}
|
269
|
|
270
|
return $output;
|
271
|
}
|
272
|
|
273
|
function garland_cichorieae_get_partDefinition($nameType){
|
274
|
if($nameType == 'BotanicalName'){
|
275
|
return array(
|
276
|
'namePart' => array(
|
277
|
'name' => true
|
278
|
),
|
279
|
'nameAuthorPart' => array(
|
280
|
'name' => true,
|
281
|
'authors' => true
|
282
|
),
|
283
|
'referencePart' => array(
|
284
|
'reference' => true,
|
285
|
'microreference' => true,
|
286
|
),
|
287
|
'statusPart' => array(
|
288
|
'status' => true,
|
289
|
),
|
290
|
'descriptionPart' => array(
|
291
|
'description' => true,
|
292
|
),
|
293
|
);
|
294
|
}
|
295
|
return false;
|
296
|
}
|
297
|
|
298
|
function garland_cichorieae_get_nameRenderTemplate($renderPath){
|
299
|
|
300
|
switch($renderPath) {
|
301
|
case 'taxon_page_title':
|
302
|
$template = array(
|
303
|
'namePart' => array('#uri'=>true)
|
304
|
);
|
305
|
break;
|
306
|
case 'taxon_page_synonymy':
|
307
|
case 'related_taxon':
|
308
|
$template = array(
|
309
|
'nameAuthorPart' => array('#uri'=>true),
|
310
|
'referencePart' => true,
|
311
|
'statusPart' => true,
|
312
|
'descriptionPart' => true
|
313
|
);
|
314
|
break;
|
315
|
case 'acceptedFor':
|
316
|
$template = array(
|
317
|
'nameAuthorPart' => array('#uri'=>true),
|
318
|
'referencePart' => true
|
319
|
);
|
320
|
break;
|
321
|
case 'typedesignations':
|
322
|
case 'list_of_taxa':
|
323
|
case '#DEFAULT':
|
324
|
$template = array(
|
325
|
'nameAuthorPart' => array('#uri'=>true),
|
326
|
'referencePart' => true
|
327
|
);
|
328
|
}
|
329
|
return $template;
|
330
|
}
|
331
|
|
332
|
/**
|
333
|
*/
|
334
|
function garland_cichorieae_cdm_taxon_list_thumbnails($taxon){
|
335
|
|
336
|
$gallery_name = $taxon->uuid;
|
337
|
|
338
|
$showCaption = variable_get('cdm_dataportal_findtaxa_show_thumbnail_captions', 0);
|
339
|
$prefMimeTypeRegex = 'image:.*';
|
340
|
$prefMediaQuality = '*';
|
341
|
$cols = variable_get('cdm_dataportal_findtaxa_media_cols', 3);
|
342
|
$maxRows = variable_get('cdm_dataportal_findtaxa_media_maxRows', 1);
|
343
|
$maxExtend = variable_get('cdm_dataportal_findtaxa_media_maxextend', 120);
|
344
|
|
345
|
if($showCaption){
|
346
|
$captionElements = array('title', '#uri'=>t('open Image'));
|
347
|
}
|
348
|
|
349
|
$galleryLinkUri = path_to_taxon($taxon->uuid).'/images';
|
350
|
$mediaList = cdm_ws_get(CDM_WS_PORTAL_TAXON_MEDIA, array($taxon->uuid, $prefMimeTypeRegex, $prefMediaQuality));
|
351
|
$out .= theme('cdm_media_gallerie', $mediaList, $gallery_name ,$maxExtend, $cols, $maxRows, $captionElements, 'NORMAL', $galleryLinkUri, null);
|
352
|
|
353
|
return $out;
|
354
|
}
|
355
|
|