Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

cdm-dataportal / modules / cdm_dataportal / theme / cdm_dataportal.page.theme @ b5e773ef

History | View | Annotate | Download (20.2 KB)

1
<?php
2
// $Id$
3

    
4
/**
5
* Copyright (C) 2007 EDIT
6
* European Distributed Institute of Taxonomy 
7
* http://www.e-taxonomy.eu
8
* 
9
* The contents of this file are subject to the Mozilla Public License Version 1.1
10
* See http://www.mozilla.org/MPL/MPL-1.1.html for the full license terms.
11
*/
12

    
13
/**
14
 * default title for a taxon page
15
 *
16
 * @param NameTO $nameTO
17
 * @return the formatted taxon name
18
 */
19
function theme_cdm_taxon_page_title($taxon){
20
    
21
	RenderHints::pushToRenderStack('taxon_page_title');
22
	if(isset($taxon->name->nomenclaturalReference)){
23
		$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
24
	}
25
	$out = theme('cdm_taxonName', $taxon->name, null, $referenceUri, false);
26
	RenderHints::popFromRenderStack();
27

    
28
	return '<span class="'.$taxon->class.'">'.$out.'</span>';
29
}
30

    
31
/**
32
 * Default title for a name page
33
 * @param $taxon_name The taxon name object
34
 * @return the formatted name title
35
 */
36
function theme_cdm_name_page_title($taxon_name){
37
  RenderHints::pushToRenderStack('taxon_page_title');
38
  if(isset($taxon_name->nomenclaturalReference)){
39
    $referenceUri = url(path_to_reference($taxon_name->nomenclaturalReference->uuid));
40
  }
41
  
42
  $out = '<span class="'.$taxon_name->class.'">'.theme('cdm_taxonName', $taxon_name, null, $referenceUri, false).'</span>';
43
  RenderHints::popFromRenderStack();
44
  return $out;
45
}
46

    
47
/**
48
 * A wrapper function that groups available information to show by default, when
49
 * a taxon page is requested by the browser.
50
 * Individual themeing has to decide what this page should include (see methods beneath)
51
 * and what information should go into tabs or should not be shown at all.
52
 *
53
 * It is headed by the name of the accepted taxon without author and reference.
54
 * @param $taxonTO the taxon object
55
 * @param $page_part name of the part to display,
56
 *         valid values are: 'description', 'images', 'synonymy', 'all'
57
 */
58
function theme_cdm_taxon_page_general($taxon, $page_part = 'description') {
59

    
60
	global $theme;
61

    
62
	$page_part = variable_get('cdm_dataportal_taxonpage_tabs', 1) ? $page_part : 'all';
63
	$hideTabs = array();
64

    
65

    
66
	// get images
67
	$prefMimeTypeRegex = 'image:.*';
68
	$prefMediaQuality = '*';
69
	//$media =  cdm_ws_get(CDM_WS_PORTAL_TAXONOMY_MEDIA, array(variable_get('cdm_taxonomictree_uuid', false),$taxon->uuid));
70

    
71

    
72
	$selectShowMedia = variable_get('cdm_dataportal_show_media', 0);
73
	if ($selectShowMedia == 0){
74
		$media = cdm_ws_get(CDM_WS_PORTAL_TAXON_MEDIA, array($taxon->uuid, $prefMimeTypeRegex, $prefMediaQuality));
75
	}else{
76
		$media = cdm_ws_get(CDM_WS_PORTAL_TAXON_SUBTREE_MEDIA, array($taxon->uuid, $prefMimeTypeRegex, $prefMediaQuality));
77
	}
78
/*
79
 if(!isset($mediaList[0])) {
80
    $hideTabs[] = theme('cdm_taxonpage_tab', 'Images');
81
  }
82
*/
83

    
84
	if(!isset($media[0])) {
85
		$hideTabs[] = theme('cdm_taxonpage_tab', 'Images');
86
	}
87

    
88
	// hideImage flag depending on administative preset
89
	$hideImages = false;
90
	if(variable_get('image_hide_rank', '0') != '0'){
91
		$rankCompare = rank_compare($taxon->name->rank->uuid, variable_get('image_hide_rank', '-99'));
92
		$hideImages =  ($rankCompare > -1);
93
	}
94
	// $hideTabs[] = theme('cdm_taxonpage_tab', 'General');
95
	// $hideTabs[] = theme('cdm_taxonpage_tab', 'Synonymy')
96

    
97
	// hide tabs
98
	$tabhide_js = '';
99
	foreach($hideTabs as $tabText) {
100
		$tabhide_js .= "$('.tabs.primary').children('li').children('a:contains(\"$tabText\")').hide();\n";
101
	}
102
	drupal_add_js("
103
  $(document).ready(function(){
104
  $tabhide_js
105
    });", 'inline');
106

    
107
  $out = '';
108
  $out .= theme('cdm_back_to_search_result_button');
109
  if(variable_get('cdm_dataportal_display_is_accepted_for', CDM_DATAPORTAL_DISPLAY_IS_ACCEPTED_FOR)){
110
  $out .= theme('cdm_acceptedFor', 'page_general');
111
  }
112
  // --- DESCRIPTION --- //
113
  if($page_part == 'description' || $page_part == 'all'){
114

    
115
  	$featureTree = cdm_ws_get(CDM_WS_FEATURETREE, variable_get(CDM_DATAPORTAL_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE));
116
  	$taxonDescriptions = cdm_ws_get(CDM_WS_PORTAL_TAXON_DESCRIPTIONS, $taxon->uuid);
117
  	$mergedTrees = cdm_ws_descriptions_by_featuretree($featureTree, $taxonDescriptions, variable_get('cdm_dataportal_descriptions_separated', FALSE));
118

    
119
  	$out .= '<div id="general">';
120
  	$out .= theme('cdm_taxon_page_description', $taxon, $mergedTrees, $media, $hideImages);
121
  	$out .= '</div>';
122
  }
123
  // --- IMAGES --- //
124
  if(!$hideImages && $page_part == 'images' || $page_part == 'all'){
125
  	$out .= '<div id="images">';
126
  	if($page_part == 'all'){
127
  		$out .= '<h2>'.t('Images').'</h2>';
128
  	}
129
  	$out .= theme('cdm_taxon_page_images', $taxon, $media);
130
  	$out .= '</div>';
131

    
132
  	if($theme == 'garland_cichorieae'){
133
  		$out .= theme('cdm_taxon_page_images_cichorieae_copyright');
134
  	}
135
  	 
136
  }
137
  // --- SYNONYMY --- //
138
  if($page_part == 'synonymy' || $page_part == 'all'){
139
  	$out .= '<div id="synonymy">';
140
  	if($page_part == 'all'){
141
  		$out .= '<h2>'.t('Synonymy').'</h2>';
142
  	}
143
  	$addAcceptedTaxon = !variable_get('cdm_dataportal_nomref_in_title', CDM_DATAPORTAL_NOMREF_IN_TITLE);
144
  	$out .= theme('cdm_taxon_page_synonymy', $taxon, $addAcceptedTaxon);
145

    
146
  	$out .= '</div>';
147
  }
148

    
149
  return $out;
150
}
151

    
152

    
153
/**
154
 * Outputs all descriptive data and shows the preferred picture of the
155
 * accepted taxon.
156
 *
157
 */
158
function theme_cdm_taxon_page_description($taxon, $mergedTrees, $media = null, $hideImages = false){
159

    
160
	//  if(!$hideImages){
161
	//    // preferred image
162
	//    // hardcoded for testing;
163
	//    $defaultRepresentationPart = false;
164
	//    $defaultRepresentationPart->width = 184;
165
	//    $defaultRepresentationPart->height = 144;
166
	//    $defaultRepresentationPart->uri = drupal_get_path('theme', 'palmweb_2').'/images/no_picture.png';
167
	//
168
	//    // preferred image size 184px × 144
169
	//    $imageMaxExtend = 184;
170
	//    $out .= '<div class="preferredImage">'.$defaultRepresentationPart->uri.theme('cdm_preferredImage', $media, $defaultRepresentationPart, $imageMaxExtend).'</div>';
171
	//  }
172

    
173
	// description TOC
174
	$out .= theme('cdm_featureTreeTOCs', $mergedTrees);
175
	// description
176
	$out .= theme('cdm_featureTrees', $mergedTrees, $taxon);
177
	return $out;
178
}
179

    
180
/**
181
 * Show whole synonymy for the accepted taxon. Synonymy list is headed by the complete scientific name
182
 * of the accepted taxon with nomenclatural reference.
183
 *
184
 */
185
function theme_cdm_taxon_page_synonymy($taxon, $addAcceptedTaxon){
186

    
187
	RenderHints::pushToRenderStack('taxon_page_synonymy');
188
	$synomymie = cdm_ws_get(CDM_WS_PORTAL_TAXON_SYNONYMY, $taxon->uuid);
189
	$skip = array(UUID_BASIONYM);
190

    
191
	if($addAcceptedTaxon){
192
		if(isset($taxon->name->nomenclaturalReference)){
193
			$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
194
		}
195
		$out .= theme('cdm_taxonName', $taxon->name, null, $referenceUri);
196
		$out .= theme('cdm_annotations_as_footnotekeys', $taxon);
197
	}
198

    
199
	if($addAcceptedTaxon && !isset($synomymie->homotypicSynonymsByHomotypicGroup[0])){
200
		// display the type information for the added taxon
201
		$typeDesignations = cdm_ws_get(CDM_WS_PORTAL_TAXON_NAMETYPEDESIGNATIONS, $taxon->uuid);
202
		if($typeDesignations){
203
			$out .= theme('cdm_typedesignations', $typeDesignations);
204
		}
205
	} else {
206
		// reder the homotypicSynonymyGroup including the type information
207
		$out .= theme('cdm_homotypicSynonymyGroup', $synomymie->homotypicSynonymsByHomotypicGroup);
208
	}
209
	
210
	if($synomymie->heterotypicSynonymyGroups) {
211
		foreach($synomymie->heterotypicSynonymyGroups as $homotypicalGroup){
212
			$out .= theme('cdm_heterotypicSynonymyGroup', $homotypicalGroup);
213
		}
214
	}
215
	
216
    if(variable_get(CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS_DEFAULT)){
217

    
218
        $nameRelationships = cdm_ws_get(CDM_WS_PORTAL_TAXON_NAMERELATIONS, $taxon->uuid);
219
        // TODO is it correct to skip relationsFromThisName since all relationships are to be understood as 'is .... of'
220
        if(variable_get('cdm_dataportal_name_relations_skiptype_basionym', 1)){
221
            $skip = array(UUID_BASIONYM);
222
        }
223
        $out .= theme('nameRelationships', $nameRelationships, $skip);
224
    }
225
    
226
   if(variable_get(CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT)){
227
   	    $taxonRelationships = cdm_ws_get(CDM_WS_PORTAL_TAXON_RELATIONS, $taxon->uuid);
228
        $out .= theme('cdm_taxonRelationships', $taxonRelationships);
229
    }
230
	
231
    RenderHints::popFromRenderStack();
232
	return $out;
233
}
234

    
235
/**
236
 * Show the collection of images stored with the accepted taxon
237
 *
238
 */
239
function theme_cdm_taxon_page_images($taxon, $media){
240

    
241
	$hasImages = isset($media[0]);
242

    
243
	if($hasImages){
244
		//
245
		$maxExtend = 150;
246
		$cols = 3;
247
		$maxRows = false;
248
		$alternativeMediaUri = null;
249
		$captionElements = array('title', 'rights', '#uri'=>t('open Image'));
250
		$gallery_name = $taxon->uuid;
251
		$mediaLinkType = 'LIGHTBOX';
252
		
253
		$gallery_settings = getGallerySettings(CDM_DATAPORTAL_MEDIA_GALLERY_NAME);
254
	
255
		$out = '<div class="image-gallerie">';
256
		$out .= theme('cdm_media_gallerie', $media, 
257
					$gallery_name, 
258
					$gallery_settings['cdm_dataportal_media_maxextend'], 
259
	             	$gallery_settings['cdm_dataportal_media_cols'], 
260
	             	0, // ignore maxrows settings 
261
	             	$captionElements, 
262
	             	$mediaLinkType, 
263
	             	null);
264
		$out .= '</div>';
265
	}else{
266
		$out = 'No images available.';
267

    
268
	}
269
	return $out;
270
}
271

    
272
/**
273
 * Show a reference in it's atomized form
274
 */
275
function theme_cdm_reference_page($referenceTO){
276

    
277
	/*
278
	 if($referenceTO->titleCache) {
279
		drupal_set_title($referenceTO->titleCache);
280
		} else {
281
		drupal_set_title($referenceTO->fullCitation);
282
		}
283
		*/
284

    
285
	$field_order = array(
286
    "title",
287
	//"titleCache",
288
	//"citation",
289
    "authorTeam",
290
    "editor",
291
    "publisher",
292
    "placePublished",
293
    "datePublished",
294
    "year",
295
    "edition",      // class Book
296
    "volume",       // class Article
297
    "seriesPart",
298
    "inReference",
299
	//"inJournal",     // class Article
300
	//"inBook",        // class BookSection
301
    "nomRefBase",    // class BookSection, Book, Article
302
	//"inProceedings", // class InProceedings
303
    "pages",         // class Article
304
    "series",        // class Article, PrintSeries
305
    "school",        // class Thesis
306
    "institution",   // class Report
307
    "organization",  // class Proceedings
308
    "nextVersion",
309
    "previousVersion",
310
    "isbn",         // class Book
311
    "issn",         // class Journal
312
    "uri",
313
	);
314
	/*
315
	 $table_rows = array();
316
	 foreach($field_order as $fieldname){
317

    
318
		if(isset($referenceTO->$fieldname)){
319

    
320
		if($fieldname == "datePublished") {
321
		$partial = $referenceTO->$fieldname;
322
		$datePublished = '';
323
		if($partial->start){
324
		//var_dump ($partial->start);
325
		$datePublishedYear = substr($partial->start, 0, 4);
326
		$datePublishedMonth = substr($partial->start, 5, 2);
327

    
328
		if (!(preg_match('#[0-9]#',$datePublishedMonth))){
329
		$datePublishedMonth = '00';
330
		}
331

    
332
		$datePublishedDay = substr($partial->start, 7, 2);
333
		if (!(preg_match('#[0-9]#',$datePublishedDay))){
334
		$datePublishedDay = '00';
335
		}
336
		$datePublished = $datePublishedYear.'-'.$datePublishedMonth.'-'.$datePublishedDay;
337
		}
338
		if($partial->end){
339
		$datePublished = (strlen($datePublished) > 0 ? ' '.t('to').' ' : '').substr($partial->end, 0, 4).'-'.substr($partial->end, 4, 2).'-'.substr($partial->end, 6, 2);
340
		}
341
		$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $datePublished);
342
		//$datePublished = array(t(ucfirst(strtolower($fieldname))), $datePublished);
343
		} else if(is_object($referenceTO->$fieldname)){
344
		if ($fieldname == "authorTeam"){
345
		$dump = $referenceTO->$fieldname;
346
		$teammembers = "teamMembers";
347
		$team = $dump->$teammembers;
348
		$nameArray = array();
349

    
350
		foreach($team as $member){
351
		if (strlen($member->lastname)> 0){
352
		$nname = $member->lastname;
353
		$name = $nname;
354
		if (strlen($member->firstname)> 0){
355
		$vname = $member->firstname;
356
		$name =$vname." ". $nname;
357
		}
358
		$nameArray[] =$name;
359
		}else{
360
		if (strlen($member->titleCache)> 0){
361
		$nameArray[] = $member->titleCache;
362
		}
363
		}
364
		}
365
		$names = join($nameArray, ", ");
366
		}else if ($fieldname == "inReference"){
367
		$type = $referenceTO ->$fieldname-> type;
368
		$names = $referenceTO-> $fieldname-> titleCache;
369
		switch ($type) {
370
		case "Book":
371
		$fieldname = "in book";
372
		break;
373
		case "Journal":
374
		$fieldname = "in journal";
375
		break;
376
		case "Proceedings":
377
		$fieldname = "in proceedings";
378
		break;
379
		}
380

    
381
		}else{
382
		$names = $referenceTO->$fieldname-> titleCache;
383
		}
384
		$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $names);
385
		//$name = array(t(ucfirst(strtolower($fieldname))), $names);
386

    
387
		} else {
388
		$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $referenceTO->$fieldname);
389
		//$name = array(t(ucfirst(strtolower($fieldname))), $referenceTO->$fieldname);
390
		}
391
		}
392
		}
393
		*/
394

    
395
	//select the type of the reference and find the in Reference attribute
396

    
397
	$referenceData = array(
398
    "title" => NULL,
399
	//"titleCache",
400
	//"citation",
401
    "authorTeam" => NULL,
402
    "editor" => NULL,
403
    "publisher" => NULL,
404
    "placePublished" => NULL,
405
    "datePublished" => NULL,
406
    "year" => NULL,
407
    "edition" => NULL,      // class Book
408
    "volume" => NULL,       // class Article
409
    "seriesPart" => NULL,
410
    "inReference" => NULL,
411
	//"inJournal",     // class Article
412
	//"inBook",        // class BookSection
413
    "nomRefBase" => NULL,    // class BookSection, Book, Article
414
	//"inProceedings", // class InProceedings
415
    "pages" => NULL,         // class Article
416
    "series" => NULL,        // class Article, PrintSeries
417
    "school" => NULL,        // class Thesis
418
    "institution" => NULL,   // class Report
419
    "organization" => NULL,  // class Proceedings
420
    "nextVersion" => NULL,
421
    "previousVersion" => NULL,
422
    "isbn" => NULL,         // class Book
423
    "issn" => NULL,         // class Journal
424
    "uri" => NULL,
425
	);
426

    
427
	foreach($field_order as $fieldname){
428

    
429
		if(isset($referenceTO->$fieldname)){
430
			switch($fieldname){
431
				case "datePublished":
432
					$partial = $referenceTO->$fieldname;
433
					$datePublished = '';
434
					if($partial->start){
435
						$datePublishedYear = substr($partial->start, 0, 4);
436
						$datePublishedMonth = substr($partial->start, 5, 2);
437
						if (!(preg_match('#[0-9]#',$datePublishedMonth))){
438
							$datePublishedMonth = '00';
439
						}
440
						$datePublishedDay = substr($partial->start, 7, 2);
441
						if (!(preg_match('#[0-9]#',$datePublishedDay))){
442
							$datePublishedDay = '00';
443
						}
444
						$datePublished = $datePublishedYear.'-'.$datePublishedMonth.'-'.$datePublishedDay;
445
					}
446
					if($partial->end){
447
						$datePublished = (strlen($datePublished) > 0 ? ' '.t('to').' ' : '').substr($partial->end, 0, 4).'-'.substr($partial->end, 4, 2).'-'.substr($partial->end, 6, 2);
448
					}
449

    
450
					$referenceData[$fieldname] = $datePublishedYear;
451
					break;
452

    
453
				default:
454
					if(is_object($referenceTO->$fieldname)){
455
						if ($fieldname == "authorTeam"){
456
							$dump = $referenceTO->$fieldname;
457
							$teammembers = "teamMembers";
458
							$team = $dump->$teammembers;
459
							$nameArray = array();
460

    
461
							foreach($team as $member){
462
								if (strlen($member->lastname)> 0){
463
									$nname = $member->lastname;
464
									$name = $nname;
465
									if (strlen($member->firstname)> 0){
466
										$vname = $member->firstname;
467
										$name =$vname." ". $nname;
468
									}
469
									$nameArray[] =$name;
470
								}else{
471
									if (strlen($member->titleCache)> 0){
472
										$nameArray[] = $member->titleCache;
473
									}
474
								}
475
							}
476
							$names = join($nameArray, ", ");
477
							$referenceData[$fieldname] = $names;
478
						}else if ($fieldname == "inReference"){
479
							$names = $referenceTO->$fieldname->titleCache;
480
							$referenceData[$fieldname] = $names;
481
						}else{
482
							$names = $referenceTO->$fieldname->titleCache;
483
							$referenceData[$fieldname] = $names;
484
						}
485
					}else{
486
						$referenceData[$fieldname] = $referenceTO->$fieldname;
487
					}
488

    
489
			}
490
		}
491
	}
492

    
493
	return "" . ((strlen($referenceData["authorTeam"])>0) ? ($referenceData["authorTeam"] . '. ') : '')
494
	. ((strlen($referenceData["datePublished"])>0) ? ($referenceData["datePublished"] . '. ') : '')
495
	. ((strlen($referenceData["title"])>0) ? ($referenceData["title"] . '. ') : "")
496
	. ((strlen($referenceData["placePublished"])>0) ? ($referenceData["placePublished"] . '. ') : '')
497
	. ((strlen($referenceData["editor"])>0) ? ($referenceData["editor"] . '. ') : '')
498
	. ((strlen($referenceData["publisher"])>0) ? ($referenceData["publisher"] . '. ') : '')
499
	. ((strlen($referenceData["inReference"])>0) ? ($referenceData["inReference"] . '. ') : '')
500
	. ((strlen($referenceData["series"])>0) ? ($referenceData["series"] . '. ') : '')
501
	. ((strlen($referenceData["volume"])>0) ? ($referenceData["volume"] . '. ') : '')
502
	. ((strlen($referenceData["pages"])>0) ? ($referenceData["pages"] . '. ') : '')
503
	. ((strlen($referenceData["isbn"])>0) ? ($referenceData["isbn"] . '. ') : '')
504
	. ((strlen($referenceData["issn"])>0) ? ($referenceData["issn"] . '. ') : '')
505
	. ((strlen($referenceData["uri"])>0) ? ($referenceData["uri"] . '. ') : '');
506

    
507
}
508

    
509

    
510
function theme_cdm_media_page($media, $mediarepresentation_uuid = false, $partId = false){
511
	$out = '';
512
	// determine which reprresentation and which part to show
513
	$representationIdx = 0;
514
	if($mediarepresentation_uuid){
515
		$i = 0;
516
		foreach($media->representations as $representation) {
517
			if($representation->uuid == $mediarepresentation_uuid){
518
				$representationIdx = $i;
519
			}
520
			$i++;
521
		}
522
	} else {
523
		$mediarepresentation_uuid = $media->representations[0]->uuid;
524
	}
525

    
526
	$partIdx  = 0;
527
	if(!is_numeric($partId)){
528
		// assuming it is an uuid
529
		$i = 0;
530
		foreach($media->representations[$representationIdx]->parts as $part) {
531
			if($part->uuid == $partId){
532
				$partIdx = $i;
533
			}
534
			$i++;
535
		}
536
	} else {
537
		// assuming it is an index
538
		$partIdx = $partId;
539
	}
540

    
541
	$media_metadata = cdm_read_media_metadata($media);
542
	//$title = $media->titleCache;
543
	$title = $media_metadata['title'];
544

    
545
	$imageMaxExtend = variable_get('image-page-maxextend', 400);
546

    
547
	if(!$title){
548
		$title = 'Media '.$media->uuid.'';
549
	}
550

    
551
	drupal_set_title($title);
552

    
553

    
554
	$out .= '<div class="media">';
555

    
556
	//$out .= '<div class="viewer">';
557
	$out .= theme(cdm_back_to_image_gallery_button);
558
	$out .= '<div class="viewer">';
559
	//$out .= theme('cdm_media_gallerie_image', $representation->parts[$partIdx], $imageMaxExtend);
560
	$out .= theme('cdm_openlayers_image', $media->representations[$representationIdx]->parts[$partIdx], $imageMaxExtend);
561
	$out .= '</div>';
562

    
563
	// general media metadata
564
	//$media_metadata = cdm_ws_get(CDM_WS_MEDIA_METADATA, array($media->uuid));
565
	//vardump("PRINTING MEDIA METADATA");
566
	//vardump($media_metadata);
567
	//vardump("PRINTING MEDIA");
568
	//vardump($media);
569
	$metadataToPrint = theme('cdm_media_caption', $media);
570
	$out .= $metadataToPrint;
571

    
572

    
573
	//tabs for the different representations
574
	//ul.secondary
575
	$out .= '<ul class="primary">';
576
	foreach($media->representations as $representation){
577
		$out .= '<li>'.l($media->representations[$representationIdx]->mimeType, path_to_media($media->uuid, $mediarepresentation_uuid, $partIdx)).'</li>';
578
	}
579
	$out .= '</ul>';
580

    
581
	// representation(-part) specific metadata
582
	$thumbnailMaxExtend = 100;
583
	$out .= '<table>';
584
	//$out .= '<tr><th colspan="3">'.t('MimeType').': '.$media->representations[$representationIdx]->mimeType.'</th></tr>';
585
	$i = 0;
586
	foreach($media->representations[$representationIdx]->parts as $part){
587
		$out .= '<tr><th>'.t('Part').' '.($i + 1).'</th><td>';
588
		switch($part->class){
589
			case 'ImageFile': $out .= $part->width.' x '.$part->height.' - '.$part->size.'k'; break;
590
			case 'AudioFile':
591
			case 'MovieFile': $out .= t('Duration').': '.$part->duration.'s - '.$part->size.'k'; break;
592
			default: $out .= $part->size.'k';
593
		}
594
		$out .= '</td><td><a href="'.url(path_to_media($media->uuid, $mediarepresentation_uuid, $i)).'">'.theme('cdm_media_gallerie_image', $part, $thumbnailMaxExtend, true);'</a></td><tr>';
595
		$i++;
596
	}
597
	$out .= '</table>';
598
	$out .= '</div>';
599

    
600
	return $out;
601
}
602

    
603
/**
604
 * Allows theming of the taxon page tabs
605
 *
606
 * @param $tabname
607
 * @return unknown_type
608
 */
609
function theme_cdm_taxonpage_tab($tabname){
610
	//TODO replace by using translations or theme the menue tabs itself instead?
611
	switch($tabname){
612
		default: return t($tabname);
613
	}
614
}
615

    
Add picture from clipboard (Maximum size: 40 MB)