Project

General

Profile

Download (17.6 KB) Statistics
| Branch: | Tag: | Revision:
1 6657531f Andreas Kohlbecker
<?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 828a0c8c Andreas Kohlbecker
 * @return string
26
 *  Markup for a taxon page title
27
 *
28 6657531f Andreas Kohlbecker
 * @ingroup themeable
29
 */
30
function theme_cdm_taxon_page_title($variables) {
31
  $taxon = $variables['taxon'];
32
  RenderHints::pushToRenderStack('taxon_page_title');
33
  $referenceUri = '';
34
  $out = '';
35
  if (isset($taxon->name->nomenclaturalReference)) {
36
    $referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
37
  }
38
39 63c3ac73 Andreas Kohlbecker
  $out .= render_taxon_or_name($taxon, NULL, $referenceUri, FALSE);
40 6657531f Andreas Kohlbecker
  RenderHints::popFromRenderStack();
41
42
  return '<span class="' . $taxon->class . '">' . $out . '</span>';
43
}
44
45 216abf0b Patric Plitzner
/**
46
 * Returns HTML for the default title of a specimen page.
47
 *  * The returned title is a the identifier of the specimen.
48
 *
49 961319fe Andreas Kohlbecker
 * @param object $pecimen: The CDM SpecimenOrObeservation instnce
50
 *     being formatted for the title.
51 216abf0b Patric Plitzner
 *
52 828a0c8c Andreas Kohlbecker
 * @return string
53
 *  Markup for the title of a specimen page
54
 *
55 216abf0b Patric Plitzner
 */
56 961319fe Andreas Kohlbecker
function specimen_page_title($specimen)
57 0b4ac33b Patrick Plitzner
{
58 828a0c8c Andreas Kohlbecker
59 216abf0b Patric Plitzner
    RenderHints::pushToRenderStack('specimen_page_title');
60
    $referenceUri = '';
61
    $out = '';
62
63 828a0c8c Andreas Kohlbecker
    $collection = null;
64 a2acff0a Katja Luther
    if (!($specimen->class == 'FieldUnit')) {
65
        if ($specimen->collection) {
66
            if ($specimen->collection->code) {
67
                $collection = $specimen->collection->code;
68
            } elseif ($specimen->collection->name) {
69
                $collection = $specimen->collection->name;
70
            }
71
        }
72
        if ($specimen->accessionNumber) {
73
            $specimenID = $specimen->accessionNumber;
74
        } elseif ($specimen->barcode) {
75
            $specimenID = $specimen->barcode;
76
        } elseif ($specimen->catalogNumber) {
77
            $specimenID = $specimen->catalogNumber;
78
        } elseif ($specimen->titleCache) {
79
            $specimenID = $specimen->titleCache;
80
        }
81
        if (!isset($specimenID) and !isset($collection)) {
82
            $specimenID = $specimen->uuid;
83
        }
84
    }else{
85
        if ($specimen->titleCache) {
86
            $specimenID = $specimen->titleCache;
87
        }
88
        if (!isset($specimenID) and !isset($collection)) {
89
            $specimenID = $specimen->uuid;
90 0b4ac33b Patrick Plitzner
        }
91 907cc9b4 Patrick Plitzner
    }
92
93 a2acff0a Katja Luther
    if ($specimen ->class == 'FieldUnit'){
94 961319fe Andreas Kohlbecker
        $out .= '<span class="type-label">Field unit: </span>';
95 a2acff0a Katja Luther
    }else{
96 961319fe Andreas Kohlbecker
        $out .= '<span class="type-label">Specimen:  </span>';
97 a2acff0a Katja Luther
    }
98 216abf0b Patric Plitzner
99 72d57201 Katja Luther
    if($collection){
100
        $out .= $collection." ";
101
    }
102
    $out .= $specimenID;
103 216abf0b Patric Plitzner
104 72d57201 Katja Luther
    RenderHints::popFromRenderStack();
105
106
    return '<span class="' . $specimen->class . '">' . $out . '</span>';
107
}
108
109
/**
110
 * Returns HTML for the default title of a specimen page.
111
 *  * The returned title is a the identifier of the specimen.
112
 *
113
 * @param array $variables
114
 *   An associative array containing:
115
 *   - specimen: The specimen being formatted for the title.
116
 *
117
 * @return string
118
 *  Markup for the title of a specimen page
119
 *
120
 * @ingroup themeable
121
 */
122
function theme_cdm_specimen_dto_page_title($variables)
123
{
124
125
    $specimen = $variables['specimen'];
126
    RenderHints::pushToRenderStack('specimen_page_title');
127
    $referenceUri = '';
128
    $out = '';
129
130
    $collection = null;
131
    if (!($specimen->class == 'FieldUnit')) {
132
        if ($specimen->collection) {
133
            if ($specimen->collection->code) {
134
                $collection = $specimen->collection->code;
135
            } elseif ($specimen->collection->name) {
136
                $collection = $specimen->collection->name;
137
            }
138
        }
139
        if ($specimen->accessionNumber) {
140
            $specimenID = $specimen->accessionNumber;
141
        } elseif ($specimen->barcode) {
142
            $specimenID = $specimen->barcode;
143
        } elseif ($specimen->catalogNumber) {
144
            $specimenID = $specimen->catalogNumber;
145
        } elseif ($specimen->titleCache) {
146
            $specimenID = $specimen->titleCache;
147
        }
148
        if (!isset($specimenID) and !isset($collection)) {
149
            $specimenID = $specimen->uuid;
150
        }
151
    }else{
152
        if ($specimen->titleCache) {
153
            $specimenID = $specimen->titleCache;
154
        }
155
        if (!isset($specimenID) and !isset($collection)) {
156
            $specimenID = $specimen->uuid;
157
        }
158
    }
159
160
    if ($specimen ->class == 'FieldUnit'){
161
        $out .= "FieldUnit ";
162
    }else{
163
        $out .= "Specimen ";
164
    }
165
166
    if($collection){
167
        $out .= $collection." ";
168
    }
169
    $out .= $specimenID;
170
171
    RenderHints::popFromRenderStack();
172 216abf0b Patric Plitzner
173 72d57201 Katja Luther
    return '<span class="' . $specimen->class . '">' . $out . '</span>';
174 216abf0b Patric Plitzner
}
175
176 6657531f Andreas Kohlbecker
/**
177
 * Returns HTML for the default title for a name page.
178
 *
179
 * The returned title is a formatted name.
180
 *
181
 * @param array $variables
182
 *   An associative array containing:
183
 *   - taxon_name: The taxon name object.
184
 *
185 828a0c8c Andreas Kohlbecker
 * @return string
186
 *  Markup for the title of a name page
187
 *
188 6657531f Andreas Kohlbecker
 * @ingroup themeable
189
 */
190
function theme_cdm_name_page_title($variables) {
191
  $taxon_name = $variables['taxon_name'];
192 a7560a18 Andreas Kohlbecker
  RenderHints::pushToRenderStack('name_page_title');
193 d0d068e9 Andreas Kohlbecker
194
  $referenceUri = NULL;
195 6657531f Andreas Kohlbecker
  if (isset($taxon_name->nomenclaturalReference)) {
196
    $referenceUri = url(path_to_reference($taxon_name->nomenclaturalReference->uuid));
197
  }
198
199 d64f1d61 Andreas Kohlbecker
  $out = '<span class="' . html_class_attribute_ref($taxon_name) . '">'
200 c8c879d8 Andreas Kohlbecker
    . render_taxon_or_name($taxon_name, NULL, $referenceUri, FALSE)
201
    . '</span>';
202 6657531f Andreas Kohlbecker
  RenderHints::popFromRenderStack();
203
  return $out;
204
}
205
206
207 0e0c8c01 Andreas Kohlbecker
208
/**
209
 * Returns HTML for the given result page including a pager.
210
 *
211
 * @param array $variables
212
 *   An associative array containing:
213
 *   - pager: The cdmlib pager object containing the result set of cdm base
214
 *     objects (currently this function can only handle taxon instances =>
215
 *     TODO)
216
 *   - path: The target path for the pager links, this will usually point to
217
 *     'cdm_dataportal/search/results/taxon'
218
 *
219 828a0c8c Andreas Kohlbecker
 * @return string
220
 *  Markup for the result page
221
 *
222
 * @throws Exception
223
 *
224 0e0c8c01 Andreas Kohlbecker
 * @ingroup themeable
225
 */
226 0a1dc066 Andreas Kohlbecker
function theme_cdm_search_taxa_results($variables)
227 1d69a96c Andreas Kohlbecker
{
228 0e0c8c01 Andreas Kohlbecker
  $pager = $variables['pager'];
229 34dd7be9 Andreas Kohlbecker
  $path = $variables['path'];
230 0e0c8c01 Andreas Kohlbecker
231 34dd7be9 Andreas Kohlbecker
  $freetextSearchResults = array();
232 0e0c8c01 Andreas Kohlbecker
233
  // If the pager contains records of SearchResults, extract the taxa and use
234
  // them as records instead.
235
  if (isset($pager->records[0]) && $pager->records[0]->class == "SearchResult") {
236
    $freetextSearchResults = $pager->records;
237
    $taxa = array();
238
    // $highlightedFragments = array();
239
    foreach ($pager->records as $searchResult) {
240
      $taxa[] = &$searchResult->entity;
241
      /*
242
       if(!isset($searchResult->fieldHighlightMap)){
243
      $searchResult->fieldHighlightMap = NULL;
244
      }
245
      $fragmentHighlighting[] = $searchResult->fieldHighlightMap;
246
      */
247
    }
248
    $pager->records = $taxa;
249
  }
250
251 1d69a96c Andreas Kohlbecker
252 0e0c8c01 Andreas Kohlbecker
  // Add thumbnails checkbox and refine search link.
253
  $out = '<div class="page_options">';
254
  if (isset($_REQUEST['ws'])) {
255
    if (cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) {
256
      $out .= '<div id="backButton">' . l(t('Modify search'), cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) . '</div>';
257
    }
258
  }
259 1d69a96c Andreas Kohlbecker
  if (variable_get(SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX, SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX_DEFAULT)) {
260 c278f2a0 Andreas Kohlbecker
    $out .= '<form name="pageoptions"><div id="showThumbnails"><input class="showThumbnails" type="checkbox" name="showThumbnails" ' . (do_showThumbnails() == 1 ? 'checked="checked"' : '') . '> ' . t('Display image thumbnails') . '</div></form>';
261 1d69a96c Andreas Kohlbecker
  }
262 61b6ee11 Andreas Kohlbecker
  $out .= '</div>';
263 f56b1626 Andreas Kohlbecker
264 61b6ee11 Andreas Kohlbecker
  $classification = cdm_dataportal_searched_in_classification();
265 f56b1626 Andreas Kohlbecker
266 a488aeb6 Andreas Kohlbecker
267
  if (  count(cdm_ws_fetch_all(CDM_WS_PORTAL_TAXONOMY)) > 1 ) { // FIXME use a count REST method for this!!!
268 f56b1626 Andreas Kohlbecker
    $out .= '<div id="search-summary">' . t('results for') . ' ';
269
    if ($classification != NULL) {
270
      $out .=  $classification->titleCache ;
271
    } else {
272
     $out .= t('any classification');
273
    }
274 0e0c8c01 Andreas Kohlbecker
    $out .= ':</div>';
275 61b6ee11 Andreas Kohlbecker
  }
276 0e0c8c01 Andreas Kohlbecker
277
  // List results.
278
  if (isset($pager->records) && count($pager->records) > 0) {
279
    $out .= '<div id="search_results">';
280 01fff74a Andreas Kohlbecker
    $list_of_taxa = compose_list_of_taxa($pager->records, $freetextSearchResults, $classification === NULL);
281
    $out .= drupal_render($list_of_taxa);
282 0e0c8c01 Andreas Kohlbecker
    $out .= '</div>';
283
    $out .= theme('cdm_pager', array(
284
        'pager' => $pager,
285
        'path' => $path,
286
        'parameters' => $_REQUEST,
287
    ));
288
  } else {
289 04f74f8d Andreas Kohlbecker
    $out .= '<h4 class="error">' . t('Sorry, no matching entries found.') . '</h4>';
290 0e0c8c01 Andreas Kohlbecker
  }
291
  return $out;
292
}
293 308b5f90 Andreas Kohlbecker
294
295 6eaec849 Katja Luther
/**
296
 * Returns HTML for the given result page including a pager.
297
 *
298
 * @param array $variables
299
 *   An associative array containing:
300
 *   - pager: TODO
301
 *   - path: The target path for the pager links, this will usually point to
302
 *     'cdm_dataportal/search/results/taxon'
303
 *
304
 * @return string
305
 *  Markup for the result page
306
 *
307
 * @throws Exception
308
 *
309
 * @ingroup themeable
310
 */
311
function theme_cdm_search_specimen_results($variables)
312
{
313
    $pager = $variables['pager'];
314
    $path = $variables['path'];
315
316
317
318
    // Add thumbnails checkbox and refine search link.
319
    $out = '<div class="page_options">';
320
    //if (isset($_REQUEST['ws'])) {
321
     //   if (cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) {
322
     //       $out .= '<div id="backButton">' . l(t('Modify search'), cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) . '</div>';
323
     //   }
324
    //}
325
    if (variable_get(SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX, SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX_DEFAULT)) {
326
        $out .= '<form name="pageoptions"><div id="showThumbnails"><input class="showThumbnails" type="checkbox" name="showThumbnails" ' . (do_showThumbnails() == 1 ? 'checked="checked"' : '') . '> ' . t('Display image thumbnails') . '</div></form>';
327
    }
328
    $out .= '</div>';
329
330
331
332
333
334
335
    // List results.
336
    if (isset($pager->data) ) {
337
        $data = json_decode($pager->data, true);
338
        $out .= '<div id="search_results">';
339
        $list_of_result = compose_table_of_blast_result($data);
340
        $out .= $list_of_result;
341
        $out .= '</div>';
342
       // $out .= theme('cdm_pager', array(
343
       //     'pager' => $pager,
344
       //     'path' => $path,
345
       //     'parameters' => $_REQUEST,
346
        //));
347
    } else {
348
        $out .= '<h4 class="error">' . t('Sorry, no matching entries found.') . '</h4>';
349
    }
350
    return $out;
351
}
352
353
354 6657531f Andreas Kohlbecker
/**
355
 * TODO Implementation of Hook taxon_image_gallery()
356
 *
357 828a0c8c Andreas Kohlbecker
 * @param object $taxon
358
 * @param object $media
359 6657531f Andreas Kohlbecker
 *
360 828a0c8c Andreas Kohlbecker
 * @return string
361
 *  Markup for the default media gallery
362 6657531f Andreas Kohlbecker
 */
363
function taxon_image_gallery_default($taxon, $media) {
364
  $hasImages = isset($media[0]);
365
366
  if ($hasImages) {
367
368
    $maxExtend = 150;
369
    $cols = 3;
370
    $maxRows = FALSE;
371
    $alternativeMediaUri = NULL;
372
    /* Comment @WA: was in D5:
373
    $captionElements = array(
374
      'title',
375
      'rights',
376 7afb5232 Andreas Kohlbecker
      '#uri' => t('Open Image'),
377 6657531f Andreas Kohlbecker
    );
378
    */
379
    $captionElements = array(
380
      'title',
381
      'description',
382
      'artist',
383
      'location',
384
      'rights',
385 7afb5232 Andreas Kohlbecker
      '#uri' => t('Open image'),
386 6657531f Andreas Kohlbecker
    );
387
    $gallery_name = $taxon->uuid;
388
    $mediaLinkType = 'LIGHTBOX';
389
390
    // $gallery_settings = getGallerySettings(CDM_DATAPORTAL_MEDIA_GALLERY_NAME);
391
392
    $gallery_settings = getGallerySettings(CDM_DATAPORTAL_TAXON_MEDIA_GALLERY_NAME_TAB);
393
394
    $out = '<div class="image-gallerie">';
395 a9815578 Andreas Kohlbecker
    $out .= compose_cdm_media_gallerie(array(
396 6657531f Andreas Kohlbecker
      'mediaList' => $media,
397
      'galleryName' => $gallery_name,
398
      'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],
399
      'cols' => $gallery_settings['cdm_dataportal_media_cols'],
400
      'maxRows' => 0, // Ignore maxrows settings.
401
      'captionElements' => $captionElements,
402
      'mediaLinkType' => $mediaLinkType,
403
      'alternativeMediaUri' => NULL,
404
      'galleryLinkUri' => NULL,
405
      'showCaption' => $gallery_settings['cdm_dataportal_show_thumbnail_captions'],
406
    ));
407
    $out .= '</div>';
408
  }
409
  else {
410
    $out = 'No images available.';
411
  }
412
  return $out;
413
}
414
415
/**
416
 * TODO Implementation of Hook taxon_image_gallery()
417
 *
418 828a0c8c Andreas Kohlbecker
 * @param object $taxon
419
 * @param object $media
420
 *
421
 * @return string
422
 *  Markup for the fsi media gallery
423 6657531f Andreas Kohlbecker
 *
424 828a0c8c Andreas Kohlbecker
 * @throws Exception
425 6657531f Andreas Kohlbecker
 */
426
function taxon_image_gallery_fsi($taxon, $media) {
427
  $flashLink = isset($media[0]);
428
429
  if ($flashLink) {
430
431
    if (module_exists("fsi_gallery")) {
432
      $out = theme("fsi_gallery", array('taxon' => $taxon, 'media' => $media));
433
    }
434
    else {
435
      $message = t('In order to use the FSI gallery you must enable the according ') . l(t("module"), "admin/modules");
436
      drupal_set_message($message, "error");
437
      $out = '<h3>' . $message . '</h3>';
438
    }
439
  }
440
  else {
441
    $out = 'No images available.';
442
  }
443
  return $out;
444
}
445
446
447
/**
448
 * @todo Please document this function.
449
 * @see http://drupal.org/node/1354
450
 */
451
function theme_cdm_media_page($variables) {
452 a867b774 Andreas Kohlbecker
453 6657531f Andreas Kohlbecker
  $media = $variables['media'];
454
  $mediarepresentation_uuid = $variables['mediarepresentation_uuid'];
455
  $partId = $variables['partId'];
456
  $out = '';
457 4fa6f9ba Andreas Kohlbecker
458
  // Determine which representation and which part to show
459 4946eebf Andreas Kohlbecker
  $active_representation_index = 0;
460 4fa6f9ba Andreas Kohlbecker
461
  if (!$mediarepresentation_uuid) {
462 4946eebf Andreas Kohlbecker
    // no representation requested by the method parameters, find the best one
463 4fa6f9ba Andreas Kohlbecker
    $representations = cdm_preferred_media_representations($media, array('image/png', 'image/jpeg', 'image/gif'), null, null);
464 4946eebf Andreas Kohlbecker
    if($representations  && count($representations) > 0){
465
      $preferred_representation = array_shift($representations);
466
      $mediarepresentation_uuid = $preferred_representation->uuid;
467
    }
468 4fa6f9ba Andreas Kohlbecker
  }
469
470 4946eebf Andreas Kohlbecker
  if($mediarepresentation_uuid){
471
    foreach ($media->representations as $representation) {
472
      if ($representation->uuid == $mediarepresentation_uuid) {
473
        break;
474
      }
475
      $active_representation_index++;
476 6657531f Andreas Kohlbecker
    }
477
  }
478
479 4fa6f9ba Andreas Kohlbecker
480 4946eebf Andreas Kohlbecker
  $active_part_index = 0;
481
  if (is_uuid($partId)) {
482
    foreach ($media->representations[$active_representation_index]->parts as $part) {
483 6657531f Andreas Kohlbecker
      if ($part->uuid == $partId) {
484 4946eebf Andreas Kohlbecker
        break;
485 6657531f Andreas Kohlbecker
      }
486 4946eebf Andreas Kohlbecker
      $active_part_index++;
487 6657531f Andreas Kohlbecker
    }
488
  }
489 4946eebf Andreas Kohlbecker
  else if(is_numeric($partId)){
490
    $active_part_index = $partId;
491 6657531f Andreas Kohlbecker
  }
492
493 97ff635c Andreas Kohlbecker
  $media_metadata = read_media_metadata($media);
494 50d9206b Andreas Kohlbecker
  $title = 'Media';
495
  if($media_metadata['title']){
496
    $title .= ' ' .$media_metadata['title'];
497
  } else if(isset($media_metadata['filename'])){
498
    $title .= ' (' .$media_metadata['filename'] .')';
499
  }
500 6657531f Andreas Kohlbecker
501
  $imageMaxExtend = variable_get('image-page-maxextend', 400);
502
503
  drupal_set_title($title, PASS_THROUGH);
504
505
  $out .= '<div class="media cdm_media_viewer_image">';
506
507 3e2af8c2 Andreas Kohlbecker
  if(preg_match('/cdm_dataportal\/taxon\//', $_SERVER['HTTP_REFERER']) ){
508 78bac306 Andreas Kohlbecker
    if(variable_get('cdm_dataportal_taxonpage_tabs', 1)){
509
      // taxon page with tabs
510
      $out .= '<div id="backToGalleryButton">' . l(t('Back to images'), $_SESSION['cdm']['last_gallery']) . '</div>';
511
    } else {
512
      // tabless mode
513
      $out .= '<div id="backToGalleryButton">' . l(t('Back to taxon page'), $_SESSION['cdm']['last_gallery']) . '</div>';
514
    }
515 3e2af8c2 Andreas Kohlbecker
  }
516 6657531f Andreas Kohlbecker
  $out .= '<div class="viewer">';
517 4946eebf Andreas Kohlbecker
  $out .= cdm_openlayers_image($media->representations[$active_representation_index]->parts[$active_part_index], $imageMaxExtend);
518 6657531f Andreas Kohlbecker
  $out .= '</div>';
519
520
  // General media metadata.
521 f79d32d6 Andreas Kohlbecker
  $metadataToPrint = theme('cdm_media_caption', array('media' => $media, 'sources_as_content' => true));
522 6657531f Andreas Kohlbecker
  $out .= $metadataToPrint;
523
524 63d5030d Andreas Kohlbecker
  $cdm_standard_image_viewer_settings = get_array_variable_merged(CDM_STANDARD_IMAGE_VIEWER, CDM_STANDARD_IMAGE_VIEWER_DEFAULT);
525
  if ($cdm_standard_image_viewer_settings['media_representation_details_enabled'] == 1){
526
    // Tabs for the different representations.
527
    // Representation(-part) specific metadata.
528
    $thumbnailMaxExtend = 100;
529
    $out .= '<h3>' .t('Media representations') .'</h3><ul id="media-representations">';
530
    $r_i = 0;
531
    foreach ($media->representations as $representation) {
532
      $out .= '<li><strong>'. t('Representation') . ' ' . $r_i . "</strong> ($representation->mimeType)" ;
533
      // parts
534
      $active_part_index = 0;
535
      $table_class_attribute = '';
536
      if($partIdx == $active_part_index && $active_representation_index == $r_i ){
537
        $table_class_attribute = 'class="active"';
538 a867b774 Andreas Kohlbecker
      }
539 63d5030d Andreas Kohlbecker
      $out .= "<table $table_class_attribute>";
540
      foreach ($representation->parts as $part) {
541
        $out .= '<tr><th>' . t('Part') . ' ' . ($active_part_index + 1) . '</th></tr><tr><td>';
542
        switch ($part->class) {
543
          case 'ImageFile':
544
            $out .= $part->width . 'x' . $part->height . ' px - ' . $part->size . ' kB';
545
            break;
546
          case 'AudioFile':
547
          case 'MovieFile':
548
            $out .= t('Duration') . ': ' . $part->duration . 's - ' . $part->size . ' kB';
549
            break;
550
          default:
551
            $out .= $part->size . 'k';
552
        }
553 6657531f Andreas Kohlbecker
554 63d5030d Andreas Kohlbecker
        $out .= '</td><td><a href="' . url(path_to_media($media->uuid, $representation->uuid, $active_part_index)) . '">'
555
          . cdm_media_gallerie_image($part, $thumbnailMaxExtend, TRUE);
556
        $active_part_index++;
557
      }
558
      $out .= '</table>';
559
      $out .=  '</li>';
560
      $r_i++;
561 a867b774 Andreas Kohlbecker
    }
562 63d5030d Andreas Kohlbecker
    $out .= '</ul>';
563 6657531f Andreas Kohlbecker
  }
564
565 a867b774 Andreas Kohlbecker
  $out .= '</div>';
566 6657531f Andreas Kohlbecker
  return $out;
567
}
568
569
/**
570
 * @todo Please document this function.
571
 * @see http://drupal.org/node/1354
572
 */
573
function theme_cdm_polytomousKey_page($variables) {
574
  $polytomousKey = $variables['polytomousKey'];
575
  drupal_set_title($polytomousKey->titleCache, PASS_THROUGH);
576
577
  $out = theme("cdm_IdentificationKey", array(
578
    'identificationKey' => $polytomousKey,
579
    'doLinkToKeyPage' => FALSE,
580
    'showIdentificationKeyTitle' => FALSE,
581
    ));
582
583
  // Key nodes in linked style.
584
  $out .= theme('cdm_polytomousKey', array('polytomousKey' => $polytomousKey));
585
  /*
586 29809fe3 Andreas Kohlbecker
   * FIXME implement node type for keys !!!
587
   * (wrapping the content in the cdm_dataportal.node becomes obsolete then).
588
   */
589
  return '<div id="identificationKey">' . $out . '</div>';
590 4feeabc7 Andreas Kohlbecker
}