Project

General

Profile

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