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
|
|
113
|
// --- DESCRIPTION --- //
|
114
|
if($page_part == 'description' || $page_part == 'all'){
|
115
|
|
116
|
$featureTree = cdm_ws_get(CDM_WS_FEATURETREE, variable_get(CDM_DATAPORTAL_DEFAULT_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE));
|
117
|
$taxonDescriptions = cdm_ws_get(CDM_WS_PORTAL_TAXON_DESCRIPTIONS, $taxon->uuid); //con el taxon puedo coger las descripciones!!!!!
|
118
|
$mergedTrees = cdm_ws_descriptions_by_featuretree($featureTree, $taxonDescriptions, variable_get('cdm_dataportal_descriptions_separated', FALSE));
|
119
|
|
120
|
$out .= '<div id="general">';
|
121
|
$out .= theme('cdm_taxon_page_description', $taxon, $mergedTrees, $media, $hideImages);
|
122
|
$out .= '</div>';
|
123
|
}
|
124
|
|
125
|
// --- IMAGES --- //
|
126
|
if(!$hideImages && $page_part == 'images' || $page_part == 'all'){
|
127
|
$out .= '<div id="images">';
|
128
|
if($page_part == 'all'){
|
129
|
$out .= '<h2>'.t('Images').'</h2>';
|
130
|
}
|
131
|
$out .= theme('cdm_taxon_page_images', $taxon, $media);
|
132
|
$out .= '</div>';
|
133
|
|
134
|
if($theme == 'garland_cichorieae'){
|
135
|
$out .= theme('cdm_taxon_page_images_cichorieae_copyright');
|
136
|
}
|
137
|
}
|
138
|
|
139
|
// --- SYNONYMY --- //
|
140
|
if($page_part == 'synonymy' || $page_part == 'all'){
|
141
|
$out .= '<div id="synonymy">';
|
142
|
if($page_part == 'all'){
|
143
|
$out .= '<h2>'.t('Synonymy').'</h2>';
|
144
|
}
|
145
|
$addAcceptedTaxon = !variable_get('cdm_dataportal_nomref_in_title', CDM_DATAPORTAL_NOMREF_IN_TITLE);
|
146
|
$out .= theme('cdm_taxon_page_synonymy', $taxon, $addAcceptedTaxon);
|
147
|
|
148
|
$out .= '</div>';
|
149
|
}
|
150
|
|
151
|
// --- SPECIMENS --- //
|
152
|
if($page_part == 'specimens' || $page_part == 'all'){
|
153
|
$out .= '<div id="specimens">';
|
154
|
if($page_part == 'all'){
|
155
|
$out .= '<h2>'.t('Specimens').'</h2>';
|
156
|
}
|
157
|
$out .= theme('cdm_taxon_page_specimens', $taxon);
|
158
|
$out .= '</div>';
|
159
|
}
|
160
|
return $out;
|
161
|
}
|
162
|
|
163
|
|
164
|
/**
|
165
|
* Outputs all descriptive data and shows the preferred picture of the
|
166
|
* accepted taxon.
|
167
|
*
|
168
|
*/
|
169
|
function theme_cdm_taxon_page_description($taxon, $mergedTrees, $media = null, $hideImages = false){
|
170
|
|
171
|
if( variable_get('cdm_dataportal_show_default_image', false) && !$hideImages){
|
172
|
// preferred image
|
173
|
// hardcoded for testing;
|
174
|
$defaultRepresentationPart = false;
|
175
|
$defaultRepresentationPart->width = 184;
|
176
|
$defaultRepresentationPart->height = 144;
|
177
|
$defaultRepresentationPart->uri = drupal_get_path('theme', 'palmweb_2').'/images/no_picture.png';
|
178
|
|
179
|
// preferred image size 184px × 144
|
180
|
$imageMaxExtend = 184;
|
181
|
$out .= '<div class="preferredImage">'.$defaultRepresentationPart->uri.theme('cdm_preferredImage', $media, $defaultRepresentationPart, $imageMaxExtend).'</div>';
|
182
|
}
|
183
|
// description TOC
|
184
|
$out .= theme('cdm_featureTreeTOCs', $mergedTrees);
|
185
|
// description
|
186
|
$out .= theme('cdm_featureTrees', $mergedTrees, $taxon);
|
187
|
return $out;
|
188
|
}
|
189
|
|
190
|
|
191
|
function theme_cdm_taxon_page_specimens($taxon){
|
192
|
|
193
|
RenderHints::pushToRenderStack('taxon_page_specimens');
|
194
|
|
195
|
/*
|
196
|
$header = array( 'title 1', 'title 2', 'title 3' );
|
197
|
$rows = array(
|
198
|
// Simple row array
|
199
|
array( 'Cell 1', 'Cell 2', 'Cell 3' ),
|
200
|
// Row with attributes on the row and some of its cells.
|
201
|
array( 'data' => array('Cell 1', array('data' => 'Cell 2', 'colspan' => 2)), 'class' => 'funky' ) );
|
202
|
//theme_table($header, $rows, $attributes = array(), $caption = NULL);
|
203
|
$out = theme_table($header, $rows);
|
204
|
*/
|
205
|
RenderHints::popFromRenderStack();
|
206
|
//return $out;
|
207
|
}
|
208
|
/**
|
209
|
* Show whole synonymy for the accepted taxon. Synonymy list is headed by the complete scientific name
|
210
|
* of the accepted taxon with nomenclatural reference.
|
211
|
*
|
212
|
*/
|
213
|
function theme_cdm_taxon_page_synonymy($taxon, $addAcceptedTaxon){
|
214
|
|
215
|
RenderHints::pushToRenderStack('taxon_page_synonymy');
|
216
|
$synomymie = cdm_ws_get(CDM_WS_PORTAL_TAXON_SYNONYMY, $taxon->uuid);
|
217
|
$skip = array(UUID_BASIONYM);
|
218
|
|
219
|
if($addAcceptedTaxon){
|
220
|
if(isset($taxon->name->nomenclaturalReference)){
|
221
|
$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
|
222
|
}
|
223
|
$out .= theme('cdm_taxonName', $taxon->name, null, $referenceUri);
|
224
|
|
225
|
$special_annotations_array = array();
|
226
|
$special_annotations_array[] = $taxon->name;
|
227
|
$special_annotations_array[] = $taxon;
|
228
|
$out .= theme('cdm_annotations_as_footnotekeys',
|
229
|
$special_annotations_array,
|
230
|
RenderHints::getRenderPath() . '-annotations');
|
231
|
RenderHints::setFootnoteListKey(RenderHints::getRenderPath() . '-annotations');
|
232
|
}
|
233
|
|
234
|
if($addAcceptedTaxon && !isset($synomymie->homotypicSynonymsByHomotypicGroup[0])){
|
235
|
// display the type information for the added taxon
|
236
|
$typeDesignations = cdm_ws_get(CDM_WS_PORTAL_TAXON_NAMETYPEDESIGNATIONS, $taxon->uuid);
|
237
|
if($typeDesignations){
|
238
|
$out .= theme('cdm_typedesignations', $typeDesignations);
|
239
|
}
|
240
|
} else {
|
241
|
// render the homotypicSynonymyGroup including the type information
|
242
|
$out .= theme('cdm_homotypicSynonymyGroup', $synomymie->homotypicSynonymsByHomotypicGroup);
|
243
|
}
|
244
|
|
245
|
if($synomymie->heterotypicSynonymyGroups) {
|
246
|
foreach($synomymie->heterotypicSynonymyGroups as $homotypicalGroup){
|
247
|
$out .= theme('cdm_heterotypicSynonymyGroup', $homotypicalGroup);
|
248
|
}
|
249
|
}
|
250
|
|
251
|
if(variable_get(CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS_DEFAULT)){
|
252
|
|
253
|
$nameRelationships = cdm_ws_get(CDM_WS_PORTAL_TAXON_TO_NAMERELATIONS, $taxon->uuid);
|
254
|
// TODO is it correct to skip relationsFromThisName since all relationships are to be understood as 'is .... of'
|
255
|
if(variable_get('cdm_dataportal_name_relations_skiptype_basionym', 1)){
|
256
|
$skip = array(UUID_BASIONYM);
|
257
|
}
|
258
|
$out .= theme('nameRelationships', $nameRelationships, $skip);
|
259
|
}
|
260
|
|
261
|
if(variable_get(CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT)){
|
262
|
$taxonRelationships = cdm_ws_get(CDM_WS_PORTAL_TAXON_RELATIONS, $taxon->uuid);
|
263
|
$out .= theme('cdm_taxonRelationships', $taxonRelationships);
|
264
|
}
|
265
|
|
266
|
RenderHints::popFromRenderStack();
|
267
|
|
268
|
return $out;
|
269
|
}
|
270
|
|
271
|
/**
|
272
|
* Show the collection of images stored with the accepted taxon
|
273
|
*
|
274
|
*/
|
275
|
function theme_cdm_taxon_page_images($taxon, $media){
|
276
|
|
277
|
$hasImages = isset($media[0]);
|
278
|
|
279
|
if($hasImages){
|
280
|
//
|
281
|
$maxExtend = 150;
|
282
|
$cols = 3;
|
283
|
$maxRows = false;
|
284
|
$alternativeMediaUri = null;
|
285
|
$captionElements = array('title', 'rights', '#uri'=>t('open Image'));
|
286
|
$gallery_name = $taxon->uuid;
|
287
|
$mediaLinkType = 'LIGHTBOX';
|
288
|
|
289
|
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_MEDIA_GALLERY_NAME);
|
290
|
|
291
|
$out = '<div class="image-gallerie">';
|
292
|
$out .= theme('cdm_media_gallerie', $media,
|
293
|
$gallery_name,
|
294
|
$gallery_settings['cdm_dataportal_media_maxextend'],
|
295
|
$gallery_settings['cdm_dataportal_media_cols'],
|
296
|
0, // ignore maxrows settings
|
297
|
$captionElements,
|
298
|
$mediaLinkType,
|
299
|
null);
|
300
|
$out .= '</div>';
|
301
|
}else{
|
302
|
$out = 'No images available.';
|
303
|
|
304
|
}
|
305
|
return $out;
|
306
|
}
|
307
|
|
308
|
/**
|
309
|
* Show a reference in it's atomized form
|
310
|
*/
|
311
|
function theme_cdm_reference_page($referenceTO){
|
312
|
|
313
|
/*
|
314
|
if($referenceTO->titleCache) {
|
315
|
drupal_set_title($referenceTO->titleCache);
|
316
|
} else {
|
317
|
drupal_set_title($referenceTO->fullCitation);
|
318
|
}
|
319
|
*/
|
320
|
|
321
|
$field_order = array(
|
322
|
"title",
|
323
|
//"titleCache",
|
324
|
//"citation",
|
325
|
"authorTeam",
|
326
|
"editor",
|
327
|
"publisher",
|
328
|
"placePublished",
|
329
|
"datePublished",
|
330
|
"year",
|
331
|
"edition", // class Book
|
332
|
"volume", // class Article
|
333
|
"seriesPart",
|
334
|
"inReference",
|
335
|
//"inJournal", // class Article
|
336
|
//"inBook", // class BookSection
|
337
|
"nomRefBase", // class BookSection, Book, Article
|
338
|
//"inProceedings", // class InProceedings
|
339
|
"pages", // class Article
|
340
|
"series", // class Article, PrintSeries
|
341
|
"school", // class Thesis
|
342
|
"institution", // class Report
|
343
|
"organization", // class Proceedings
|
344
|
"nextVersion",
|
345
|
"previousVersion",
|
346
|
"isbn", // class Book
|
347
|
"issn", // class Journal
|
348
|
"uri",
|
349
|
);
|
350
|
/*
|
351
|
$table_rows = array();
|
352
|
foreach($field_order as $fieldname){
|
353
|
|
354
|
if(isset($referenceTO->$fieldname)){
|
355
|
|
356
|
if($fieldname == "datePublished") {
|
357
|
$partial = $referenceTO->$fieldname;
|
358
|
$datePublished = '';
|
359
|
if($partial->start){
|
360
|
//var_dump ($partial->start);
|
361
|
$datePublishedYear = substr($partial->start, 0, 4);
|
362
|
$datePublishedMonth = substr($partial->start, 5, 2);
|
363
|
|
364
|
if (!(preg_match('#[0-9]#',$datePublishedMonth))){
|
365
|
$datePublishedMonth = '00';
|
366
|
}
|
367
|
|
368
|
$datePublishedDay = substr($partial->start, 7, 2);
|
369
|
if (!(preg_match('#[0-9]#',$datePublishedDay))){
|
370
|
$datePublishedDay = '00';
|
371
|
}
|
372
|
$datePublished = $datePublishedYear.'-'.$datePublishedMonth.'-'.$datePublishedDay;
|
373
|
}
|
374
|
if($partial->end){
|
375
|
$datePublished = (strlen($datePublished) > 0 ? ' '.t('to').' ' : '').substr($partial->end, 0, 4).'-'.substr($partial->end, 4, 2).'-'.substr($partial->end, 6, 2);
|
376
|
}
|
377
|
$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $datePublished);
|
378
|
//$datePublished = array(t(ucfirst(strtolower($fieldname))), $datePublished);
|
379
|
} else if(is_object($referenceTO->$fieldname)){
|
380
|
if ($fieldname == "authorTeam"){
|
381
|
$dump = $referenceTO->$fieldname;
|
382
|
$teammembers = "teamMembers";
|
383
|
$team = $dump->$teammembers;
|
384
|
$nameArray = array();
|
385
|
|
386
|
foreach($team as $member){
|
387
|
if (strlen($member->lastname)> 0){
|
388
|
$nname = $member->lastname;
|
389
|
$name = $nname;
|
390
|
if (strlen($member->firstname)> 0){
|
391
|
$vname = $member->firstname;
|
392
|
$name =$vname." ". $nname;
|
393
|
}
|
394
|
$nameArray[] =$name;
|
395
|
}else{
|
396
|
if (strlen($member->titleCache)> 0){
|
397
|
$nameArray[] = $member->titleCache;
|
398
|
}
|
399
|
}
|
400
|
}
|
401
|
$names = join($nameArray, ", ");
|
402
|
}else if ($fieldname == "inReference"){
|
403
|
$type = $referenceTO ->$fieldname-> type;
|
404
|
$names = $referenceTO-> $fieldname-> titleCache;
|
405
|
switch ($type) {
|
406
|
case "Book":
|
407
|
$fieldname = "in book";
|
408
|
break;
|
409
|
case "Journal":
|
410
|
$fieldname = "in journal";
|
411
|
break;
|
412
|
case "Proceedings":
|
413
|
$fieldname = "in proceedings";
|
414
|
break;
|
415
|
}
|
416
|
|
417
|
}else{
|
418
|
$names = $referenceTO->$fieldname-> titleCache;
|
419
|
}
|
420
|
$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $names);
|
421
|
//$name = array(t(ucfirst(strtolower($fieldname))), $names);
|
422
|
|
423
|
} else {
|
424
|
$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $referenceTO->$fieldname);
|
425
|
//$name = array(t(ucfirst(strtolower($fieldname))), $referenceTO->$fieldname);
|
426
|
}
|
427
|
}
|
428
|
}
|
429
|
*/
|
430
|
|
431
|
//select the type of the reference and find the in Reference attribute
|
432
|
|
433
|
$referenceData = array(
|
434
|
"title" => NULL,
|
435
|
//"titleCache",
|
436
|
//"citation",
|
437
|
"authorTeam" => NULL,
|
438
|
"editor" => NULL,
|
439
|
"publisher" => NULL,
|
440
|
"placePublished" => NULL,
|
441
|
"datePublished" => NULL,
|
442
|
"year" => NULL,
|
443
|
"edition" => NULL, // class Book
|
444
|
"volume" => NULL, // class Article
|
445
|
"seriesPart" => NULL,
|
446
|
"inReference" => NULL,
|
447
|
//"inJournal", // class Article
|
448
|
//"inBook", // class BookSection
|
449
|
"nomRefBase" => NULL, // class BookSection, Book, Article
|
450
|
//"inProceedings", // class InProceedings
|
451
|
"pages" => NULL, // class Article
|
452
|
"series" => NULL, // class Article, PrintSeries
|
453
|
"school" => NULL, // class Thesis
|
454
|
"institution" => NULL, // class Report
|
455
|
"organization" => NULL, // class Proceedings
|
456
|
"nextVersion" => NULL,
|
457
|
"previousVersion" => NULL,
|
458
|
"isbn" => NULL, // class Book
|
459
|
"issn" => NULL, // class Journal
|
460
|
"uri" => NULL,
|
461
|
);
|
462
|
|
463
|
foreach($field_order as $fieldname){
|
464
|
|
465
|
if(isset($referenceTO->$fieldname)){
|
466
|
switch($fieldname){
|
467
|
case "datePublished":
|
468
|
$partial = $referenceTO->$fieldname;
|
469
|
$datePublished = '';
|
470
|
if($partial->start){
|
471
|
$datePublishedYear = substr($partial->start, 0, 4);
|
472
|
$datePublishedMonth = substr($partial->start, 5, 2);
|
473
|
if (!(preg_match('#[0-9]#',$datePublishedMonth))){
|
474
|
$datePublishedMonth = '00';
|
475
|
}
|
476
|
$datePublishedDay = substr($partial->start, 7, 2);
|
477
|
if (!(preg_match('#[0-9]#',$datePublishedDay))){
|
478
|
$datePublishedDay = '00';
|
479
|
}
|
480
|
$datePublished = $datePublishedYear.'-'.$datePublishedMonth.'-'.$datePublishedDay;
|
481
|
}
|
482
|
if($partial->end){
|
483
|
$datePublished = (strlen($datePublished) > 0 ? ' '.t('to').' ' : '').substr($partial->end, 0, 4).'-'.substr($partial->end, 4, 2).'-'.substr($partial->end, 6, 2);
|
484
|
}
|
485
|
|
486
|
$referenceData[$fieldname] = $datePublishedYear;
|
487
|
break;
|
488
|
|
489
|
default:
|
490
|
if(is_object($referenceTO->$fieldname)){
|
491
|
if ($fieldname == "authorTeam"){
|
492
|
$dump = $referenceTO->$fieldname;
|
493
|
$teammembers = "teamMembers";
|
494
|
$team = $dump->$teammembers;
|
495
|
$nameArray = array();
|
496
|
|
497
|
foreach($team as $member){
|
498
|
if (strlen($member->lastname)> 0){
|
499
|
$nname = $member->lastname;
|
500
|
$name = $nname;
|
501
|
if (strlen($member->firstname)> 0){
|
502
|
$vname = $member->firstname;
|
503
|
$name =$vname." ". $nname;
|
504
|
}
|
505
|
$nameArray[] =$name;
|
506
|
}else{
|
507
|
if (strlen($member->titleCache)> 0){
|
508
|
$nameArray[] = $member->titleCache;
|
509
|
}
|
510
|
}
|
511
|
}
|
512
|
$names = join($nameArray, ", ");
|
513
|
$referenceData[$fieldname] = $names;
|
514
|
}else if ($fieldname == "inReference"){
|
515
|
$names = $referenceTO->$fieldname->titleCache;
|
516
|
$referenceData[$fieldname] = $names;
|
517
|
}else{
|
518
|
$names = $referenceTO->$fieldname->titleCache;
|
519
|
$referenceData[$fieldname] = $names;
|
520
|
}
|
521
|
}else{
|
522
|
$referenceData[$fieldname] = $referenceTO->$fieldname;
|
523
|
}
|
524
|
|
525
|
}
|
526
|
}
|
527
|
}
|
528
|
$author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $referenceTO->uuid);
|
529
|
//return "" . ((strlen($referenceData["authorTeam"])>0) ? ($referenceData["authorTeam"] . '. ') : '')
|
530
|
return "" . ((strlen($author_team->titleCache)>0) ? ($author_team->titleCache . '. ') : '')
|
531
|
. ((strlen($referenceData["datePublished"])>0) ? ($referenceData["datePublished"] . '. ') : '')
|
532
|
. ((strlen($referenceData["title"])>0) ? ($referenceData["title"] . '. ') : "")
|
533
|
. ((strlen($referenceData["placePublished"])>0) ? ($referenceData["placePublished"] . '. ') : '')
|
534
|
. ((strlen($referenceData["editor"])>0) ? ($referenceData["editor"] . '. ') : '')
|
535
|
. ((strlen($referenceData["publisher"])>0) ? ($referenceData["publisher"] . '. ') : '')
|
536
|
. ((strlen($referenceData["inReference"])>0) ? ($referenceData["inReference"] . '. ') : '')
|
537
|
. ((strlen($referenceData["series"])>0) ? ($referenceData["series"] . '. ') : '')
|
538
|
. ((strlen($referenceData["volume"])>0) ? ($referenceData["volume"] . '. ') : '')
|
539
|
. ((strlen($referenceData["pages"])>0) ? ($referenceData["pages"] . '. ') : '')
|
540
|
. ((strlen($referenceData["isbn"])>0) ? ($referenceData["isbn"] . '. ') : '')
|
541
|
. ((strlen($referenceData["issn"])>0) ? ($referenceData["issn"] . '. ') : '')
|
542
|
. ((strlen($referenceData["uri"])>0) ? ($referenceData["uri"] . '. ') : '');
|
543
|
|
544
|
}
|
545
|
|
546
|
|
547
|
function theme_cdm_media_page($media, $mediarepresentation_uuid = false, $partId = false){
|
548
|
$out = '';
|
549
|
// determine which reprresentation and which part to show
|
550
|
$representationIdx = 0;
|
551
|
if($mediarepresentation_uuid){
|
552
|
$i = 0;
|
553
|
foreach($media->representations as $representation) {
|
554
|
if($representation->uuid == $mediarepresentation_uuid){
|
555
|
$representationIdx = $i;
|
556
|
}
|
557
|
$i++;
|
558
|
}
|
559
|
} else {
|
560
|
$mediarepresentation_uuid = $media->representations[0]->uuid;
|
561
|
}
|
562
|
|
563
|
$partIdx = 0;
|
564
|
if(!is_numeric($partId)){
|
565
|
// assuming it is an uuid
|
566
|
$i = 0;
|
567
|
foreach($media->representations[$representationIdx]->parts as $part) {
|
568
|
if($part->uuid == $partId){
|
569
|
$partIdx = $i;
|
570
|
}
|
571
|
$i++;
|
572
|
}
|
573
|
} else {
|
574
|
// assuming it is an index
|
575
|
$partIdx = $partId;
|
576
|
}
|
577
|
|
578
|
$media_metadata = cdm_read_media_metadata($media);
|
579
|
//$title = $media->titleCache;
|
580
|
$title = $media_metadata['title'];
|
581
|
|
582
|
$imageMaxExtend = variable_get('image-page-maxextend', 400);
|
583
|
|
584
|
if(!$title){
|
585
|
$title = 'Media '.$media->uuid.'';
|
586
|
}
|
587
|
|
588
|
drupal_set_title($title);
|
589
|
|
590
|
|
591
|
$out .= '<div class="media">';
|
592
|
|
593
|
//$out .= '<div class="viewer">';
|
594
|
$out .= theme(cdm_back_to_image_gallery_button);
|
595
|
$out .= '<div class="viewer">';
|
596
|
//$out .= theme('cdm_media_gallerie_image', $representation->parts[$partIdx], $imageMaxExtend);
|
597
|
$out .= theme('cdm_openlayers_image', $media->representations[$representationIdx]->parts[$partIdx], $imageMaxExtend);
|
598
|
$out .= '</div>';
|
599
|
|
600
|
// general media metadata
|
601
|
//$media_metadata = cdm_ws_get(CDM_WS_MEDIA_METADATA, array($media->uuid));
|
602
|
//vardump("PRINTING MEDIA METADATA");
|
603
|
//vardump($media_metadata);
|
604
|
//vardump("PRINTING MEDIA");
|
605
|
//vardump($media);
|
606
|
$metadataToPrint = theme('cdm_media_caption', $media);
|
607
|
$out .= $metadataToPrint;
|
608
|
|
609
|
|
610
|
//tabs for the different representations
|
611
|
//ul.secondary
|
612
|
$out .= '<ul class="primary">';
|
613
|
foreach($media->representations as $representation){
|
614
|
$out .= '<li>'.l($media->representations[$representationIdx]->mimeType, path_to_media($media->uuid, $mediarepresentation_uuid, $partIdx)).'</li>';
|
615
|
}
|
616
|
$out .= '</ul>';
|
617
|
|
618
|
// representation(-part) specific metadata
|
619
|
$thumbnailMaxExtend = 100;
|
620
|
$out .= '<table>';
|
621
|
//$out .= '<tr><th colspan="3">'.t('MimeType').': '.$media->representations[$representationIdx]->mimeType.'</th></tr>';
|
622
|
$i = 0;
|
623
|
foreach($media->representations[$representationIdx]->parts as $part){
|
624
|
$out .= '<tr><th>'.t('Part').' '.($i + 1).'</th><td>';
|
625
|
switch($part->class){
|
626
|
case 'ImageFile': $out .= $part->width.' x '.$part->height.' - '.$part->size.'k'; break;
|
627
|
case 'AudioFile':
|
628
|
case 'MovieFile': $out .= t('Duration').': '.$part->duration.'s - '.$part->size.'k'; break;
|
629
|
default: $out .= $part->size.'k';
|
630
|
}
|
631
|
$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>';
|
632
|
$i++;
|
633
|
}
|
634
|
$out .= '</table>';
|
635
|
$out .= '</div>';
|
636
|
|
637
|
return $out;
|
638
|
}
|
639
|
|
640
|
/**
|
641
|
* Allows theming of the taxon page tabs
|
642
|
*
|
643
|
* @param $tabname
|
644
|
* @return unknown_type
|
645
|
*/
|
646
|
function theme_cdm_taxonpage_tab($tabname){
|
647
|
//TODO replace by using translations or theme the menue tabs itself instead?
|
648
|
switch($tabname){
|
649
|
default: return t($tabname);
|
650
|
}
|
651
|
}
|
652
|
|