1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Page theming functions.
|
5
|
*
|
6
|
* @copyright
|
7
|
* (C) 2007-2012 EDIT
|
8
|
* European Distributed Institute of Taxonomy
|
9
|
* http://www.e-taxonomy.eu
|
10
|
*
|
11
|
* The contents of this module are subject to the Mozilla
|
12
|
* Public License Version 1.1.
|
13
|
* @see http://www.mozilla.org/MPL/MPL-1.1.html
|
14
|
*/
|
15
|
|
16
|
/**
|
17
|
* Returns HTML for the default title of a taxon page.
|
18
|
* * The returned title is a formatted taxon name.
|
19
|
*
|
20
|
* @param array $variables
|
21
|
* An associative array containing:
|
22
|
* - taxon: The taxon name being formatted for the title.
|
23
|
* - uuid: UUID for the taxon.
|
24
|
*
|
25
|
* @ingroup themeable
|
26
|
*/
|
27
|
function theme_cdm_taxon_page_title($variables) {
|
28
|
$taxon = $variables['taxon'];
|
29
|
RenderHints::pushToRenderStack('taxon_page_title');
|
30
|
$referenceUri = '';
|
31
|
$out = '';
|
32
|
if (isset($taxon->name->nomenclaturalReference)) {
|
33
|
$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
|
34
|
}
|
35
|
|
36
|
$out .= theme('cdm_taxonName', array(
|
37
|
'taxonName' => $taxon->name,
|
38
|
'nameLink' => NULL,
|
39
|
'refenceLink' => $referenceUri,
|
40
|
'show_annotations' => FALSE,
|
41
|
));
|
42
|
RenderHints::popFromRenderStack();
|
43
|
|
44
|
return '<span class="' . $taxon->class . '">' . $out . '</span>';
|
45
|
}
|
46
|
|
47
|
/**
|
48
|
* Returns HTML for the default title for a name page.
|
49
|
*
|
50
|
* The returned title is a formatted name.
|
51
|
*
|
52
|
* @param array $variables
|
53
|
* An associative array containing:
|
54
|
* - taxon_name: The taxon name object.
|
55
|
*
|
56
|
* @ingroup themeable
|
57
|
*/
|
58
|
function theme_cdm_name_page_title($variables) {
|
59
|
$taxon_name = $variables['taxon_name'];
|
60
|
RenderHints::pushToRenderStack('taxon_page_title');
|
61
|
if (isset($taxon_name->nomenclaturalReference)) {
|
62
|
$referenceUri = url(path_to_reference($taxon_name->nomenclaturalReference->uuid));
|
63
|
}
|
64
|
|
65
|
$out = '<span class="' . $taxon_name->class . '">' . theme('cdm_taxonName', array(
|
66
|
'taxonName' => $taxon_name,
|
67
|
'nameLink' => NULL,
|
68
|
'refenceLink' => $referenceUri,
|
69
|
'show_annotations' => FALSE,
|
70
|
)) . '</span>';
|
71
|
RenderHints::popFromRenderStack();
|
72
|
return $out;
|
73
|
}
|
74
|
|
75
|
|
76
|
|
77
|
|
78
|
|
79
|
/**
|
80
|
* Returns HTML containing the synonymy for the accepted taxon.
|
81
|
*
|
82
|
* Shows the whole synonymy for the accepted taxon.
|
83
|
* The synonymy list is headed by the complete scientific name
|
84
|
* of the accepted taxon with nomenclatural reference.
|
85
|
*
|
86
|
* @param array $variables
|
87
|
* An associative array containing:
|
88
|
* - taxon
|
89
|
* - addAcceptedTaxon
|
90
|
*
|
91
|
* @ingroup themeable
|
92
|
*/
|
93
|
function theme_cdm_taxon_page_synonymy($variables) {
|
94
|
$taxon = $variables['taxon'];
|
95
|
$addAcceptedTaxon = $variables['addAcceptedTaxon'];
|
96
|
|
97
|
RenderHints::pushToRenderStack('taxon_page_synonymy');
|
98
|
|
99
|
// footnote key for the homotypic group and accepted taxon,
|
100
|
// both should have the same footnote key
|
101
|
RenderHints::setFootnoteListKey(RenderHints::getRenderPath());
|
102
|
|
103
|
$synomymie = cdm_ws_get(CDM_WS_PORTAL_TAXON_SYNONYMY, $taxon->uuid);
|
104
|
$skip = array(
|
105
|
UUID_BASIONYM,
|
106
|
);
|
107
|
$out = '';
|
108
|
|
109
|
// Render accepted taxon.
|
110
|
//
|
111
|
// foonotes of the accepted taxon will be rendered in the homotypic group section
|
112
|
// even if there are not synonyms in the homotypic group
|
113
|
// homotypic group and accepted taxon should have the same footnote key
|
114
|
$referenceUri = '';
|
115
|
if ($addAcceptedTaxon) {
|
116
|
if (isset($taxon->name->nomenclaturalReference)) {
|
117
|
$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
|
118
|
}
|
119
|
|
120
|
$accepted_name = '<span class="accepted-name">';
|
121
|
$accepted_name .= theme('cdm_taxonName', array(
|
122
|
'taxonName' => $taxon->name,
|
123
|
'nameLink' => NULL,
|
124
|
'refenceLink' => $referenceUri,
|
125
|
));
|
126
|
$accepted_name .= '</span>';
|
127
|
|
128
|
// handle annotations of the name and taxon
|
129
|
$special_annotations_array = array();
|
130
|
$special_annotations_array[] = $taxon->name;
|
131
|
$special_annotations_array[] = $taxon;
|
132
|
$accepted_name .= theme('cdm_annotations_as_footnotekeys', array(
|
133
|
'cdmBase_list' => $special_annotations_array,
|
134
|
'footnote_list_key' => RenderHints::getRenderPath() . '-annotations')
|
135
|
);
|
136
|
}
|
137
|
|
138
|
// --- Render homotypic synonymy group
|
139
|
if (!empty($accepted_name)) {
|
140
|
$out .= $accepted_name;
|
141
|
}
|
142
|
|
143
|
// Render the homotypicSynonymyGroup including the type information.
|
144
|
$out .= theme('cdm_homotypicSynonymyGroup', array('synonymList' => $synomymie->homotypicSynonymsByHomotypicGroup, 'accepted_taxon_uuid' => $taxon->uuid));
|
145
|
|
146
|
|
147
|
// Render accepted taxon heterotypic synonymy groups.
|
148
|
if ($synomymie->heterotypicSynonymyGroups) {
|
149
|
foreach ($synomymie->heterotypicSynonymyGroups as $homotypicalGroup) {
|
150
|
$out .= theme('cdm_heterotypicSynonymyGroup', array('homotypicalGroup' => $homotypicalGroup));
|
151
|
}
|
152
|
}
|
153
|
// Render taxon relationships.
|
154
|
if (variable_get(CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT)) {
|
155
|
$taxonRelationships = cdm_ws_get(CDM_WS_PORTAL_TAXON_RELATIONS, $taxon->uuid);
|
156
|
$out .= theme('cdm_taxonRelationships', array('taxonRelationships' => $taxonRelationships, 'focusedTaxon' => $taxon));
|
157
|
}
|
158
|
// Render name relationships.
|
159
|
$name_rels_to_show = variable_get('name_relationships_to_show', NULL);
|
160
|
$skip = array();
|
161
|
if ($name_rels_to_show) {
|
162
|
foreach ($name_rels_to_show as $key => $value) {
|
163
|
if ($value === 0) {
|
164
|
$skip[] = $key;
|
165
|
}
|
166
|
}
|
167
|
if (sizeof($name_rels_to_show) != sizeof($skip)) {
|
168
|
$nameRelationships = cdm_ws_get(CDM_WS_PORTAL_TAXON_TO_NAMERELATIONS, $taxon->uuid);
|
169
|
$out .= theme('cdm_nameRelationships', array('nameRelationships' => $nameRelationships, 'skipTypes' => $skip));
|
170
|
}
|
171
|
}
|
172
|
|
173
|
RenderHints::popFromRenderStack();
|
174
|
|
175
|
return $out;
|
176
|
}
|
177
|
|
178
|
|
179
|
/**
|
180
|
* Returns HTML for the given result page including a pager.
|
181
|
*
|
182
|
* @param array $variables
|
183
|
* An associative array containing:
|
184
|
* - pager: The cdmlib pager object containing the result set of cdm base
|
185
|
* objects (currently this function can only handle taxon instances =>
|
186
|
* TODO)
|
187
|
* - path: The target path for the pager links, this will usually point to
|
188
|
* 'cdm_dataportal/search/results/taxon'
|
189
|
*
|
190
|
* @ingroup themeable
|
191
|
*/
|
192
|
function theme_cdm_search_results($variables) {
|
193
|
$pager = $variables['pager'];
|
194
|
$path = $variables['path'];
|
195
|
|
196
|
$freetextSearchResults = array();
|
197
|
|
198
|
// If the pager contains records of SearchResults, extract the taxa and use
|
199
|
// them as records instead.
|
200
|
if (isset($pager->records[0]) && $pager->records[0]->class == "SearchResult") {
|
201
|
$freetextSearchResults = $pager->records;
|
202
|
$taxa = array();
|
203
|
// $highlightedFragments = array();
|
204
|
foreach ($pager->records as $searchResult) {
|
205
|
$taxa[] = &$searchResult->entity;
|
206
|
/*
|
207
|
if(!isset($searchResult->fieldHighlightMap)){
|
208
|
$searchResult->fieldHighlightMap = NULL;
|
209
|
}
|
210
|
$fragmentHighlighting[] = $searchResult->fieldHighlightMap;
|
211
|
*/
|
212
|
}
|
213
|
$pager->records = $taxa;
|
214
|
}
|
215
|
|
216
|
$out = '';
|
217
|
// Add thumbnails checkbox and refine search link.
|
218
|
$out = '<div class="page_options">';
|
219
|
if (isset($_REQUEST['ws'])) {
|
220
|
if (cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) {
|
221
|
$out .= '<div id="backButton">' . l(t('Modify search'), cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) . '</div>';
|
222
|
}
|
223
|
}
|
224
|
$out .= '<form name="pageoptions"><div id="showThumbnails"><input type="checkbox" name="showThumbnails" ' . (do_showThumbnails() == 1 ? 'checked="checked"' : '') . '> ' . t('Show Thumbnails') . '</div></form>';
|
225
|
$out .= '</div>';
|
226
|
|
227
|
$classification = cdm_dataportal_searched_in_classification();
|
228
|
|
229
|
if ( count(cdm_ws_get(CDM_WS_PORTAL_TAXONOMY)) > 1 ) {
|
230
|
$out .= '<div id="search-summary">' . t('results for') . ' ';
|
231
|
if ($classification != NULL) {
|
232
|
$out .= $classification->titleCache ;
|
233
|
} else {
|
234
|
$out .= t('any classification');
|
235
|
}
|
236
|
$out .= ':</div>';
|
237
|
}
|
238
|
|
239
|
// List results.
|
240
|
if (isset($pager->records) && count($pager->records) > 0) {
|
241
|
$out .= '<div id="search_results">';
|
242
|
$out .= theme('cdm_list_of_taxa',
|
243
|
array(
|
244
|
'records' => $pager->records,
|
245
|
'freetextSearchResults' => $freetextSearchResults,
|
246
|
'show_classification' => $classification === NULL
|
247
|
)
|
248
|
);
|
249
|
$out .= '</div>';
|
250
|
$out .= theme('cdm_pager', array(
|
251
|
'pager' => $pager,
|
252
|
'path' => $path,
|
253
|
'parameters' => $_REQUEST,
|
254
|
));
|
255
|
} else {
|
256
|
$out .= '<h4 class="error">Sorry, no matching entries found.</h4>';
|
257
|
}
|
258
|
return $out;
|
259
|
}
|
260
|
|
261
|
|
262
|
/**
|
263
|
* TODO Implementation of Hook taxon_image_gallery()
|
264
|
*
|
265
|
* @param unknown_type $taxon
|
266
|
* @param unknown_type $media
|
267
|
*
|
268
|
* @return unknown_type
|
269
|
*/
|
270
|
function taxon_image_gallery_default($taxon, $media) {
|
271
|
$hasImages = isset($media[0]);
|
272
|
|
273
|
if ($hasImages) {
|
274
|
|
275
|
$maxExtend = 150;
|
276
|
$cols = 3;
|
277
|
$maxRows = FALSE;
|
278
|
$alternativeMediaUri = NULL;
|
279
|
/* Comment @WA: was in D5:
|
280
|
$captionElements = array(
|
281
|
'title',
|
282
|
'rights',
|
283
|
'#uri' => t('open Image'),
|
284
|
);
|
285
|
*/
|
286
|
$captionElements = array(
|
287
|
'title',
|
288
|
'description',
|
289
|
'artist',
|
290
|
'location',
|
291
|
'rights',
|
292
|
'#uri' => t('open Image'),
|
293
|
);
|
294
|
$gallery_name = $taxon->uuid;
|
295
|
$mediaLinkType = 'LIGHTBOX';
|
296
|
|
297
|
// $gallery_settings = getGallerySettings(CDM_DATAPORTAL_MEDIA_GALLERY_NAME);
|
298
|
|
299
|
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_TAXON_MEDIA_GALLERY_NAME_TAB);
|
300
|
|
301
|
$out = '<div class="image-gallerie">';
|
302
|
$out .= theme('cdm_media_gallerie', array(
|
303
|
'mediaList' => $media,
|
304
|
'galleryName' => $gallery_name,
|
305
|
'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],
|
306
|
'cols' => $gallery_settings['cdm_dataportal_media_cols'],
|
307
|
'maxRows' => 0, // Ignore maxrows settings.
|
308
|
'captionElements' => $captionElements,
|
309
|
'mediaLinkType' => $mediaLinkType,
|
310
|
'alternativeMediaUri' => NULL,
|
311
|
'galleryLinkUri' => NULL,
|
312
|
'showCaption' => $gallery_settings['cdm_dataportal_show_thumbnail_captions'],
|
313
|
));
|
314
|
$out .= '</div>';
|
315
|
}
|
316
|
else {
|
317
|
$out = 'No images available.';
|
318
|
}
|
319
|
return $out;
|
320
|
}
|
321
|
|
322
|
/**
|
323
|
* TODO Implementation of Hook taxon_image_gallery()
|
324
|
*
|
325
|
* @param unknown_type $taxon
|
326
|
* @param unknown_type $media
|
327
|
*
|
328
|
* @return unknown_type
|
329
|
*/
|
330
|
function taxon_image_gallery_fsi($taxon, $media) {
|
331
|
$flashLink = isset($media[0]);
|
332
|
|
333
|
if ($flashLink) {
|
334
|
|
335
|
if (module_exists("fsi_gallery")) {
|
336
|
$out = theme("fsi_gallery", array('taxon' => $taxon, 'media' => $media));
|
337
|
}
|
338
|
else {
|
339
|
$message = t('In order to use the FSI gallery you must enable the according ') . l(t("module"), "admin/modules");
|
340
|
drupal_set_message($message, "error");
|
341
|
$out = '<h3>' . $message . '</h3>';
|
342
|
}
|
343
|
}
|
344
|
else {
|
345
|
$out = 'No images available.';
|
346
|
}
|
347
|
return $out;
|
348
|
}
|
349
|
|
350
|
/**
|
351
|
* Returns HTML for a single reference page.
|
352
|
*
|
353
|
* Renders a page with all data on a single reference.
|
354
|
*
|
355
|
* @param array $variables
|
356
|
* An associative array containing:
|
357
|
* - reference: Object.
|
358
|
*
|
359
|
* @ingroup themeable
|
360
|
*/
|
361
|
function theme_cdm_reference_page($variables) {
|
362
|
$reference = $variables['reference'];
|
363
|
|
364
|
$out = '';
|
365
|
|
366
|
if (isset($reference->titleCache)) {
|
367
|
drupal_set_title($reference->titleCache, PASS_THROUGH);
|
368
|
}
|
369
|
|
370
|
$field_order = array(
|
371
|
"title",
|
372
|
// "titleCache",
|
373
|
// "citation",
|
374
|
"authorTeam",
|
375
|
"editor",
|
376
|
"publisher",
|
377
|
"placePublished",
|
378
|
"datePublished",
|
379
|
"year",
|
380
|
"edition",// Class Book.
|
381
|
"volume",// Class Article.
|
382
|
"seriesPart",
|
383
|
"inReference",
|
384
|
"nomRefBase", // Class BookSection, Book, Article.
|
385
|
"pages",// Class Article.
|
386
|
"series",// Class Article, PrintSeries.
|
387
|
"school",// Class Thesis.
|
388
|
"institution",// Class Report.
|
389
|
"organization",// Class Proceedings.
|
390
|
"nextVersion",
|
391
|
"previousVersion",
|
392
|
"isbn",// Class Book.
|
393
|
"issn",// Class Journal.
|
394
|
"uri",
|
395
|
);
|
396
|
|
397
|
$header = array(
|
398
|
t('Field'),
|
399
|
t('Value'),
|
400
|
);
|
401
|
$table_rows = array();
|
402
|
|
403
|
if (!isset($reference->authorTeam)) {
|
404
|
$authorTeam = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->uuid);
|
405
|
$reference->authorTeam = isset($authorTeam->titleCache) ? $authorTeam->titleCache : '';
|
406
|
}
|
407
|
|
408
|
if (!isset($reference->inReference)) {
|
409
|
$reference->inReference = cdm_ws_get(CDM_WS_REFERENCE, array(
|
410
|
$reference->uuid,
|
411
|
"inReference",
|
412
|
));
|
413
|
}
|
414
|
|
415
|
foreach ($field_order as $fieldname) {
|
416
|
|
417
|
if (isset($reference->$fieldname)) {
|
418
|
|
419
|
if ($fieldname == "datePublished") {
|
420
|
$period = $reference->$fieldname;
|
421
|
$datePublished = timePeriodToString($period);
|
422
|
if (isset($datePublished) && $datePublished != '') {
|
423
|
$table_rows[] = array(
|
424
|
t(ucfirst(strtolower($fieldname))),
|
425
|
$datePublished,
|
426
|
);
|
427
|
}
|
428
|
// $datePublished = array(t(ucfirst(strtolower($fieldname))),
|
429
|
// $datePublished);
|
430
|
}
|
431
|
elseif (is_object($reference->$fieldname)) {
|
432
|
if ($fieldname == "authorTeam") {
|
433
|
$dump = $reference->$fieldname;
|
434
|
$teammembers = "teamMembers";
|
435
|
$team = $dump->$teammembers;
|
436
|
$nameArray = array();
|
437
|
|
438
|
foreach ($team as $member) {
|
439
|
if (strlen($member->lastname) > 0) {
|
440
|
$nname = $member->lastname;
|
441
|
$name = $nname;
|
442
|
if (strlen($member->firstname) > 0) {
|
443
|
$vname = $member->firstname;
|
444
|
$name = $vname . " " . $nname;
|
445
|
}
|
446
|
$nameArray[] = $name;
|
447
|
}
|
448
|
else {
|
449
|
if (strlen($member->titleCache) > 0) {
|
450
|
$nameArray[] = $member->titleCache;
|
451
|
}
|
452
|
}
|
453
|
}
|
454
|
$value = join($nameArray, ", ");
|
455
|
}
|
456
|
elseif ($fieldname == "inReference") {
|
457
|
$type = $reference->$fieldname->type;
|
458
|
$value = l($reference->$fieldname->titleCache, path_to_reference($reference->$fieldname->uuid));
|
459
|
switch ($type) {
|
460
|
case "Book":
|
461
|
$fieldname = "in book";
|
462
|
break;
|
463
|
case "Journal":
|
464
|
$fieldname = "in journal";
|
465
|
break;
|
466
|
case "Proceedings":
|
467
|
$fieldname = "in proceedings";
|
468
|
break;
|
469
|
}
|
470
|
}
|
471
|
else {
|
472
|
$value = $reference->$fieldname->titleCache;
|
473
|
}
|
474
|
if (isset($value) && $value != '') {
|
475
|
$table_rows[] = array(
|
476
|
t(ucfirst(strtolower($fieldname))),
|
477
|
$value,
|
478
|
);
|
479
|
}
|
480
|
}
|
481
|
else {
|
482
|
if (isset($reference->$fieldname) && $reference->$fieldname != '') {
|
483
|
$table_rows[] = array(
|
484
|
t(ucfirst(strtolower($fieldname))),
|
485
|
$reference->$fieldname,
|
486
|
);
|
487
|
}
|
488
|
}
|
489
|
}
|
490
|
}
|
491
|
|
492
|
$out = theme_table(array(
|
493
|
'header' => array(),
|
494
|
'rows' => $table_rows,
|
495
|
'attributes' => array(),
|
496
|
'caption' => NULL,
|
497
|
'colgroups' => NULL,
|
498
|
'sticky' => NULL,
|
499
|
'empty' => NULL,
|
500
|
));
|
501
|
|
502
|
// Annotations below the table.
|
503
|
$annotations = cdm_ws_getAnnotationsFor($reference);
|
504
|
$out .= theme("cdm_annotations", array('annotations' => $annotations));
|
505
|
|
506
|
return $out;
|
507
|
}
|
508
|
|
509
|
/**
|
510
|
* @todo Please document this function.
|
511
|
* @see http://drupal.org/node/1354
|
512
|
*/
|
513
|
function theme_cdm_media_page($variables) {
|
514
|
$media = $variables['media'];
|
515
|
$mediarepresentation_uuid = $variables['mediarepresentation_uuid'];
|
516
|
$partId = $variables['partId'];
|
517
|
$out = '';
|
518
|
// Determine which reprresentation and which part to show.
|
519
|
$representationIdx = 0;
|
520
|
if ($mediarepresentation_uuid) {
|
521
|
$i = 0;
|
522
|
foreach ($media->representations as $representation) {
|
523
|
if ($representation->uuid == $mediarepresentation_uuid) {
|
524
|
$representationIdx = $i;
|
525
|
}
|
526
|
$i++;
|
527
|
}
|
528
|
}
|
529
|
else {
|
530
|
$mediarepresentation_uuid = $media->representations[0]->uuid;
|
531
|
}
|
532
|
|
533
|
$partIdx = 0;
|
534
|
if (!is_numeric($partId)) {
|
535
|
// Assuming it is an uuid.
|
536
|
$i = 0;
|
537
|
foreach ($media->representations[$representationIdx]->parts as $part) {
|
538
|
if ($part->uuid == $partId) {
|
539
|
$partIdx = $i;
|
540
|
}
|
541
|
$i++;
|
542
|
}
|
543
|
}
|
544
|
else {
|
545
|
// Assuming it is an index.
|
546
|
$partIdx = $partId;
|
547
|
}
|
548
|
|
549
|
$media_metadata = cdm_read_media_metadata($media);
|
550
|
// $title = $media->titleCache;
|
551
|
$title = $media_metadata['title'];
|
552
|
|
553
|
$imageMaxExtend = variable_get('image-page-maxextend', 400);
|
554
|
|
555
|
if (!$title) {
|
556
|
$title = 'Media ' . $media->uuid . '';
|
557
|
}
|
558
|
|
559
|
drupal_set_title($title, PASS_THROUGH);
|
560
|
|
561
|
$out .= '<div class="media cdm_media_viewer_image">';
|
562
|
|
563
|
$out .= theme('cdm_back_to_image_gallery_button', array());
|
564
|
$out .= '<div class="viewer">';
|
565
|
$out .= theme('cdm_openlayers_image', array('mediaRepresentationPart' => $media->representations[$representationIdx]->parts[$partIdx], 'maxExtend' => $imageMaxExtend));
|
566
|
$out .= '</div>';
|
567
|
|
568
|
// General media metadata.
|
569
|
/*
|
570
|
$media_metadata = cdm_ws_get(CDM_WS_MEDIA_METADATA, array($media->uuid));
|
571
|
vardump("PRINTING MEDIA METADATA");
|
572
|
vardump($media_metadata);
|
573
|
vardump("PRINTING MEDIA");
|
574
|
vardump($media);
|
575
|
*/
|
576
|
$metadataToPrint = theme('cdm_media_caption', array('media' => $media));
|
577
|
$out .= $metadataToPrint;
|
578
|
|
579
|
// Tabs for the different representations.
|
580
|
// ul.secondary
|
581
|
$out .= '<ul class="primary">';
|
582
|
foreach ($media->representations as $representation) {
|
583
|
$out .= '<li>' . l($media->representations[$representationIdx]->mimeType, path_to_media($media->uuid, $mediarepresentation_uuid, $partIdx)) . '</li>';
|
584
|
}
|
585
|
$out .= '</ul>';
|
586
|
|
587
|
// Representation(-part) specific metadata.
|
588
|
$thumbnailMaxExtend = 100;
|
589
|
$out .= '<table>';
|
590
|
$i = 0;
|
591
|
foreach ($media->representations[$representationIdx]->parts as $part) {
|
592
|
$out .= '<tr><th>' . t('Part') . ' ' . ($i + 1) . '</th><td>';
|
593
|
switch ($part->class) {
|
594
|
case 'ImageFile':
|
595
|
$out .= $part->width . ' x ' . $part->height . ' - ' . $part->size . 'k';
|
596
|
break;
|
597
|
case 'AudioFile':
|
598
|
case 'MovieFile':
|
599
|
$out .= t('Duration') . ': ' . $part->duration . 's - ' . $part->size . 'k';
|
600
|
break;
|
601
|
default:
|
602
|
$out .= $part->size . 'k';
|
603
|
}
|
604
|
|
605
|
$out .= '</td><td><a href="' . url(path_to_media($media->uuid, $mediarepresentation_uuid, $i)) . '">' . theme('cdm_media_gallerie_image', array('mediaRepresentationPart' => $part, 'maxExtend' => $thumbnailMaxExtend, 'addPassePartout' => TRUE));
|
606
|
$i++;
|
607
|
}
|
608
|
$out .= '</table>';
|
609
|
$out .= '</div>';
|
610
|
|
611
|
return $out;
|
612
|
}
|
613
|
|
614
|
/**
|
615
|
* @todo Please document this function.
|
616
|
* @see http://drupal.org/node/1354
|
617
|
*/
|
618
|
function theme_cdm_polytomousKey_page($variables) {
|
619
|
$polytomousKey = $variables['polytomousKey'];
|
620
|
drupal_set_title($polytomousKey->titleCache, PASS_THROUGH);
|
621
|
|
622
|
$out = theme("cdm_IdentificationKey", array(
|
623
|
'identificationKey' => $polytomousKey,
|
624
|
'doLinkToKeyPage' => FALSE,
|
625
|
'showIdentificationKeyTitle' => FALSE,
|
626
|
));
|
627
|
|
628
|
// Key nodes in linked style.
|
629
|
$out .= theme('cdm_polytomousKey', array('polytomousKey' => $polytomousKey));
|
630
|
/*
|
631
|
* FIXME implement node type for keys !!!
|
632
|
* (wrapping the content in the cdm_dataportal.node becomes obsolete then).
|
633
|
*/
|
634
|
return '<div id="identificationKey">' . $out . '</div>';
|
635
|
}
|
636
|
|
637
|
/**
|
638
|
* Returns HTML for taxon page tabs.
|
639
|
*
|
640
|
* Allows theming of the taxon page tabs.
|
641
|
*
|
642
|
* @param array $variables
|
643
|
* An associative array containing:
|
644
|
* - tabname
|
645
|
*
|
646
|
* @ingroup themeable
|
647
|
*/
|
648
|
function theme_cdm_taxonpage_tab($variables) {
|
649
|
$tabname = $variables['tabname'];
|
650
|
// TODO replace by using translations or theme the menue tabs itself instead?
|
651
|
switch ($tabname) {
|
652
|
default:
|
653
|
return t($tabname);
|
654
|
}
|
655
|
}
|