Revision b517c9e7
Added by Andreas Kohlbecker almost 6 years ago
modules/cdm_dataportal/theme/cdm_dataportal.occurrence.theme | ||
---|---|---|
13 | 13 |
* @see http://www.mozilla.org/MPL/MPL-1.1.html |
14 | 14 |
*/ |
15 | 15 |
|
16 |
/** |
|
17 |
* Returns HTML for a specimen. |
|
18 |
* |
|
19 |
* @param array $variables |
|
20 |
* An associative array containing: |
|
21 |
* - specimenTypeDesignation: Object. |
|
22 |
* |
|
23 |
* @ingroup themeable |
|
24 |
* |
|
25 |
* TODO: this function is not being used at all - can we remove it? (a.kohlbecker 6.2.2013) |
|
26 |
*/ |
|
27 |
function theme_cdm_specimen($variables) { |
|
28 |
$specimenTypeDesignation = $variables['specimenTypeDesignation']; |
|
29 |
|
|
30 |
// _add_js_thickbox(); |
|
31 |
if (isset($specimenTypeDesignation->typeSpecimen)) { |
|
32 |
$derivedUnitFacade = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, $specimenTypeDesignation->typeSpecimen->uuid); |
|
33 |
} |
|
34 |
|
|
35 |
$out = ''; |
|
36 |
if (isset($specimenTypeDesignation->media[0])) { |
|
37 |
|
|
38 |
$image_url = base_path() . drupal_get_path('module', 'cdm_dataportal') . '/images/external_link.gif'; |
|
39 |
// Thickbox has problems reading the first url parameter, so a litte hack is |
|
40 |
// needed here: |
|
41 |
// Adding a meaningless parameter &tb_hack=1& .... |
|
42 |
$out .= ' <a href="#TB_inline?tb_hack=1&width=300&height=330&inlineId=specimen_media_' . $specimenTypeDesignation->uuid . '" class="thickbox">' . '<img src="' . $image_url . '" title="' . t('Show media') . '" /></a>'; |
|
43 |
|
|
44 |
$out .= '<div id="specimen_media_' . $specimenTypeDesignation->uuid . '" class="tickbox_content"><table>'; |
|
45 |
|
|
46 |
$media_row = '<tr class="media_data">'; |
|
47 |
$meta_row = '<tr class="meta_data">'; |
|
48 |
|
|
49 |
foreach ($specimenTypeDesignation->media as $media) { |
|
50 |
foreach ($media->representations as $representation) { |
|
51 |
|
|
52 |
// TODO this this is PART 2/2 of a HACK - select preferred |
|
53 |
// representation by mimetype and size. |
|
54 |
if (TRUE || $representation->mimeType == 'image/jpeg') { |
|
55 |
foreach ($representation->parts as $part) { |
|
56 |
// Get media uri conversion rules if the module is installed and |
|
57 |
// activated. |
|
58 |
if (module_exists('cdm_mediauri')) { |
|
59 |
$muris = cdm_mediauri_conversion($part->uri); |
|
60 |
} |
|
61 |
// --- Handle media preview rules. |
|
62 |
if (isset($muris['preview'])) { |
|
63 |
|
|
64 |
$a_child = '<img src="' . $muris['preview']['uri'] . '" class="preview" ' . ($muris['preview']['size_x'] ? 'width="' . $muris['preview']['size_x'] . '"' : '') . ($muris['preview']['size_y'] ? 'width="' . $muris['preview']['size_y'] . '"' : '') . '/>'; |
|
65 |
} |
|
66 |
else { |
|
67 |
$a_child = '<img src="' . $part->uri . '" />'; |
|
68 |
} |
|
69 |
|
|
70 |
// --- Handle web application rules. |
|
71 |
$webapp = ''; |
|
72 |
if (isset($muris['webapp'])) { |
|
73 |
if ($muris['webapp']['embed_html']) { |
|
74 |
// Embed in same page. |
|
75 |
$webapp = $muris['webapp']['embed_html']; |
|
76 |
} |
|
77 |
else { |
|
78 |
$webapp = l(t('web application'), $muris['webapp']['uri']); |
|
79 |
} |
|
80 |
} |
|
81 |
$media_row .= '<td><a href="' . $part->uri . '" target="' . $part->uuid . '">' . $a_child . '</a></td>'; |
|
82 |
$meta_row .= '<td><span class="label">' . check_plain($specimenTypeDesignation->titleCache) . '</span><div class="webapp">' . $webapp . '</div></td>'; |
|
83 |
} // END parts. |
|
84 |
// TODO this is PART 2/2 of a hack. |
|
85 |
break; |
|
86 |
} // END representations. |
|
87 |
} // END media. |
|
88 |
} |
|
89 |
$out .= $media_row . '</tr>'; |
|
90 |
$out .= $meta_row . '</tr>'; |
|
91 |
|
|
92 |
$out .= '</div></table>'; |
|
93 |
} |
|
94 |
return $out; |
|
95 |
} |
|
96 |
|
|
97 |
|
|
98 | 16 |
/** |
99 | 17 |
* |
100 | 18 |
* @param string $field |
Also available in: Unified diff
removing useless theme mehod theme_cdm_specimen()