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
|
*
|
15
|
* @param $specimenTypeDesignation
|
16
|
* @return unknown_type
|
17
|
*/
|
18
|
function theme_cdm_specimen($specimenTypeDesignation){
|
19
|
|
20
|
// _add_js_thickbox();
|
21
|
|
22
|
if($specimenTypeDesignation->typeSpecimen){
|
23
|
$derivedUnitFacade = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, $specimenTypeDesignation->typeSpecimen->uuid);
|
24
|
var_dump($derivedUnitFacade);
|
25
|
}
|
26
|
|
27
|
$out = '';
|
28
|
if(isset($specimenTypeDesignation->media[0])){
|
29
|
|
30
|
$image_url = drupal_get_path('module', 'cdm_dataportal').'/images/external_link.gif';
|
31
|
// thickbox has problems reading the first url parameter, so a litte hack is needed here:
|
32
|
// adding a meaningless patameter &tb_hack=1& ....
|
33
|
$out .= ' <a href="#TB_inline?tb_hack=1&width=300&height=330&inlineId=specimen_media_'.$specimenTypeDesignation->uuid.'" class="thickbox">'
|
34
|
.'<img src="'.$image_url.'" title="'.t('Show media').'" /></a>';
|
35
|
|
36
|
$out .= '<div id="specimen_media_'.$specimenTypeDesignation->uuid.'" class="tickbox_content"><table>';
|
37
|
|
38
|
$media_row = '<tr class="media_data">';
|
39
|
$meta_row = '<tr class="meta_data">';
|
40
|
|
41
|
foreach($specimenTypeDesignation->media as $media){
|
42
|
foreach($media->representations as $representation){
|
43
|
|
44
|
//TODO this this is PART 2/2 of a HACK - select preferred representation by mimetype and size
|
45
|
//
|
46
|
if(true || $representation->mimeType == 'image/jpeg'){
|
47
|
foreach($representation->parts as $part){
|
48
|
// get media uri conversion rules if the module is installed and activated
|
49
|
if(module_exists('cdm_mediauri')){
|
50
|
$muris = cdm_mediauri_conversion($part->uri);
|
51
|
}
|
52
|
// --- handle media preview rules
|
53
|
if(isset($muris['preview'])){
|
54
|
|
55
|
$a_child = '<img src="'.$muris['preview']['uri'].'" class="preview" '
|
56
|
.($muris['preview']['size_x'] ? 'width="'.$muris['preview']['size_x'].'"' : '')
|
57
|
.($muris['preview']['size_y'] ? 'width="'.$muris['preview']['size_y'].'"' : '')
|
58
|
.'/>';
|
59
|
} else {
|
60
|
$a_child = '<img src="'.$part->uri.'" />';
|
61
|
}
|
62
|
|
63
|
// --- handle web application rules
|
64
|
$webapp = '';
|
65
|
if(isset($muris['webapp'])){
|
66
|
if($muris['webapp']['embed_html']){
|
67
|
// embed in same page
|
68
|
$webapp = $muris['webapp']['embed_html'];
|
69
|
} else {
|
70
|
$webapp = l(t('web application'), $muris['webapp']['uri']);
|
71
|
}
|
72
|
}
|
73
|
$media_row .= '<td><a href="'.$part->uri.'" target="'.$part->uuid.'">'.$a_child.'</a></td>';
|
74
|
$meta_row .= '<td><span class="label">'.check_plain($specimenTypeDesignation->titleCache).'</span><div class="webapp">'.$webapp.'</div></td>';
|
75
|
} // END parts
|
76
|
//TODO this is PART 2/2 of a hack
|
77
|
break;
|
78
|
} // END representations
|
79
|
} // END media
|
80
|
}
|
81
|
$out .= $media_row.'</tr>';
|
82
|
$out .= $meta_row.'</tr>';
|
83
|
|
84
|
$out .= '</div></table>';
|
85
|
}
|
86
|
return $out;
|
87
|
}
|