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
|
RenderHints::popFromRenderStack();
|
26
|
return '<span class="'.$taxon->class.'">'.theme('cdm_taxonName', $taxon->name, null, $referenceUri).'</span>';
|
27
|
}
|
28
|
|
29
|
/**
|
30
|
* Default title for a name page
|
31
|
* @param $taxon_name The taxon name object
|
32
|
* @return the formatted name title
|
33
|
*/
|
34
|
function theme_cdm_name_page_title($taxon_name){
|
35
|
$renderPath = 'taxon_page_title';
|
36
|
if(isset($taxon_name->nomenclaturalReference)){
|
37
|
$referenceUri = url(path_to_reference($taxon_name->nomenclaturalReference->uuid));
|
38
|
}
|
39
|
return '<span class="'.$taxon_name->class.'">'.theme('cdm_taxonName', $taxon_name, null, $referenceUri, $renderPath).'</span>';
|
40
|
}
|
41
|
|
42
|
/**
|
43
|
* A wrapper function that groups available information to show by default, when
|
44
|
* a taxon page is requested by the browser.
|
45
|
* Individual themeing has to decide what this page should include (see methods beneath)
|
46
|
* and what information should go into tabs or should not be shown at all.
|
47
|
*
|
48
|
* It is headed by the name of the accepted taxon without author and reference.
|
49
|
* @param $taxonTO the taxon object
|
50
|
* @param $page_part name of the part to display,
|
51
|
* valid values are: 'description', 'images', 'synonymy', 'all'
|
52
|
*/
|
53
|
function theme_cdm_taxon_page_general($taxon, $page_part = 'description') {
|
54
|
|
55
|
global $theme;
|
56
|
|
57
|
$page_part = variable_get('cdm_dataportal_taxonpage_tabs', 1) ? $page_part : 'all';
|
58
|
$hideTabs = array();
|
59
|
|
60
|
|
61
|
// get images
|
62
|
$prefMimeTypeRegex = 'image:.*';
|
63
|
$prefMediaQuality = '*';
|
64
|
//$media = cdm_ws_get(CDM_WS_PORTAL_TAXONOMY_MEDIA, array(variable_get('cdm_taxonomictree_uuid', false),$taxon->uuid));
|
65
|
|
66
|
|
67
|
$selectShowMedia = variable_get('cdm_dataportal_show_media', 0);
|
68
|
if ($selectShowMedia == 0){
|
69
|
$media = cdm_ws_get(CDM_WS_PORTAL_TAXON_MEDIA, array($taxon->uuid, $prefMimeTypeRegex, $prefMediaQuality));
|
70
|
}else{
|
71
|
$media = cdm_ws_get(CDM_WS_PORTAL_TAXON_SUBTREE_MEDIA, array($taxon->uuid, $prefMimeTypeRegex, $prefMediaQuality));
|
72
|
}
|
73
|
/*
|
74
|
if(!isset($mediaList[0])) {
|
75
|
$hideTabs[] = theme('cdm_taxonpage_tab', 'Images');
|
76
|
}
|
77
|
*/
|
78
|
|
79
|
if(!isset($media[0])) {
|
80
|
$hideTabs[] = theme('cdm_taxonpage_tab', 'Images');
|
81
|
}
|
82
|
|
83
|
// hideImage flag depending on administative preset
|
84
|
$hideImages = false;
|
85
|
if(variable_get('image_hide_rank', '0') != '0'){
|
86
|
$rankCompare = rank_compare($taxon->name->rank->uuid, variable_get('image_hide_rank', '-99'));
|
87
|
$hideImages = ($rankCompare > -1);
|
88
|
}
|
89
|
// $hideTabs[] = theme('cdm_taxonpage_tab', 'General');
|
90
|
// $hideTabs[] = theme('cdm_taxonpage_tab', 'Synonymy')
|
91
|
|
92
|
// hide tabs
|
93
|
$tabhide_js = '';
|
94
|
foreach($hideTabs as $tabText) {
|
95
|
$tabhide_js .= "$('.tabs.primary').children('li').children('a:contains(\"$tabText\")').hide();\n";
|
96
|
}
|
97
|
drupal_add_js("
|
98
|
$(document).ready(function(){
|
99
|
$tabhide_js
|
100
|
});", 'inline');
|
101
|
|
102
|
$out = '';
|
103
|
$out .= theme('cdm_back_to_search_result_button');
|
104
|
if(variable_get('cdm_dataportal_display_is_accepted_for', CDM_DATAPORTAL_DISPLAY_IS_ACCEPTED_FOR)){
|
105
|
$out .= theme('cdm_acceptedFor', 'page_general');
|
106
|
}
|
107
|
// --- DESCRIPTION --- //
|
108
|
if($page_part == 'description' || $page_part == 'all'){
|
109
|
|
110
|
$featureTree = cdm_ws_get(CDM_WS_FEATURETREE, variable_get('cdm_dataportal_featuretree_uuid', false));
|
111
|
$taxonDescriptions = cdm_ws_get(CDM_WS_PORTAL_TAXON_DESCRIPTIONS, $taxon->uuid);
|
112
|
$mergedTrees = cdm_ws_descriptions_by_featuretree($featureTree, $taxonDescriptions, variable_get('cdm_dataportal_descriptions_separated', FALSE));
|
113
|
|
114
|
$out .= '<div id="general">';
|
115
|
$out .= theme('cdm_taxon_page_description', $taxon, $mergedTrees, $media, $hideImages);
|
116
|
$out .= '</div>';
|
117
|
}
|
118
|
// --- IMAGES --- //
|
119
|
if(!$hideImages && $page_part == 'images' || $page_part == 'all'){
|
120
|
$out .= '<div id="images">';
|
121
|
if($page_part == 'all'){
|
122
|
$out .= '<h2>'.t('Images').'</h2>';
|
123
|
}
|
124
|
$out .= theme('cdm_taxon_page_images', $taxon, $media);
|
125
|
$out .= '</div>';
|
126
|
|
127
|
if($theme == 'garland_cichorieae'){
|
128
|
$out .= theme('cdm_taxon_page_images_cichorieae_copyright');
|
129
|
}
|
130
|
|
131
|
}
|
132
|
// --- SYNONYMY --- //
|
133
|
if($page_part == 'synonymy' || $page_part == 'all'){
|
134
|
$out .= '<div id="synonymy">';
|
135
|
if($page_part == 'all'){
|
136
|
$out .= '<h2>'.t('Synonymy').'</h2>';
|
137
|
}
|
138
|
$addAcceptedTaxon = !variable_get('cdm_dataportal_nomref_in_title', CDM_DATAPORTAL_NOMREF_IN_TITLE);
|
139
|
$out .= theme('cdm_taxon_page_synonymy', $taxon, $addAcceptedTaxon);
|
140
|
|
141
|
if(variable_get('cdm_dataportal_display_name_relations', 1)){
|
142
|
|
143
|
$nameRelationships = cdm_ws_get(CDM_WS_PORTAL_TAXON_NAMERELATIONS, $taxon->uuid);
|
144
|
// TODO is it correct to skip relationsFromThisName since all relationships are to be understood as 'is .... of'
|
145
|
if(variable_get('cdm_dataportal_name_relations_skiptype_basionym', 1)){
|
146
|
$skip = array(UUID_BASIONYM);
|
147
|
}
|
148
|
$out .= theme('cdm_nameRelations', $nameRelationships, $skip);
|
149
|
}
|
150
|
$out .= '</div>';
|
151
|
}
|
152
|
|
153
|
return $out;
|
154
|
}
|
155
|
|
156
|
|
157
|
/**
|
158
|
* Outputs all descriptive data and shows the preferred picture of the
|
159
|
* accepted taxon.
|
160
|
*
|
161
|
*/
|
162
|
function theme_cdm_taxon_page_description($taxon, $mergedTrees, $media = null, $hideImages = false){
|
163
|
|
164
|
// if(!$hideImages){
|
165
|
// // preferred image
|
166
|
// // hardcoded for testing;
|
167
|
// $defaultRepresentationPart = false;
|
168
|
// $defaultRepresentationPart->width = 184;
|
169
|
// $defaultRepresentationPart->height = 144;
|
170
|
// $defaultRepresentationPart->uri = drupal_get_path('theme', 'palmweb_2').'/images/no_picture.png';
|
171
|
//
|
172
|
// // preferred image size 184px × 144
|
173
|
// $imageMaxExtend = 184;
|
174
|
// $out .= '<div class="preferredImage">'.$defaultRepresentationPart->uri.theme('cdm_preferredImage', $media, $defaultRepresentationPart, $imageMaxExtend).'</div>';
|
175
|
// }
|
176
|
|
177
|
// description TOC
|
178
|
$out .= theme('cdm_featureTreeTOCs', $mergedTrees);
|
179
|
// description
|
180
|
$out .= theme('cdm_featureTrees', $mergedTrees, $taxon);
|
181
|
return $out;
|
182
|
}
|
183
|
|
184
|
/**
|
185
|
* Show whole synonymy for the accepted taxon. Synonymy list is headed by the complete scientific name
|
186
|
* of the accepted taxon with nomenclatural reference.
|
187
|
*
|
188
|
*/
|
189
|
function theme_cdm_taxon_page_synonymy($taxon, $addAcceptedTaxon){
|
190
|
|
191
|
RenderHints::pushToRenderStack('taxon_page_synonymy');
|
192
|
$synomymie = cdm_ws_get(CDM_WS_PORTAL_TAXON_SYNONYMY, $taxon->uuid);
|
193
|
$taxonRelationships = cdm_ws_get(CDM_WS_PORTAL_TAXON_RELATIONS, $taxon->uuid);
|
194
|
$skip = array(UUID_BASIONYM);
|
195
|
|
196
|
if($addAcceptedTaxon){
|
197
|
if(isset($taxon->name->nomenclaturalReference)){
|
198
|
$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
|
199
|
}
|
200
|
$out .= theme('cdm_taxonName', $taxon->name, null, $referenceUri);
|
201
|
}
|
202
|
|
203
|
if($addAcceptedTaxon && !isset($synomymie->homotypicSynonymsByHomotypicGroup[0])){
|
204
|
// display the type information for the added taxon
|
205
|
$typeDesignations = cdm_ws_get(CDM_WS_PORTAL_TAXON_NAMETYPEDESIGNATIONS, $taxon->uuid);
|
206
|
if($typeDesignations){
|
207
|
$out .= theme('cdm_typedesignations', $typeDesignations);
|
208
|
//$out .= l('test', path_to_name($typeDesignations[0]->typeName->uuid), array(), NULL, NULL, FALSE, TRUE);
|
209
|
}
|
210
|
} else {
|
211
|
// reder the homotypicSynonymyGroup including the type information
|
212
|
$out .= theme('cdm_homotypicSynonymyGroup', $synomymie->homotypicSynonymsByHomotypicGroup);
|
213
|
}
|
214
|
if($synomymie->heterotypicSynonymyGroups) {
|
215
|
foreach($synomymie->heterotypicSynonymyGroups as $homotypicalGroup){
|
216
|
$out .= theme('cdm_heterotypicSynonymyGroup', $homotypicalGroup);
|
217
|
}
|
218
|
}
|
219
|
|
220
|
$out .= theme('cdm_taxonRelations', $taxonRelationships, $skip);
|
221
|
RenderHints::popFromRenderStack();
|
222
|
return $out;
|
223
|
}
|
224
|
|
225
|
/**
|
226
|
* Show the collection of images stored with the accepted taxon
|
227
|
*
|
228
|
*/
|
229
|
function theme_cdm_taxon_page_images($taxon, $media){
|
230
|
|
231
|
$hasImages = isset($media[0]);
|
232
|
|
233
|
if($hasImages){
|
234
|
//
|
235
|
$maxExtend = 150;
|
236
|
$cols = 3;
|
237
|
$maxRows = false;
|
238
|
$alternativeMediaUri = null;
|
239
|
$captionElements = array('title', 'rights', '#uri'=>t('open Image'));
|
240
|
$gallery_name = $taxon->uuid;
|
241
|
$mediaLinkType = 'LIGHTBOX';
|
242
|
|
243
|
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_MEDIA_GALLERY_NAME);
|
244
|
|
245
|
$out = '<div class="image-gallerie">';
|
246
|
$out .= theme('cdm_media_gallerie', $media,
|
247
|
$gallery_name,
|
248
|
$gallery_settings['cdm_dataportal_media_maxextend'],
|
249
|
$gallery_settings['cdm_dataportal_media_cols'],
|
250
|
$gallery_settings['cdm_dataportal_media_maxRows'],
|
251
|
$captionElements,
|
252
|
$mediaLinkType,
|
253
|
null);
|
254
|
$out .= '</div>';
|
255
|
}else{
|
256
|
$out = 'No images available.';
|
257
|
|
258
|
}
|
259
|
return $out;
|
260
|
}
|
261
|
|
262
|
/**
|
263
|
* Show a reference in it's atomized form
|
264
|
*/
|
265
|
function theme_cdm_reference_page($referenceTO){
|
266
|
|
267
|
/*
|
268
|
if($referenceTO->titleCache) {
|
269
|
drupal_set_title($referenceTO->titleCache);
|
270
|
} else {
|
271
|
drupal_set_title($referenceTO->fullCitation);
|
272
|
}
|
273
|
*/
|
274
|
|
275
|
$field_order = array(
|
276
|
"title",
|
277
|
//"titleCache",
|
278
|
//"citation",
|
279
|
"authorTeam",
|
280
|
"editor",
|
281
|
"publisher",
|
282
|
"placePublished",
|
283
|
"datePublished",
|
284
|
"year",
|
285
|
"edition", // class Book
|
286
|
"volume", // class Article
|
287
|
"seriesPart",
|
288
|
"inReference",
|
289
|
//"inJournal", // class Article
|
290
|
//"inBook", // class BookSection
|
291
|
"nomRefBase", // class BookSection, Book, Article
|
292
|
//"inProceedings", // class InProceedings
|
293
|
"pages", // class Article
|
294
|
"series", // class Article, PrintSeries
|
295
|
"school", // class Thesis
|
296
|
"institution", // class Report
|
297
|
"organization", // class Proceedings
|
298
|
"nextVersion",
|
299
|
"previousVersion",
|
300
|
"isbn", // class Book
|
301
|
"issn", // class Journal
|
302
|
"uri",
|
303
|
);
|
304
|
/*
|
305
|
$table_rows = array();
|
306
|
foreach($field_order as $fieldname){
|
307
|
|
308
|
if(isset($referenceTO->$fieldname)){
|
309
|
|
310
|
if($fieldname == "datePublished") {
|
311
|
$partial = $referenceTO->$fieldname;
|
312
|
$datePublished = '';
|
313
|
if($partial->start){
|
314
|
//var_dump ($partial->start);
|
315
|
$datePublishedYear = substr($partial->start, 0, 4);
|
316
|
$datePublishedMonth = substr($partial->start, 5, 2);
|
317
|
|
318
|
if (!(preg_match('#[0-9]#',$datePublishedMonth))){
|
319
|
$datePublishedMonth = '00';
|
320
|
}
|
321
|
|
322
|
$datePublishedDay = substr($partial->start, 7, 2);
|
323
|
if (!(preg_match('#[0-9]#',$datePublishedDay))){
|
324
|
$datePublishedDay = '00';
|
325
|
}
|
326
|
$datePublished = $datePublishedYear.'-'.$datePublishedMonth.'-'.$datePublishedDay;
|
327
|
}
|
328
|
if($partial->end){
|
329
|
$datePublished = (strlen($datePublished) > 0 ? ' '.t('to').' ' : '').substr($partial->end, 0, 4).'-'.substr($partial->end, 4, 2).'-'.substr($partial->end, 6, 2);
|
330
|
}
|
331
|
$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $datePublished);
|
332
|
//$datePublished = array(t(ucfirst(strtolower($fieldname))), $datePublished);
|
333
|
} else if(is_object($referenceTO->$fieldname)){
|
334
|
if ($fieldname == "authorTeam"){
|
335
|
$dump = $referenceTO->$fieldname;
|
336
|
$teammembers = "teamMembers";
|
337
|
$team = $dump->$teammembers;
|
338
|
$nameArray = array();
|
339
|
|
340
|
foreach($team as $member){
|
341
|
if (strlen($member->lastname)> 0){
|
342
|
$nname = $member->lastname;
|
343
|
$name = $nname;
|
344
|
if (strlen($member->firstname)> 0){
|
345
|
$vname = $member->firstname;
|
346
|
$name =$vname." ". $nname;
|
347
|
}
|
348
|
$nameArray[] =$name;
|
349
|
}else{
|
350
|
if (strlen($member->titleCache)> 0){
|
351
|
$nameArray[] = $member->titleCache;
|
352
|
}
|
353
|
}
|
354
|
}
|
355
|
$names = join($nameArray, ", ");
|
356
|
}else if ($fieldname == "inReference"){
|
357
|
$type = $referenceTO ->$fieldname-> type;
|
358
|
$names = $referenceTO-> $fieldname-> titleCache;
|
359
|
switch ($type) {
|
360
|
case "Book":
|
361
|
$fieldname = "in book";
|
362
|
break;
|
363
|
case "Journal":
|
364
|
$fieldname = "in journal";
|
365
|
break;
|
366
|
case "Proceedings":
|
367
|
$fieldname = "in proceedings";
|
368
|
break;
|
369
|
}
|
370
|
|
371
|
}else{
|
372
|
$names = $referenceTO->$fieldname-> titleCache;
|
373
|
}
|
374
|
$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $names);
|
375
|
//$name = array(t(ucfirst(strtolower($fieldname))), $names);
|
376
|
|
377
|
} else {
|
378
|
$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $referenceTO->$fieldname);
|
379
|
//$name = array(t(ucfirst(strtolower($fieldname))), $referenceTO->$fieldname);
|
380
|
}
|
381
|
}
|
382
|
}
|
383
|
*/
|
384
|
|
385
|
//select the type of the reference and find the in Reference attribute
|
386
|
|
387
|
$referenceData = array(
|
388
|
"title" => NULL,
|
389
|
//"titleCache",
|
390
|
//"citation",
|
391
|
"authorTeam" => NULL,
|
392
|
"editor" => NULL,
|
393
|
"publisher" => NULL,
|
394
|
"placePublished" => NULL,
|
395
|
"datePublished" => NULL,
|
396
|
"year" => NULL,
|
397
|
"edition" => NULL, // class Book
|
398
|
"volume" => NULL, // class Article
|
399
|
"seriesPart" => NULL,
|
400
|
"inReference" => NULL,
|
401
|
//"inJournal", // class Article
|
402
|
//"inBook", // class BookSection
|
403
|
"nomRefBase" => NULL, // class BookSection, Book, Article
|
404
|
//"inProceedings", // class InProceedings
|
405
|
"pages" => NULL, // class Article
|
406
|
"series" => NULL, // class Article, PrintSeries
|
407
|
"school" => NULL, // class Thesis
|
408
|
"institution" => NULL, // class Report
|
409
|
"organization" => NULL, // class Proceedings
|
410
|
"nextVersion" => NULL,
|
411
|
"previousVersion" => NULL,
|
412
|
"isbn" => NULL, // class Book
|
413
|
"issn" => NULL, // class Journal
|
414
|
"uri" => NULL,
|
415
|
);
|
416
|
|
417
|
foreach($field_order as $fieldname){
|
418
|
|
419
|
if(isset($referenceTO->$fieldname)){
|
420
|
switch($fieldname){
|
421
|
case "datePublished":
|
422
|
$partial = $referenceTO->$fieldname;
|
423
|
$datePublished = '';
|
424
|
if($partial->start){
|
425
|
$datePublishedYear = substr($partial->start, 0, 4);
|
426
|
$datePublishedMonth = substr($partial->start, 5, 2);
|
427
|
if (!(preg_match('#[0-9]#',$datePublishedMonth))){
|
428
|
$datePublishedMonth = '00';
|
429
|
}
|
430
|
$datePublishedDay = substr($partial->start, 7, 2);
|
431
|
if (!(preg_match('#[0-9]#',$datePublishedDay))){
|
432
|
$datePublishedDay = '00';
|
433
|
}
|
434
|
$datePublished = $datePublishedYear.'-'.$datePublishedMonth.'-'.$datePublishedDay;
|
435
|
}
|
436
|
if($partial->end){
|
437
|
$datePublished = (strlen($datePublished) > 0 ? ' '.t('to').' ' : '').substr($partial->end, 0, 4).'-'.substr($partial->end, 4, 2).'-'.substr($partial->end, 6, 2);
|
438
|
}
|
439
|
|
440
|
$referenceData[$fieldname] = $datePublishedYear;
|
441
|
break;
|
442
|
|
443
|
default:
|
444
|
if(is_object($referenceTO->$fieldname)){
|
445
|
if ($fieldname == "authorTeam"){
|
446
|
$dump = $referenceTO->$fieldname;
|
447
|
$teammembers = "teamMembers";
|
448
|
$team = $dump->$teammembers;
|
449
|
$nameArray = array();
|
450
|
|
451
|
foreach($team as $member){
|
452
|
if (strlen($member->lastname)> 0){
|
453
|
$nname = $member->lastname;
|
454
|
$name = $nname;
|
455
|
if (strlen($member->firstname)> 0){
|
456
|
$vname = $member->firstname;
|
457
|
$name =$vname." ". $nname;
|
458
|
}
|
459
|
$nameArray[] =$name;
|
460
|
}else{
|
461
|
if (strlen($member->titleCache)> 0){
|
462
|
$nameArray[] = $member->titleCache;
|
463
|
}
|
464
|
}
|
465
|
}
|
466
|
$names = join($nameArray, ", ");
|
467
|
$referenceData[$fieldname] = $names;
|
468
|
}else if ($fieldname == "inReference"){
|
469
|
$names = $referenceTO->$fieldname->titleCache;
|
470
|
$referenceData[$fieldname] = $names;
|
471
|
}else{
|
472
|
$names = $referenceTO->$fieldname->titleCache;
|
473
|
$referenceData[$fieldname] = $names;
|
474
|
}
|
475
|
}else{
|
476
|
$referenceData[$fieldname] = $referenceTO->$fieldname;
|
477
|
}
|
478
|
|
479
|
}
|
480
|
}
|
481
|
}
|
482
|
|
483
|
return "" . ((strlen($referenceData["authorTeam"])>0) ? ($referenceData["authorTeam"] . '. ') : '')
|
484
|
. ((strlen($referenceData["datePublished"])>0) ? ($referenceData["datePublished"] . '. ') : '')
|
485
|
. ((strlen($referenceData["title"])>0) ? ($referenceData["title"] . '. ') : "")
|
486
|
. ((strlen($referenceData["placePublished"])>0) ? ($referenceData["placePublished"] . '. ') : '')
|
487
|
. ((strlen($referenceData["editor"])>0) ? ($referenceData["editor"] . '. ') : '')
|
488
|
. ((strlen($referenceData["publisher"])>0) ? ($referenceData["publisher"] . '. ') : '')
|
489
|
. ((strlen($referenceData["inReference"])>0) ? ($referenceData["inReference"] . '. ') : '')
|
490
|
. ((strlen($referenceData["series"])>0) ? ($referenceData["series"] . '. ') : '')
|
491
|
. ((strlen($referenceData["volume"])>0) ? ($referenceData["volume"] . '. ') : '')
|
492
|
. ((strlen($referenceData["pages"])>0) ? ($referenceData["pages"] . '. ') : '')
|
493
|
. ((strlen($referenceData["isbn"])>0) ? ($referenceData["isbn"] . '. ') : '')
|
494
|
. ((strlen($referenceData["issn"])>0) ? ($referenceData["issn"] . '. ') : '')
|
495
|
. ((strlen($referenceData["uri"])>0) ? ($referenceData["uri"] . '. ') : '');
|
496
|
|
497
|
}
|
498
|
|
499
|
|
500
|
function theme_cdm_media_page($media, $mediarepresentation_uuid = false, $partId = false){
|
501
|
$out = '';
|
502
|
// determine which reprresentation and which part to show
|
503
|
$representationIdx = 0;
|
504
|
if($mediarepresentation_uuid){
|
505
|
$i = 0;
|
506
|
foreach($media->representations as $representation) {
|
507
|
if($representation->uuid == $mediarepresentation_uuid){
|
508
|
$representationIdx = $i;
|
509
|
}
|
510
|
$i++;
|
511
|
}
|
512
|
} else {
|
513
|
$mediarepresentation_uuid = $media->representations[0]->uuid;
|
514
|
}
|
515
|
|
516
|
$partIdx = 0;
|
517
|
if(!is_numeric($partId)){
|
518
|
// assuming it is an uuid
|
519
|
$i = 0;
|
520
|
foreach($media->representations[$representationIdx]->parts as $part) {
|
521
|
if($part->uuid == $partId){
|
522
|
$partIdx = $i;
|
523
|
}
|
524
|
$i++;
|
525
|
}
|
526
|
} else {
|
527
|
// assuming it is an index
|
528
|
$partIdx = $partId;
|
529
|
}
|
530
|
|
531
|
$media_metadata = cdm_read_media_metadata($media);
|
532
|
//$title = $media->titleCache;
|
533
|
$title = $media_metadata['title'];
|
534
|
|
535
|
$imageMaxExtend = variable_get('image-page-maxextend', 400);
|
536
|
|
537
|
if(!$title){
|
538
|
$title = 'Media### '.$media->uuid.'';
|
539
|
}
|
540
|
|
541
|
drupal_set_title($title);
|
542
|
|
543
|
|
544
|
$out .= '<div class="media">';
|
545
|
|
546
|
//$out .= '<div class="viewer">';
|
547
|
$out .= theme(cdm_back_to_image_gallery_button);
|
548
|
$out .= '<div class="viewer">';
|
549
|
//$out .= theme('cdm_media_gallerie_image', $representation->parts[$partIdx], $imageMaxExtend);
|
550
|
$out .= theme('cdm_openlayers_image', $media->representations[$representationIdx]->parts[$partIdx], $imageMaxExtend);
|
551
|
$out .= '</div>';
|
552
|
|
553
|
// general media metadata
|
554
|
//$media_metadata = cdm_ws_get(CDM_WS_MEDIA_METADATA, array($media->uuid));
|
555
|
//vardump("PRINTING MEDIA METADATA");
|
556
|
//vardump($media_metadata);
|
557
|
//vardump("PRINTING MEDIA");
|
558
|
//vardump($media);
|
559
|
$metadataToPrint = theme('cdm_media_caption', $media);
|
560
|
$out .= $metadataToPrint;
|
561
|
|
562
|
|
563
|
//tabs for the different representations
|
564
|
//ul.secondary
|
565
|
$out .= '<ul class="primary">';
|
566
|
foreach($media->representations as $representation){
|
567
|
$out .= '<li>'.l($media->representations[$representationIdx]->mimeType, path_to_media($media->uuid, $mediarepresentation_uuid, $partIdx)).'</li>';
|
568
|
}
|
569
|
$out .= '</ul>';
|
570
|
|
571
|
// representation(-part) specific metadata
|
572
|
$thumbnailMaxExtend = 100;
|
573
|
$out .= '<table>';
|
574
|
//$out .= '<tr><th colspan="3">'.t('MimeType').': '.$media->representations[$representationIdx]->mimeType.'</th></tr>';
|
575
|
$i = 0;
|
576
|
foreach($media->representations[$representationIdx]->parts as $part){
|
577
|
$out .= '<tr><th>'.t('Part').' '.($i + 1).'</th><td>';
|
578
|
switch($part->class){
|
579
|
case 'ImageFile': $out .= $part->width.' x '.$part->height.' - '.$part->size.'k'; break;
|
580
|
case 'AudioFile':
|
581
|
case 'MovieFile': $out .= t('Duration').': '.$part->duration.'s - '.$part->size.'k'; break;
|
582
|
default: $out .= $part->size.'k';
|
583
|
}
|
584
|
$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>';
|
585
|
$i++;
|
586
|
}
|
587
|
$out .= '</table>';
|
588
|
$out .= '</div>';
|
589
|
|
590
|
return $out;
|
591
|
}
|
592
|
|
593
|
/**
|
594
|
* Allows theming of the taxon page tabs
|
595
|
*
|
596
|
* @param $tabname
|
597
|
* @return unknown_type
|
598
|
*/
|
599
|
function theme_cdm_taxonpage_tab($tabname){
|
600
|
//TODO replace by using translations or theme the menue tabs itself instead?
|
601
|
switch($tabname){
|
602
|
default: return t($tabname);
|
603
|
}
|
604
|
}
|
605
|
|