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 |
|
|
* @param array $variables
|
50 |
|
|
* An associative array containing:
|
51 |
|
|
* - specimen: The specimen being formatted for the title.
|
52 |
|
|
*
|
53 |
828a0c8c
|
Andreas Kohlbecker
|
* @return string
|
54 |
|
|
* Markup for the title of a specimen page
|
55 |
|
|
*
|
56 |
216abf0b
|
Patric Plitzner
|
* @ingroup themeable
|
57 |
|
|
*/
|
58 |
0b4ac33b
|
Patrick Plitzner
|
function theme_cdm_specimen_page_title($variables)
|
59 |
|
|
{
|
60 |
828a0c8c
|
Andreas Kohlbecker
|
|
61 |
216abf0b
|
Patric Plitzner
|
$specimen = $variables['specimen'];
|
62 |
|
|
RenderHints::pushToRenderStack('specimen_page_title');
|
63 |
|
|
$referenceUri = '';
|
64 |
|
|
$out = '';
|
65 |
|
|
|
66 |
828a0c8c
|
Andreas Kohlbecker
|
$collection = null;
|
67 |
a2acff0a
|
Katja Luther
|
if (!($specimen->class == 'FieldUnit')) {
|
68 |
|
|
if ($specimen->collection) {
|
69 |
|
|
if ($specimen->collection->code) {
|
70 |
|
|
$collection = $specimen->collection->code;
|
71 |
|
|
} elseif ($specimen->collection->name) {
|
72 |
|
|
$collection = $specimen->collection->name;
|
73 |
|
|
}
|
74 |
|
|
}
|
75 |
|
|
if ($specimen->accessionNumber) {
|
76 |
|
|
$specimenID = $specimen->accessionNumber;
|
77 |
|
|
} elseif ($specimen->barcode) {
|
78 |
|
|
$specimenID = $specimen->barcode;
|
79 |
|
|
} elseif ($specimen->catalogNumber) {
|
80 |
|
|
$specimenID = $specimen->catalogNumber;
|
81 |
|
|
} elseif ($specimen->titleCache) {
|
82 |
|
|
$specimenID = $specimen->titleCache;
|
83 |
|
|
}
|
84 |
|
|
if (!isset($specimenID) and !isset($collection)) {
|
85 |
|
|
$specimenID = $specimen->uuid;
|
86 |
|
|
}
|
87 |
|
|
}else{
|
88 |
|
|
if ($specimen->titleCache) {
|
89 |
|
|
$specimenID = $specimen->titleCache;
|
90 |
|
|
}
|
91 |
|
|
if (!isset($specimenID) and !isset($collection)) {
|
92 |
|
|
$specimenID = $specimen->uuid;
|
93 |
0b4ac33b
|
Patrick Plitzner
|
}
|
94 |
907cc9b4
|
Patrick Plitzner
|
}
|
95 |
|
|
|
96 |
a2acff0a
|
Katja Luther
|
if ($specimen ->class == 'FieldUnit'){
|
97 |
|
|
$out .= "FieldUnit ";
|
98 |
|
|
}else{
|
99 |
|
|
$out .= "Specimen ";
|
100 |
|
|
}
|
101 |
216abf0b
|
Patric Plitzner
|
|
102 |
907cc9b4
|
Patrick Plitzner
|
if($collection){
|
103 |
|
|
$out .= $collection." ";
|
104 |
|
|
}
|
105 |
|
|
$out .= $specimenID;
|
106 |
216abf0b
|
Patric Plitzner
|
|
107 |
|
|
RenderHints::popFromRenderStack();
|
108 |
|
|
|
109 |
|
|
return '<span class="' . $specimen->class . '">' . $out . '</span>';
|
110 |
|
|
}
|
111 |
|
|
|
112 |
6657531f
|
Andreas Kohlbecker
|
/**
|
113 |
|
|
* Returns HTML for the default title for a name page.
|
114 |
|
|
*
|
115 |
|
|
* The returned title is a formatted name.
|
116 |
|
|
*
|
117 |
|
|
* @param array $variables
|
118 |
|
|
* An associative array containing:
|
119 |
|
|
* - taxon_name: The taxon name object.
|
120 |
|
|
*
|
121 |
828a0c8c
|
Andreas Kohlbecker
|
* @return string
|
122 |
|
|
* Markup for the title of a name page
|
123 |
|
|
*
|
124 |
6657531f
|
Andreas Kohlbecker
|
* @ingroup themeable
|
125 |
|
|
*/
|
126 |
|
|
function theme_cdm_name_page_title($variables) {
|
127 |
|
|
$taxon_name = $variables['taxon_name'];
|
128 |
|
|
RenderHints::pushToRenderStack('taxon_page_title');
|
129 |
d0d068e9
|
Andreas Kohlbecker
|
|
130 |
|
|
$referenceUri = NULL;
|
131 |
6657531f
|
Andreas Kohlbecker
|
if (isset($taxon_name->nomenclaturalReference)) {
|
132 |
|
|
$referenceUri = url(path_to_reference($taxon_name->nomenclaturalReference->uuid));
|
133 |
|
|
}
|
134 |
|
|
|
135 |
c8c879d8
|
Andreas Kohlbecker
|
$out = '<span class="' . $taxon_name->class . '">'
|
136 |
|
|
. render_taxon_or_name($taxon_name, NULL, $referenceUri, FALSE)
|
137 |
|
|
. '</span>';
|
138 |
6657531f
|
Andreas Kohlbecker
|
RenderHints::popFromRenderStack();
|
139 |
|
|
return $out;
|
140 |
|
|
}
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
/**
|
144 |
|
|
* Returns HTML containing the synonymy for the accepted taxon.
|
145 |
|
|
*
|
146 |
|
|
* Shows the whole synonymy for the accepted taxon.
|
147 |
|
|
* The synonymy list is headed by the complete scientific name
|
148 |
|
|
* of the accepted taxon with nomenclatural reference.
|
149 |
|
|
*
|
150 |
1cda248c
|
Andreas Kohlbecker
|
* @param object $taxon
|
151 |
|
|
* @param boolean $add_accepted_taxon
|
152 |
6657531f
|
Andreas Kohlbecker
|
*
|
153 |
1cda248c
|
Andreas Kohlbecker
|
* @return array
|
154 |
|
|
* Drupal render array for the synonymy
|
155 |
828a0c8c
|
Andreas Kohlbecker
|
*
|
156 |
|
|
* @throws Exception
|
157 |
|
|
*
|
158 |
1cda248c
|
Andreas Kohlbecker
|
* @ingroup compose
|
159 |
6657531f
|
Andreas Kohlbecker
|
*/
|
160 |
1cda248c
|
Andreas Kohlbecker
|
function compose_cdm_taxon_page_synonymy($taxon, $add_accepted_taxon) {
|
161 |
15b7c460
|
Andreas Kohlbecker
|
|
162 |
6657531f
|
Andreas Kohlbecker
|
RenderHints::pushToRenderStack('taxon_page_synonymy');
|
163 |
15b7c460
|
Andreas Kohlbecker
|
|
164 |
|
|
// footnote key for the homotypic group and accepted taxon,
|
165 |
|
|
// both should have the same footnote key
|
166 |
|
|
RenderHints::setFootnoteListKey(RenderHints::getRenderPath());
|
167 |
|
|
|
168 |
7635cc7d
|
Andreas Kohlbecker
|
$synomymie = cdm_ws_get(CDM_WS_PORTAL_TAXON_SYNONYMY, array($taxon->uuid));
|
169 |
176a8641
|
Andreas Kohlbecker
|
|
170 |
6657531f
|
Andreas Kohlbecker
|
$out = '';
|
171 |
|
|
|
172 |
|
|
// Render accepted taxon.
|
173 |
15b7c460
|
Andreas Kohlbecker
|
//
|
174 |
|
|
// foonotes of the accepted taxon will be rendered in the homotypic group section
|
175 |
|
|
// even if there are not synonyms in the homotypic group
|
176 |
|
|
// homotypic group and accepted taxon should have the same footnote key
|
177 |
6657531f
|
Andreas Kohlbecker
|
$referenceUri = '';
|
178 |
1cda248c
|
Andreas Kohlbecker
|
if ($add_accepted_taxon) {
|
179 |
b3a806e8
|
Andreas Kohlbecker
|
// remember the last part of the render path
|
180 |
|
|
$synonymy_render_path = RenderHints::getRenderPath();
|
181 |
|
|
// set new render path for the accepted taxon so
|
182 |
|
|
// it can be styled differently via the name render part definitions
|
183 |
|
|
RenderHints::pushToRenderStack('accepted_taxon');
|
184 |
1cda248c
|
Andreas Kohlbecker
|
$accepted_name = '';
|
185 |
|
|
if (variable_get(CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE, 0)) {
|
186 |
|
|
$label = variable_get(CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL, CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL_DEFAULT);
|
187 |
|
|
$accepted_name .= '<div class="secReference"><span class="label">' . t($label) . ':</span> ' . $taxon->sec->titleCache . '</div>';
|
188 |
|
|
}
|
189 |
6657531f
|
Andreas Kohlbecker
|
if (isset($taxon->name->nomenclaturalReference)) {
|
190 |
|
|
$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
|
191 |
|
|
}
|
192 |
|
|
|
193 |
1cda248c
|
Andreas Kohlbecker
|
$accepted_name .= '<div class="accepted-name">';
|
194 |
63c3ac73
|
Andreas Kohlbecker
|
$accepted_name .= render_taxon_or_name($taxon, NULL, $referenceUri);
|
195 |
6657531f
|
Andreas Kohlbecker
|
|
196 |
d4ea0dd9
|
Andreas Kohlbecker
|
$name_relations = cdm_name_relationships_for_taxon($taxon);
|
197 |
3c088da3
|
Andreas Kohlbecker
|
$name_relationships = render_name_relationships_of($name_relations, $taxon->name->uuid, $taxon->uuid);
|
198 |
510d3be7
|
Andreas Kohlbecker
|
// Render relationships of accepted name.
|
199 |
|
|
if($name_relationships){
|
200 |
|
|
|
201 |
|
|
$accepted_name .= ' <span class="name_relationships">' . $name_relationships . '</span>';
|
202 |
|
|
}
|
203 |
|
|
|
204 |
|
|
// handle annotations of the name and taxon
|
205 |
6657531f
|
Andreas Kohlbecker
|
$special_annotations_array = array();
|
206 |
|
|
$special_annotations_array[] = $taxon->name;
|
207 |
|
|
$special_annotations_array[] = $taxon;
|
208 |
15b7c460
|
Andreas Kohlbecker
|
$accepted_name .= theme('cdm_annotations_as_footnotekeys', array(
|
209 |
34dd7be9
|
Andreas Kohlbecker
|
'cdmBase_list' => $special_annotations_array,
|
210 |
b3a806e8
|
Andreas Kohlbecker
|
'footnote_list_key' => $synonymy_render_path . '-annotations')
|
211 |
34dd7be9
|
Andreas Kohlbecker
|
);
|
212 |
0e0c8c01
|
Andreas Kohlbecker
|
$accepted_name .= '</div>';
|
213 |
b3a806e8
|
Andreas Kohlbecker
|
RenderHints::popFromRenderStack();
|
214 |
6657531f
|
Andreas Kohlbecker
|
}
|
215 |
|
|
|
216 |
bdcb2628
|
Andreas Kohlbecker
|
// --- Render homotypic synonymy group
|
217 |
6657531f
|
Andreas Kohlbecker
|
if (!empty($accepted_name)) {
|
218 |
|
|
$out .= $accepted_name;
|
219 |
|
|
}
|
220 |
|
|
|
221 |
bdcb2628
|
Andreas Kohlbecker
|
// Render the homotypicSynonymyGroup including the type information.
|
222 |
2b7cd6c2
|
Andreas Kohlbecker
|
$out .= theme(
|
223 |
|
|
'cdm_homotypicSynonymyGroup',
|
224 |
|
|
array(
|
225 |
|
|
'synonymList' => $synomymie->homotypicSynonymsByHomotypicGroup,
|
226 |
|
|
'accepted_taxon_name_uuid' => $taxon->name->uuid
|
227 |
|
|
)
|
228 |
|
|
);
|
229 |
c9d996cd
|
Andreas Kohlbecker
|
|
230 |
6657531f
|
Andreas Kohlbecker
|
|
231 |
|
|
// Render accepted taxon heterotypic synonymy groups.
|
232 |
|
|
if ($synomymie->heterotypicSynonymyGroups) {
|
233 |
|
|
foreach ($synomymie->heterotypicSynonymyGroups as $homotypicalGroup) {
|
234 |
|
|
$out .= theme('cdm_heterotypicSynonymyGroup', array('homotypicalGroup' => $homotypicalGroup));
|
235 |
|
|
}
|
236 |
|
|
}
|
237 |
|
|
// Render taxon relationships.
|
238 |
|
|
if (variable_get(CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT)) {
|
239 |
116fb348
|
Andreas Kohlbecker
|
$taxonRelationshipsDTO = cdm_ws_get(CDM_WS_PORTAL_TAXON_RELATIONS_DTO, $taxon->uuid);
|
240 |
|
|
$out .= cdm_taxonRelationships($taxonRelationshipsDTO, $taxon);
|
241 |
6657531f
|
Andreas Kohlbecker
|
}
|
242 |
51b04faf
|
Andreas Kohlbecker
|
|
243 |
6657531f
|
Andreas Kohlbecker
|
RenderHints::popFromRenderStack();
|
244 |
|
|
|
245 |
1cda248c
|
Andreas Kohlbecker
|
return markup_to_render_array($out);
|
246 |
6657531f
|
Andreas Kohlbecker
|
}
|
247 |
|
|
|
248 |
0e0c8c01
|
Andreas Kohlbecker
|
|
249 |
|
|
/**
|
250 |
|
|
* Returns HTML for the given result page including a pager.
|
251 |
|
|
*
|
252 |
|
|
* @param array $variables
|
253 |
|
|
* An associative array containing:
|
254 |
|
|
* - pager: The cdmlib pager object containing the result set of cdm base
|
255 |
|
|
* objects (currently this function can only handle taxon instances =>
|
256 |
|
|
* TODO)
|
257 |
|
|
* - path: The target path for the pager links, this will usually point to
|
258 |
|
|
* 'cdm_dataportal/search/results/taxon'
|
259 |
|
|
*
|
260 |
828a0c8c
|
Andreas Kohlbecker
|
* @return string
|
261 |
|
|
* Markup for the result page
|
262 |
|
|
*
|
263 |
|
|
* @throws Exception
|
264 |
|
|
*
|
265 |
0e0c8c01
|
Andreas Kohlbecker
|
* @ingroup themeable
|
266 |
|
|
*/
|
267 |
0a1dc066
|
Andreas Kohlbecker
|
function theme_cdm_search_taxa_results($variables)
|
268 |
1d69a96c
|
Andreas Kohlbecker
|
{
|
269 |
0e0c8c01
|
Andreas Kohlbecker
|
$pager = $variables['pager'];
|
270 |
34dd7be9
|
Andreas Kohlbecker
|
$path = $variables['path'];
|
271 |
0e0c8c01
|
Andreas Kohlbecker
|
|
272 |
34dd7be9
|
Andreas Kohlbecker
|
$freetextSearchResults = array();
|
273 |
0e0c8c01
|
Andreas Kohlbecker
|
|
274 |
|
|
// If the pager contains records of SearchResults, extract the taxa and use
|
275 |
|
|
// them as records instead.
|
276 |
|
|
if (isset($pager->records[0]) && $pager->records[0]->class == "SearchResult") {
|
277 |
|
|
$freetextSearchResults = $pager->records;
|
278 |
|
|
$taxa = array();
|
279 |
|
|
// $highlightedFragments = array();
|
280 |
|
|
foreach ($pager->records as $searchResult) {
|
281 |
|
|
$taxa[] = &$searchResult->entity;
|
282 |
|
|
/*
|
283 |
|
|
if(!isset($searchResult->fieldHighlightMap)){
|
284 |
|
|
$searchResult->fieldHighlightMap = NULL;
|
285 |
|
|
}
|
286 |
|
|
$fragmentHighlighting[] = $searchResult->fieldHighlightMap;
|
287 |
|
|
*/
|
288 |
|
|
}
|
289 |
|
|
$pager->records = $taxa;
|
290 |
|
|
}
|
291 |
|
|
|
292 |
1d69a96c
|
Andreas Kohlbecker
|
|
293 |
0e0c8c01
|
Andreas Kohlbecker
|
// Add thumbnails checkbox and refine search link.
|
294 |
|
|
$out = '<div class="page_options">';
|
295 |
|
|
if (isset($_REQUEST['ws'])) {
|
296 |
|
|
if (cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) {
|
297 |
|
|
$out .= '<div id="backButton">' . l(t('Modify search'), cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) . '</div>';
|
298 |
|
|
}
|
299 |
|
|
}
|
300 |
1d69a96c
|
Andreas Kohlbecker
|
if (variable_get(SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX, SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX_DEFAULT)) {
|
301 |
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>';
|
302 |
1d69a96c
|
Andreas Kohlbecker
|
}
|
303 |
61b6ee11
|
Andreas Kohlbecker
|
$out .= '</div>';
|
304 |
f56b1626
|
Andreas Kohlbecker
|
|
305 |
61b6ee11
|
Andreas Kohlbecker
|
$classification = cdm_dataportal_searched_in_classification();
|
306 |
f56b1626
|
Andreas Kohlbecker
|
|
307 |
a488aeb6
|
Andreas Kohlbecker
|
|
308 |
|
|
if ( count(cdm_ws_fetch_all(CDM_WS_PORTAL_TAXONOMY)) > 1 ) { // FIXME use a count REST method for this!!!
|
309 |
f56b1626
|
Andreas Kohlbecker
|
$out .= '<div id="search-summary">' . t('results for') . ' ';
|
310 |
|
|
if ($classification != NULL) {
|
311 |
|
|
$out .= $classification->titleCache ;
|
312 |
|
|
} else {
|
313 |
|
|
$out .= t('any classification');
|
314 |
|
|
}
|
315 |
0e0c8c01
|
Andreas Kohlbecker
|
$out .= ':</div>';
|
316 |
61b6ee11
|
Andreas Kohlbecker
|
}
|
317 |
0e0c8c01
|
Andreas Kohlbecker
|
|
318 |
|
|
// List results.
|
319 |
|
|
if (isset($pager->records) && count($pager->records) > 0) {
|
320 |
|
|
$out .= '<div id="search_results">';
|
321 |
01fff74a
|
Andreas Kohlbecker
|
$list_of_taxa = compose_list_of_taxa($pager->records, $freetextSearchResults, $classification === NULL);
|
322 |
|
|
$out .= drupal_render($list_of_taxa);
|
323 |
0e0c8c01
|
Andreas Kohlbecker
|
$out .= '</div>';
|
324 |
|
|
$out .= theme('cdm_pager', array(
|
325 |
|
|
'pager' => $pager,
|
326 |
|
|
'path' => $path,
|
327 |
|
|
'parameters' => $_REQUEST,
|
328 |
|
|
));
|
329 |
|
|
} else {
|
330 |
04f74f8d
|
Andreas Kohlbecker
|
$out .= '<h4 class="error">' . t('Sorry, no matching entries found.') . '</h4>';
|
331 |
0e0c8c01
|
Andreas Kohlbecker
|
}
|
332 |
|
|
return $out;
|
333 |
|
|
}
|
334 |
308b5f90
|
Andreas Kohlbecker
|
|
335 |
|
|
|
336 |
6eaec849
|
Katja Luther
|
/**
|
337 |
|
|
* Returns HTML for the given result page including a pager.
|
338 |
|
|
*
|
339 |
|
|
* @param array $variables
|
340 |
|
|
* An associative array containing:
|
341 |
|
|
* - pager: TODO
|
342 |
|
|
* - path: The target path for the pager links, this will usually point to
|
343 |
|
|
* 'cdm_dataportal/search/results/taxon'
|
344 |
|
|
*
|
345 |
|
|
* @return string
|
346 |
|
|
* Markup for the result page
|
347 |
|
|
*
|
348 |
|
|
* @throws Exception
|
349 |
|
|
*
|
350 |
|
|
* @ingroup themeable
|
351 |
|
|
*/
|
352 |
|
|
function theme_cdm_search_specimen_results($variables)
|
353 |
|
|
{
|
354 |
|
|
$pager = $variables['pager'];
|
355 |
|
|
$path = $variables['path'];
|
356 |
|
|
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
// Add thumbnails checkbox and refine search link.
|
360 |
|
|
$out = '<div class="page_options">';
|
361 |
|
|
//if (isset($_REQUEST['ws'])) {
|
362 |
|
|
// if (cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) {
|
363 |
|
|
// $out .= '<div id="backButton">' . l(t('Modify search'), cdm_dataportal_search_form_path_for_ws($_REQUEST['ws'])) . '</div>';
|
364 |
|
|
// }
|
365 |
|
|
//}
|
366 |
|
|
if (variable_get(SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX, SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX_DEFAULT)) {
|
367 |
|
|
$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>';
|
368 |
|
|
}
|
369 |
|
|
$out .= '</div>';
|
370 |
|
|
|
371 |
|
|
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
|
376 |
|
|
// List results.
|
377 |
|
|
if (isset($pager->data) ) {
|
378 |
|
|
$data = json_decode($pager->data, true);
|
379 |
|
|
$out .= '<div id="search_results">';
|
380 |
|
|
$list_of_result = compose_table_of_blast_result($data);
|
381 |
|
|
$out .= $list_of_result;
|
382 |
|
|
$out .= '</div>';
|
383 |
|
|
// $out .= theme('cdm_pager', array(
|
384 |
|
|
// 'pager' => $pager,
|
385 |
|
|
// 'path' => $path,
|
386 |
|
|
// 'parameters' => $_REQUEST,
|
387 |
|
|
//));
|
388 |
|
|
} else {
|
389 |
|
|
$out .= '<h4 class="error">' . t('Sorry, no matching entries found.') . '</h4>';
|
390 |
|
|
}
|
391 |
|
|
return $out;
|
392 |
|
|
}
|
393 |
|
|
|
394 |
|
|
|
395 |
6657531f
|
Andreas Kohlbecker
|
/**
|
396 |
|
|
* TODO Implementation of Hook taxon_image_gallery()
|
397 |
|
|
*
|
398 |
828a0c8c
|
Andreas Kohlbecker
|
* @param object $taxon
|
399 |
|
|
* @param object $media
|
400 |
6657531f
|
Andreas Kohlbecker
|
*
|
401 |
828a0c8c
|
Andreas Kohlbecker
|
* @return string
|
402 |
|
|
* Markup for the default media gallery
|
403 |
6657531f
|
Andreas Kohlbecker
|
*/
|
404 |
|
|
function taxon_image_gallery_default($taxon, $media) {
|
405 |
|
|
$hasImages = isset($media[0]);
|
406 |
|
|
|
407 |
|
|
if ($hasImages) {
|
408 |
|
|
|
409 |
|
|
$maxExtend = 150;
|
410 |
|
|
$cols = 3;
|
411 |
|
|
$maxRows = FALSE;
|
412 |
|
|
$alternativeMediaUri = NULL;
|
413 |
|
|
/* Comment @WA: was in D5:
|
414 |
|
|
$captionElements = array(
|
415 |
|
|
'title',
|
416 |
|
|
'rights',
|
417 |
7afb5232
|
Andreas Kohlbecker
|
'#uri' => t('Open Image'),
|
418 |
6657531f
|
Andreas Kohlbecker
|
);
|
419 |
|
|
*/
|
420 |
|
|
$captionElements = array(
|
421 |
|
|
'title',
|
422 |
|
|
'description',
|
423 |
|
|
'artist',
|
424 |
|
|
'location',
|
425 |
|
|
'rights',
|
426 |
7afb5232
|
Andreas Kohlbecker
|
'#uri' => t('Open image'),
|
427 |
6657531f
|
Andreas Kohlbecker
|
);
|
428 |
|
|
$gallery_name = $taxon->uuid;
|
429 |
|
|
$mediaLinkType = 'LIGHTBOX';
|
430 |
|
|
|
431 |
|
|
// $gallery_settings = getGallerySettings(CDM_DATAPORTAL_MEDIA_GALLERY_NAME);
|
432 |
|
|
|
433 |
|
|
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_TAXON_MEDIA_GALLERY_NAME_TAB);
|
434 |
|
|
|
435 |
|
|
$out = '<div class="image-gallerie">';
|
436 |
a9815578
|
Andreas Kohlbecker
|
$out .= compose_cdm_media_gallerie(array(
|
437 |
6657531f
|
Andreas Kohlbecker
|
'mediaList' => $media,
|
438 |
|
|
'galleryName' => $gallery_name,
|
439 |
|
|
'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],
|
440 |
|
|
'cols' => $gallery_settings['cdm_dataportal_media_cols'],
|
441 |
|
|
'maxRows' => 0, // Ignore maxrows settings.
|
442 |
|
|
'captionElements' => $captionElements,
|
443 |
|
|
'mediaLinkType' => $mediaLinkType,
|
444 |
|
|
'alternativeMediaUri' => NULL,
|
445 |
|
|
'galleryLinkUri' => NULL,
|
446 |
|
|
'showCaption' => $gallery_settings['cdm_dataportal_show_thumbnail_captions'],
|
447 |
|
|
));
|
448 |
|
|
$out .= '</div>';
|
449 |
|
|
}
|
450 |
|
|
else {
|
451 |
|
|
$out = 'No images available.';
|
452 |
|
|
}
|
453 |
|
|
return $out;
|
454 |
|
|
}
|
455 |
|
|
|
456 |
|
|
/**
|
457 |
|
|
* TODO Implementation of Hook taxon_image_gallery()
|
458 |
|
|
*
|
459 |
828a0c8c
|
Andreas Kohlbecker
|
* @param object $taxon
|
460 |
|
|
* @param object $media
|
461 |
|
|
*
|
462 |
|
|
* @return string
|
463 |
|
|
* Markup for the fsi media gallery
|
464 |
6657531f
|
Andreas Kohlbecker
|
*
|
465 |
828a0c8c
|
Andreas Kohlbecker
|
* @throws Exception
|
466 |
6657531f
|
Andreas Kohlbecker
|
*/
|
467 |
|
|
function taxon_image_gallery_fsi($taxon, $media) {
|
468 |
|
|
$flashLink = isset($media[0]);
|
469 |
|
|
|
470 |
|
|
if ($flashLink) {
|
471 |
|
|
|
472 |
|
|
if (module_exists("fsi_gallery")) {
|
473 |
|
|
$out = theme("fsi_gallery", array('taxon' => $taxon, 'media' => $media));
|
474 |
|
|
}
|
475 |
|
|
else {
|
476 |
|
|
$message = t('In order to use the FSI gallery you must enable the according ') . l(t("module"), "admin/modules");
|
477 |
|
|
drupal_set_message($message, "error");
|
478 |
|
|
$out = '<h3>' . $message . '</h3>';
|
479 |
|
|
}
|
480 |
|
|
}
|
481 |
|
|
else {
|
482 |
|
|
$out = 'No images available.';
|
483 |
|
|
}
|
484 |
|
|
return $out;
|
485 |
|
|
}
|
486 |
|
|
|
487 |
|
|
/**
|
488 |
6cbefddc
|
Andreas Kohlbecker
|
* Returns a drupal render array for a single reference page.
|
489 |
6657531f
|
Andreas Kohlbecker
|
*
|
490 |
6cbefddc
|
Andreas Kohlbecker
|
* Composes a page with all data on a single reference.
|
491 |
6657531f
|
Andreas Kohlbecker
|
*
|
492 |
6cbefddc
|
Andreas Kohlbecker
|
* @param string $uuid
|
493 |
|
|
* An uuid for a cdm reference.
|
494 |
6657531f
|
Andreas Kohlbecker
|
*
|
495 |
6cbefddc
|
Andreas Kohlbecker
|
* @return array
|
496 |
|
|
* A drupal render array
|
497 |
5e4cae59
|
Andreas Kohlbecker
|
*
|
498 |
828a0c8c
|
Andreas Kohlbecker
|
* @throws Exception
|
499 |
6cbefddc
|
Andreas Kohlbecker
|
*
|
500 |
|
|
* @ingroup compose
|
501 |
6657531f
|
Andreas Kohlbecker
|
*/
|
502 |
6cbefddc
|
Andreas Kohlbecker
|
function compose_cdm_reference_page($uuid) {
|
503 |
6657531f
|
Andreas Kohlbecker
|
|
504 |
7370f4f7
|
Andreas Kohlbecker
|
$pathelement = "reference_page";
|
505 |
|
|
RenderHints::pushToRenderStack($pathelement);
|
506 |
6cbefddc
|
Andreas Kohlbecker
|
$reference = cdm_ws_get(CDM_WS_REFERENCE, $uuid);
|
507 |
6657531f
|
Andreas Kohlbecker
|
if (isset($reference->titleCache)) {
|
508 |
|
|
drupal_set_title($reference->titleCache, PASS_THROUGH);
|
509 |
|
|
}
|
510 |
|
|
|
511 |
|
|
$field_order = array(
|
512 |
|
|
"title",
|
513 |
0a288588
|
Andreas Kohlbecker
|
"abbrevTitle",
|
514 |
|
|
// "titleCache" abbrevTitleCache
|
515 |
6657531f
|
Andreas Kohlbecker
|
// "citation",
|
516 |
1ce9afb7
|
Patric Plitzner
|
"authorship",
|
517 |
6657531f
|
Andreas Kohlbecker
|
"editor",
|
518 |
|
|
"publisher",
|
519 |
|
|
"placePublished",
|
520 |
|
|
"datePublished",
|
521 |
|
|
"year",
|
522 |
|
|
"edition",// Class Book.
|
523 |
|
|
"volume",// Class Article.
|
524 |
|
|
"seriesPart",
|
525 |
|
|
"inReference",
|
526 |
|
|
"nomRefBase", // Class BookSection, Book, Article.
|
527 |
|
|
"pages",// Class Article.
|
528 |
|
|
"series",// Class Article, PrintSeries.
|
529 |
|
|
"school",// Class Thesis.
|
530 |
|
|
"institution",// Class Report.
|
531 |
|
|
"organization",// Class Proceedings.
|
532 |
|
|
"nextVersion",
|
533 |
|
|
"previousVersion",
|
534 |
|
|
"isbn",// Class Book.
|
535 |
|
|
"issn",// Class Journal.
|
536 |
0a288588
|
Andreas Kohlbecker
|
"doi",
|
537 |
|
|
"uri"
|
538 |
6657531f
|
Andreas Kohlbecker
|
);
|
539 |
|
|
|
540 |
|
|
$table_rows = array();
|
541 |
|
|
|
542 |
1ce9afb7
|
Patric Plitzner
|
if (!isset($reference->authorship)) {
|
543 |
|
|
$authorship = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->uuid);
|
544 |
|
|
$reference->authorship = isset($authorship->titleCache) ? $authorship->titleCache : '';
|
545 |
6657531f
|
Andreas Kohlbecker
|
}
|
546 |
|
|
|
547 |
|
|
if (!isset($reference->inReference)) {
|
548 |
|
|
$reference->inReference = cdm_ws_get(CDM_WS_REFERENCE, array(
|
549 |
|
|
$reference->uuid,
|
550 |
|
|
"inReference",
|
551 |
|
|
));
|
552 |
|
|
}
|
553 |
|
|
|
554 |
|
|
foreach ($field_order as $fieldname) {
|
555 |
|
|
|
556 |
|
|
if (isset($reference->$fieldname)) {
|
557 |
|
|
|
558 |
|
|
if ($fieldname == "datePublished") {
|
559 |
|
|
$period = $reference->$fieldname;
|
560 |
|
|
$datePublished = timePeriodToString($period);
|
561 |
|
|
if (isset($datePublished) && $datePublished != '') {
|
562 |
|
|
$table_rows[] = array(
|
563 |
0a288588
|
Andreas Kohlbecker
|
t("Date published"),
|
564 |
6657531f
|
Andreas Kohlbecker
|
$datePublished,
|
565 |
|
|
);
|
566 |
|
|
}
|
567 |
|
|
}
|
568 |
0a288588
|
Andreas Kohlbecker
|
elseif ($fieldname == "doi" && is_object($reference->doi)) {
|
569 |
|
|
$table_rows[] = array(
|
570 |
7cc085da
|
Andreas Kohlbecker
|
t('@fieldname', array('@fieldname' => ucfirst(strtolower($fieldname)))),
|
571 |
0a288588
|
Andreas Kohlbecker
|
cdm_doi($reference->doi, false)
|
572 |
|
|
);
|
573 |
|
|
}
|
574 |
|
|
elseif ($fieldname == "uri" && isset($reference->uri) && $reference->uri) {
|
575 |
|
|
$table_rows[] = array(
|
576 |
7cc085da
|
Andreas Kohlbecker
|
t('@fieldname', array('@fieldname' => ucfirst(strtolower($fieldname)))),
|
577 |
0a288588
|
Andreas Kohlbecker
|
cdm_external_uri($reference->uri, false)
|
578 |
|
|
);
|
579 |
|
|
}
|
580 |
6657531f
|
Andreas Kohlbecker
|
elseif (is_object($reference->$fieldname)) {
|
581 |
1ce9afb7
|
Patric Plitzner
|
if ($fieldname == "authorship") {
|
582 |
6657531f
|
Andreas Kohlbecker
|
$dump = $reference->$fieldname;
|
583 |
|
|
$teammembers = "teamMembers";
|
584 |
|
|
$team = $dump->$teammembers;
|
585 |
|
|
$nameArray = array();
|
586 |
|
|
|
587 |
|
|
foreach ($team as $member) {
|
588 |
|
|
if (strlen($member->lastname) > 0) {
|
589 |
|
|
$nname = $member->lastname;
|
590 |
|
|
$name = $nname;
|
591 |
|
|
if (strlen($member->firstname) > 0) {
|
592 |
|
|
$vname = $member->firstname;
|
593 |
|
|
$name = $vname . " " . $nname;
|
594 |
|
|
}
|
595 |
|
|
$nameArray[] = $name;
|
596 |
|
|
}
|
597 |
|
|
else {
|
598 |
|
|
if (strlen($member->titleCache) > 0) {
|
599 |
|
|
$nameArray[] = $member->titleCache;
|
600 |
|
|
}
|
601 |
|
|
}
|
602 |
|
|
}
|
603 |
|
|
$value = join($nameArray, ", ");
|
604 |
|
|
}
|
605 |
|
|
elseif ($fieldname == "inReference") {
|
606 |
|
|
$type = $reference->$fieldname->type;
|
607 |
|
|
$value = l($reference->$fieldname->titleCache, path_to_reference($reference->$fieldname->uuid));
|
608 |
|
|
switch ($type) {
|
609 |
|
|
case "Book":
|
610 |
|
|
$fieldname = "in book";
|
611 |
|
|
break;
|
612 |
|
|
case "Journal":
|
613 |
|
|
$fieldname = "in journal";
|
614 |
|
|
break;
|
615 |
|
|
case "Proceedings":
|
616 |
|
|
$fieldname = "in proceedings";
|
617 |
|
|
break;
|
618 |
|
|
}
|
619 |
|
|
}
|
620 |
|
|
else {
|
621 |
|
|
$value = $reference->$fieldname->titleCache;
|
622 |
|
|
}
|
623 |
0a288588
|
Andreas Kohlbecker
|
|
624 |
|
|
|
625 |
6657531f
|
Andreas Kohlbecker
|
if (isset($value) && $value != '') {
|
626 |
|
|
$table_rows[] = array(
|
627 |
7cc085da
|
Andreas Kohlbecker
|
t('@fieldname', array('@fieldname' => ucfirst(strtolower($fieldname)))),
|
628 |
6657531f
|
Andreas Kohlbecker
|
$value,
|
629 |
|
|
);
|
630 |
|
|
}
|
631 |
0a288588
|
Andreas Kohlbecker
|
|
632 |
6657531f
|
Andreas Kohlbecker
|
}
|
633 |
|
|
else {
|
634 |
|
|
if (isset($reference->$fieldname) && $reference->$fieldname != '') {
|
635 |
|
|
$table_rows[] = array(
|
636 |
7cc085da
|
Andreas Kohlbecker
|
t('@fieldname', array('@fieldname' => ucfirst(strtolower($fieldname)))),
|
637 |
6657531f
|
Andreas Kohlbecker
|
$reference->$fieldname,
|
638 |
|
|
);
|
639 |
|
|
}
|
640 |
|
|
}
|
641 |
|
|
}
|
642 |
|
|
}
|
643 |
|
|
|
644 |
|
|
$out = theme_table(array(
|
645 |
|
|
'header' => array(),
|
646 |
|
|
'rows' => $table_rows,
|
647 |
0a288588
|
Andreas Kohlbecker
|
'attributes' => array(
|
648 |
|
|
'class' => html_class_attribute_ref($reference)
|
649 |
|
|
),
|
650 |
6657531f
|
Andreas Kohlbecker
|
'caption' => NULL,
|
651 |
|
|
'colgroups' => NULL,
|
652 |
|
|
'sticky' => NULL,
|
653 |
0a288588
|
Andreas Kohlbecker
|
'empty' => NULL,
|
654 |
6657531f
|
Andreas Kohlbecker
|
));
|
655 |
|
|
|
656 |
7370f4f7
|
Andreas Kohlbecker
|
if(isset($reference->referenceAbstract)){
|
657 |
11af03f3
|
Andreas Kohlbecker
|
$out .= '<h2 class="block-title">Abstract</h2><div class="abstract">' . $reference->referenceAbstract . '</div>';
|
658 |
0a288588
|
Andreas Kohlbecker
|
}
|
659 |
|
|
|
660 |
6cbefddc
|
Andreas Kohlbecker
|
|
661 |
7370f4f7
|
Andreas Kohlbecker
|
// Annotations below the table
|
662 |
|
|
$annotations = cdm_fetch_visible_annotations($reference);
|
663 |
6657531f
|
Andreas Kohlbecker
|
$out .= theme("cdm_annotations", array('annotations' => $annotations));
|
664 |
|
|
|
665 |
6cbefddc
|
Andreas Kohlbecker
|
$registration_working_set = cdm_ws_get("registrationWorkingSetDTO", array($uuid));
|
666 |
|
|
if($registration_working_set && count($registration_working_set->registrationDTOs) > 0){
|
667 |
26b8a1bc
|
Andreas Kohlbecker
|
$out .= "<h3>Nomenclatural acts:</h3><div class=\"cdm-item-list registration-item-list\">";
|
668 |
6cbefddc
|
Andreas Kohlbecker
|
foreach($registration_working_set->registrationDTOs as $registration_dto){
|
669 |
ae472365
|
Andreas Kohlbecker
|
if($registration_dto->status == "PUBLISHED"){
|
670 |
26b8a1bc
|
Andreas Kohlbecker
|
$registration_render_a = compose_registration_dto_compact($registration_dto, 'citation');
|
671 |
|
|
$registration_render_a["#prefix"] = "<div class=\"item item-registration\">";
|
672 |
ae472365
|
Andreas Kohlbecker
|
$registration_render_a["#suffix"] = "</div>";
|
673 |
|
|
$out .= drupal_render($registration_render_a);
|
674 |
|
|
}
|
675 |
6cbefddc
|
Andreas Kohlbecker
|
}
|
676 |
2a14e5d9
|
Andreas Kohlbecker
|
$out .= "</div>";
|
677 |
6cbefddc
|
Andreas Kohlbecker
|
}
|
678 |
|
|
|
679 |
7370f4f7
|
Andreas Kohlbecker
|
RenderHints::popFromRenderStack();
|
680 |
|
|
|
681 |
6cbefddc
|
Andreas Kohlbecker
|
return markup_to_render_array($out);
|
682 |
6657531f
|
Andreas Kohlbecker
|
}
|
683 |
|
|
|
684 |
|
|
/**
|
685 |
|
|
* @todo Please document this function.
|
686 |
|
|
* @see http://drupal.org/node/1354
|
687 |
|
|
*/
|
688 |
|
|
function theme_cdm_media_page($variables) {
|
689 |
a867b774
|
Andreas Kohlbecker
|
|
690 |
6657531f
|
Andreas Kohlbecker
|
$media = $variables['media'];
|
691 |
|
|
$mediarepresentation_uuid = $variables['mediarepresentation_uuid'];
|
692 |
|
|
$partId = $variables['partId'];
|
693 |
|
|
$out = '';
|
694 |
4fa6f9ba
|
Andreas Kohlbecker
|
|
695 |
|
|
// Determine which representation and which part to show
|
696 |
4946eebf
|
Andreas Kohlbecker
|
$active_representation_index = 0;
|
697 |
4fa6f9ba
|
Andreas Kohlbecker
|
|
698 |
|
|
if (!$mediarepresentation_uuid) {
|
699 |
4946eebf
|
Andreas Kohlbecker
|
// no representation requested by the method parameters, find the best one
|
700 |
4fa6f9ba
|
Andreas Kohlbecker
|
$representations = cdm_preferred_media_representations($media, array('image/png', 'image/jpeg', 'image/gif'), null, null);
|
701 |
4946eebf
|
Andreas Kohlbecker
|
if($representations && count($representations) > 0){
|
702 |
|
|
$preferred_representation = array_shift($representations);
|
703 |
|
|
$mediarepresentation_uuid = $preferred_representation->uuid;
|
704 |
|
|
}
|
705 |
4fa6f9ba
|
Andreas Kohlbecker
|
}
|
706 |
|
|
|
707 |
4946eebf
|
Andreas Kohlbecker
|
if($mediarepresentation_uuid){
|
708 |
|
|
foreach ($media->representations as $representation) {
|
709 |
|
|
if ($representation->uuid == $mediarepresentation_uuid) {
|
710 |
|
|
break;
|
711 |
|
|
}
|
712 |
|
|
$active_representation_index++;
|
713 |
6657531f
|
Andreas Kohlbecker
|
}
|
714 |
|
|
}
|
715 |
|
|
|
716 |
4fa6f9ba
|
Andreas Kohlbecker
|
|
717 |
4946eebf
|
Andreas Kohlbecker
|
$active_part_index = 0;
|
718 |
|
|
if (is_uuid($partId)) {
|
719 |
|
|
foreach ($media->representations[$active_representation_index]->parts as $part) {
|
720 |
6657531f
|
Andreas Kohlbecker
|
if ($part->uuid == $partId) {
|
721 |
4946eebf
|
Andreas Kohlbecker
|
break;
|
722 |
6657531f
|
Andreas Kohlbecker
|
}
|
723 |
4946eebf
|
Andreas Kohlbecker
|
$active_part_index++;
|
724 |
6657531f
|
Andreas Kohlbecker
|
}
|
725 |
|
|
}
|
726 |
4946eebf
|
Andreas Kohlbecker
|
else if(is_numeric($partId)){
|
727 |
|
|
$active_part_index = $partId;
|
728 |
6657531f
|
Andreas Kohlbecker
|
}
|
729 |
|
|
|
730 |
97ff635c
|
Andreas Kohlbecker
|
$media_metadata = read_media_metadata($media);
|
731 |
6657531f
|
Andreas Kohlbecker
|
// $title = $media->titleCache;
|
732 |
|
|
$title = $media_metadata['title'];
|
733 |
|
|
|
734 |
|
|
$imageMaxExtend = variable_get('image-page-maxextend', 400);
|
735 |
|
|
|
736 |
|
|
if (!$title) {
|
737 |
|
|
$title = 'Media ' . $media->uuid . '';
|
738 |
|
|
}
|
739 |
|
|
|
740 |
|
|
drupal_set_title($title, PASS_THROUGH);
|
741 |
|
|
|
742 |
|
|
$out .= '<div class="media cdm_media_viewer_image">';
|
743 |
|
|
|
744 |
3e2af8c2
|
Andreas Kohlbecker
|
if(preg_match('/cdm_dataportal\/taxon\//', $_SERVER['HTTP_REFERER']) ){
|
745 |
78bac306
|
Andreas Kohlbecker
|
if(variable_get('cdm_dataportal_taxonpage_tabs', 1)){
|
746 |
|
|
// taxon page with tabs
|
747 |
|
|
$out .= '<div id="backToGalleryButton">' . l(t('Back to images'), $_SESSION['cdm']['last_gallery']) . '</div>';
|
748 |
|
|
} else {
|
749 |
|
|
// tabless mode
|
750 |
|
|
$out .= '<div id="backToGalleryButton">' . l(t('Back to taxon page'), $_SESSION['cdm']['last_gallery']) . '</div>';
|
751 |
|
|
}
|
752 |
3e2af8c2
|
Andreas Kohlbecker
|
}
|
753 |
6657531f
|
Andreas Kohlbecker
|
$out .= '<div class="viewer">';
|
754 |
4946eebf
|
Andreas Kohlbecker
|
$out .= cdm_openlayers_image($media->representations[$active_representation_index]->parts[$active_part_index], $imageMaxExtend);
|
755 |
6657531f
|
Andreas Kohlbecker
|
$out .= '</div>';
|
756 |
|
|
|
757 |
|
|
// General media metadata.
|
758 |
f79d32d6
|
Andreas Kohlbecker
|
$metadataToPrint = theme('cdm_media_caption', array('media' => $media, 'sources_as_content' => true));
|
759 |
6657531f
|
Andreas Kohlbecker
|
$out .= $metadataToPrint;
|
760 |
|
|
|
761 |
63d5030d
|
Andreas Kohlbecker
|
$cdm_standard_image_viewer_settings = get_array_variable_merged(CDM_STANDARD_IMAGE_VIEWER, CDM_STANDARD_IMAGE_VIEWER_DEFAULT);
|
762 |
|
|
if ($cdm_standard_image_viewer_settings['media_representation_details_enabled'] == 1){
|
763 |
|
|
// Tabs for the different representations.
|
764 |
|
|
// Representation(-part) specific metadata.
|
765 |
|
|
$thumbnailMaxExtend = 100;
|
766 |
|
|
$out .= '<h3>' .t('Media representations') .'</h3><ul id="media-representations">';
|
767 |
|
|
$r_i = 0;
|
768 |
|
|
foreach ($media->representations as $representation) {
|
769 |
|
|
$out .= '<li><strong>'. t('Representation') . ' ' . $r_i . "</strong> ($representation->mimeType)" ;
|
770 |
|
|
// parts
|
771 |
|
|
$active_part_index = 0;
|
772 |
|
|
$table_class_attribute = '';
|
773 |
|
|
if($partIdx == $active_part_index && $active_representation_index == $r_i ){
|
774 |
|
|
$table_class_attribute = 'class="active"';
|
775 |
a867b774
|
Andreas Kohlbecker
|
}
|
776 |
63d5030d
|
Andreas Kohlbecker
|
$out .= "<table $table_class_attribute>";
|
777 |
|
|
foreach ($representation->parts as $part) {
|
778 |
|
|
$out .= '<tr><th>' . t('Part') . ' ' . ($active_part_index + 1) . '</th></tr><tr><td>';
|
779 |
|
|
switch ($part->class) {
|
780 |
|
|
case 'ImageFile':
|
781 |
|
|
$out .= $part->width . 'x' . $part->height . ' px - ' . $part->size . ' kB';
|
782 |
|
|
break;
|
783 |
|
|
case 'AudioFile':
|
784 |
|
|
case 'MovieFile':
|
785 |
|
|
$out .= t('Duration') . ': ' . $part->duration . 's - ' . $part->size . ' kB';
|
786 |
|
|
break;
|
787 |
|
|
default:
|
788 |
|
|
$out .= $part->size . 'k';
|
789 |
|
|
}
|
790 |
6657531f
|
Andreas Kohlbecker
|
|
791 |
63d5030d
|
Andreas Kohlbecker
|
$out .= '</td><td><a href="' . url(path_to_media($media->uuid, $representation->uuid, $active_part_index)) . '">'
|
792 |
|
|
. cdm_media_gallerie_image($part, $thumbnailMaxExtend, TRUE);
|
793 |
|
|
$active_part_index++;
|
794 |
|
|
}
|
795 |
|
|
$out .= '</table>';
|
796 |
|
|
$out .= '</li>';
|
797 |
|
|
$r_i++;
|
798 |
a867b774
|
Andreas Kohlbecker
|
}
|
799 |
63d5030d
|
Andreas Kohlbecker
|
$out .= '</ul>';
|
800 |
6657531f
|
Andreas Kohlbecker
|
}
|
801 |
|
|
|
802 |
a867b774
|
Andreas Kohlbecker
|
$out .= '</div>';
|
803 |
6657531f
|
Andreas Kohlbecker
|
return $out;
|
804 |
|
|
}
|
805 |
|
|
|
806 |
|
|
/**
|
807 |
|
|
* @todo Please document this function.
|
808 |
|
|
* @see http://drupal.org/node/1354
|
809 |
|
|
*/
|
810 |
|
|
function theme_cdm_polytomousKey_page($variables) {
|
811 |
|
|
$polytomousKey = $variables['polytomousKey'];
|
812 |
|
|
drupal_set_title($polytomousKey->titleCache, PASS_THROUGH);
|
813 |
|
|
|
814 |
|
|
$out = theme("cdm_IdentificationKey", array(
|
815 |
|
|
'identificationKey' => $polytomousKey,
|
816 |
|
|
'doLinkToKeyPage' => FALSE,
|
817 |
|
|
'showIdentificationKeyTitle' => FALSE,
|
818 |
|
|
));
|
819 |
|
|
|
820 |
|
|
// Key nodes in linked style.
|
821 |
|
|
$out .= theme('cdm_polytomousKey', array('polytomousKey' => $polytomousKey));
|
822 |
|
|
/*
|
823 |
29809fe3
|
Andreas Kohlbecker
|
* FIXME implement node type for keys !!!
|
824 |
|
|
* (wrapping the content in the cdm_dataportal.node becomes obsolete then).
|
825 |
|
|
*/
|
826 |
|
|
return '<div id="identificationKey">' . $out . '</div>';
|
827 |
4feeabc7
|
Andreas Kohlbecker
|
}
|