Project

General

Profile

Download (20.1 KB) Statistics
| Branch: | Tag: | Revision:
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);
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
  $renderPath = 'taxon_page_title';
38
  if(isset($taxon_name->nomenclaturalReference)){
39
    $referenceUri = url(path_to_reference($taxon_name->nomenclaturalReference->uuid));
40
  }
41
  return '<span class="'.$taxon_name->class.'">'.theme('cdm_taxonName', $taxon_name, null, $referenceUri, $renderPath).'</span>';
42
}
43

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

    
57
	global $theme;
58

    
59
	$page_part = variable_get('cdm_dataportal_taxonpage_tabs', 1) ? $page_part : 'all';
60
	$hideTabs = array();
61

    
62

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

    
68

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

    
81
	if(!isset($media[0])) {
82
		$hideTabs[] = theme('cdm_taxonpage_tab', 'Images');
83
	}
84

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

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

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

    
112
  	$featureTree = cdm_ws_get(CDM_WS_FEATURETREE, variable_get('cdm_dataportal_featuretree_uuid', false));
113
  	$taxonDescriptions = cdm_ws_get(CDM_WS_PORTAL_TAXON_DESCRIPTIONS, $taxon->uuid);
114
  	$mergedTrees = cdm_ws_descriptions_by_featuretree($featureTree, $taxonDescriptions, variable_get('cdm_dataportal_descriptions_separated', FALSE));
115

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

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

    
143
  	$out .= '</div>';
144
  }
145

    
146
  return $out;
147
}
148

    
149

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

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

    
170
	// description TOC
171
	$out .= theme('cdm_featureTreeTOCs', $mergedTrees);
172
	// description
173
	$out .= theme('cdm_featureTrees', $mergedTrees, $taxon);
174
	return $out;
175
}
176

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

    
184
	RenderHints::pushToRenderStack('taxon_page_synonymy');
185
	$synomymie = cdm_ws_get(CDM_WS_PORTAL_TAXON_SYNONYMY, $taxon->uuid);
186
	$skip = array(UUID_BASIONYM);
187

    
188
	if($addAcceptedTaxon){
189
		if(isset($taxon->name->nomenclaturalReference)){
190
			$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
191
		}
192
		$out .= theme('cdm_taxonName', $taxon->name, null, $referenceUri);
193
	}
194

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

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

    
231
/**
232
 * Show the collection of images stored with the accepted taxon
233
 *
234
 */
235
function theme_cdm_taxon_page_images($taxon, $media){
236

    
237
	$hasImages = isset($media[0]);
238

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

    
264
	}
265
	return $out;
266
}
267

    
268
/**
269
 * Show a reference in it's atomized form
270
 */
271
function theme_cdm_reference_page($referenceTO){
272

    
273
	/*
274
	 if($referenceTO->titleCache) {
275
		drupal_set_title($referenceTO->titleCache);
276
		} else {
277
		drupal_set_title($referenceTO->fullCitation);
278
		}
279
		*/
280

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

    
314
		if(isset($referenceTO->$fieldname)){
315

    
316
		if($fieldname == "datePublished") {
317
		$partial = $referenceTO->$fieldname;
318
		$datePublished = '';
319
		if($partial->start){
320
		//var_dump ($partial->start);
321
		$datePublishedYear = substr($partial->start, 0, 4);
322
		$datePublishedMonth = substr($partial->start, 5, 2);
323

    
324
		if (!(preg_match('#[0-9]#',$datePublishedMonth))){
325
		$datePublishedMonth = '00';
326
		}
327

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

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

    
377
		}else{
378
		$names = $referenceTO->$fieldname-> titleCache;
379
		}
380
		$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $names);
381
		//$name = array(t(ucfirst(strtolower($fieldname))), $names);
382

    
383
		} else {
384
		$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $referenceTO->$fieldname);
385
		//$name = array(t(ucfirst(strtolower($fieldname))), $referenceTO->$fieldname);
386
		}
387
		}
388
		}
389
		*/
390

    
391
	//select the type of the reference and find the in Reference attribute
392

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

    
423
	foreach($field_order as $fieldname){
424

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

    
446
					$referenceData[$fieldname] = $datePublishedYear;
447
					break;
448

    
449
				default:
450
					if(is_object($referenceTO->$fieldname)){
451
						if ($fieldname == "authorTeam"){
452
							$dump = $referenceTO->$fieldname;
453
							$teammembers = "teamMembers";
454
							$team = $dump->$teammembers;
455
							$nameArray = array();
456

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

    
485
			}
486
		}
487
	}
488

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

    
503
}
504

    
505

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

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

    
537
	$media_metadata = cdm_read_media_metadata($media);
538
	//$title = $media->titleCache;
539
	$title = $media_metadata['title'];
540

    
541
	$imageMaxExtend = variable_get('image-page-maxextend', 400);
542

    
543
	if(!$title){
544
		$title = 'Media '.$media->uuid.'';
545
	}
546

    
547
	drupal_set_title($title);
548

    
549

    
550
	$out .= '<div class="media">';
551

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

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

    
568

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

    
577
	// representation(-part) specific metadata
578
	$thumbnailMaxExtend = 100;
579
	$out .= '<table>';
580
	//$out .= '<tr><th colspan="3">'.t('MimeType').': '.$media->representations[$representationIdx]->mimeType.'</th></tr>';
581
	$i = 0;
582
	foreach($media->representations[$representationIdx]->parts as $part){
583
		$out .= '<tr><th>'.t('Part').' '.($i + 1).'</th><td>';
584
		switch($part->class){
585
			case 'ImageFile': $out .= $part->width.' x '.$part->height.' - '.$part->size.'k'; break;
586
			case 'AudioFile':
587
			case 'MovieFile': $out .= t('Duration').': '.$part->duration.'s - '.$part->size.'k'; break;
588
			default: $out .= $part->size.'k';
589
		}
590
		$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>';
591
		$i++;
592
	}
593
	$out .= '</table>';
594
	$out .= '</div>';
595

    
596
	return $out;
597
}
598

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

    
(6-6/8)