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
|
* default title for a taxon page
|
15
|
*
|
16
|
* @param NameTO $nameTO
|
17
|
* @return the formatted taxon name
|
18
|
*/
|
19
|
function theme_cdm_taxon_page_title($taxon, $uuid){
|
20
|
RenderHints::pushToRenderStack('taxon_page_title');
|
21
|
if(isset($taxon->name->nomenclaturalReference)){
|
22
|
$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
|
23
|
}
|
24
|
$out = theme('cdm_taxonName', $taxon->name, null, $referenceUri, false);
|
25
|
RenderHints::popFromRenderStack();
|
26
|
|
27
|
return '<span class="'.$taxon->class.'">'.$out.'</span>';
|
28
|
}
|
29
|
|
30
|
/**
|
31
|
* Default title for a name page
|
32
|
* @param $taxon_name The taxon name object
|
33
|
* @return the formatted name title
|
34
|
*/
|
35
|
function theme_cdm_name_page_title($taxon_name){
|
36
|
RenderHints::pushToRenderStack('taxon_page_title');
|
37
|
if(isset($taxon_name->nomenclaturalReference)){
|
38
|
$referenceUri = url(path_to_reference($taxon_name->nomenclaturalReference->uuid));
|
39
|
}
|
40
|
|
41
|
$out = '<span class="'.$taxon_name->class.'">'.theme('cdm_taxonName', $taxon_name, null, $referenceUri, false).'</span>';
|
42
|
RenderHints::popFromRenderStack();
|
43
|
return $out;
|
44
|
}
|
45
|
|
46
|
/**
|
47
|
* A wrapper function that groups available information to show by default, when
|
48
|
* a taxon page is requested by the browser.
|
49
|
* Individual themeing has to decide what this page should include (see methods beneath)
|
50
|
* and what information should go into tabs or should not be shown at all.
|
51
|
*
|
52
|
* It is headed by the name of the accepted taxon without author and reference.
|
53
|
* @param $taxonTO the taxon object
|
54
|
* @param $page_part name of the part to display,
|
55
|
* valid values are: 'description', 'images', 'synonymy', 'all'
|
56
|
*/
|
57
|
function theme_cdm_taxon_page_general($taxon, $page_part = 'description') {
|
58
|
|
59
|
global $theme;
|
60
|
|
61
|
$page_part = variable_get('cdm_dataportal_taxonpage_tabs', 1) ? $page_part : 'all';
|
62
|
$hideTabs = array();
|
63
|
|
64
|
|
65
|
// get images
|
66
|
$prefMimeTypeRegex = 'image:.*';
|
67
|
$prefMediaQuality = '*';
|
68
|
//$media = cdm_ws_get(CDM_WS_PORTAL_TAXONOMY_MEDIA, array(variable_get('cdm_taxonomictree_uuid', false),$taxon->uuid));
|
69
|
|
70
|
|
71
|
$selectShowMedia = variable_get('cdm_dataportal_show_media', 0);
|
72
|
if ($selectShowMedia == 0){
|
73
|
$media = cdm_ws_get(CDM_WS_PORTAL_TAXON_MEDIA, array($taxon->uuid, $prefMimeTypeRegex, $prefMediaQuality));
|
74
|
}else{
|
75
|
$media = cdm_ws_get(CDM_WS_PORTAL_TAXON_SUBTREE_MEDIA, array($taxon->uuid, $prefMimeTypeRegex, $prefMediaQuality));
|
76
|
}
|
77
|
/*
|
78
|
if(!isset($mediaList[0])) {
|
79
|
$hideTabs[] = theme('cdm_taxonpage_tab', 'Images');
|
80
|
}
|
81
|
*/
|
82
|
|
83
|
if(!isset($media[0])) {
|
84
|
$hideTabs[] = theme('cdm_taxonpage_tab', 'Images');
|
85
|
}
|
86
|
|
87
|
$specimensOrObersvations = cdm_ws_get(CDM_WS_TAXON, array($taxon->uuid, 'specimensOrObersvations') );
|
88
|
$specimensOrObersvationsCount = is_array($specimensOrObersvations) ? count($specimensOrObersvations) : 0;
|
89
|
if($specimensOrObersvationsCount == 0) {
|
90
|
$hideTabs[] = theme('cdm_taxonpage_tab', 'Specimens');
|
91
|
}
|
92
|
|
93
|
// hideImage flag depending on administative preset
|
94
|
$hideImages = false;
|
95
|
if(variable_get('image_hide_rank', '0') != '0'){
|
96
|
$rankCompare = rank_compare($taxon->name->rank->uuid, variable_get('image_hide_rank', '-99'));
|
97
|
$hideImages = ($rankCompare > -1);
|
98
|
}
|
99
|
// $hideTabs[] = theme('cdm_taxonpage_tab', 'General');
|
100
|
// $hideTabs[] = theme('cdm_taxonpage_tab', 'Synonymy')
|
101
|
|
102
|
// hide tabs
|
103
|
$tabhide_js = '';
|
104
|
foreach($hideTabs as $tabText) {
|
105
|
$tabhide_js .= "$('.tabs.primary').children('li').children('a:contains(\"$tabText\")').hide();\n";
|
106
|
}
|
107
|
drupal_add_js("
|
108
|
$(document).ready(function(){
|
109
|
$tabhide_js
|
110
|
});", 'inline');
|
111
|
|
112
|
$out = '';
|
113
|
$out .= theme('cdm_back_to_search_result_button');
|
114
|
//var_dump(variable_get('cdm_dataportal_display_is_accepted_for', CDM_DATAPORTAL_DISPLAY_IS_ACCEPTED_FOR));
|
115
|
if(variable_get('cdm_dataportal_display_is_accepted_for', CDM_DATAPORTAL_DISPLAY_IS_ACCEPTED_FOR)){
|
116
|
$out .= theme('cdm_acceptedFor', 'page_general');
|
117
|
}
|
118
|
|
119
|
// --- DESCRIPTION --- //
|
120
|
if($page_part == 'description' || $page_part == 'all'){
|
121
|
|
122
|
$featureTree = cdm_ws_get(CDM_WS_FEATURETREE, variable_get(CDM_DATAPORTAL_DEFAULT_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE));
|
123
|
$taxonDescriptions = cdm_ws_get(CDM_WS_PORTAL_TAXON_DESCRIPTIONS, $taxon->uuid); //retrieve all description for the taxon
|
124
|
|
125
|
$nonStructuredDescriptions = array();
|
126
|
if($taxonDescriptions != null){
|
127
|
foreach ($taxonDescriptions as $taxonDescription) {
|
128
|
// check if structured description
|
129
|
$hasStructuredData = cdm_ws_get(CDM_WS_DESCRIPTION_HAS_STRUCTRURED_DATA, $taxonDescription->uuid);
|
130
|
$hasStructuredData = $hasStructuredData->Boolean == 'true';
|
131
|
if($hasStructuredData){
|
132
|
$structured_description_featuretree_uuid = variable_get(CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID, false);
|
133
|
$naturallanguage_textData = cdm_ws_get(CDM_WS_DESCRIPTION_NATURALLANGUAGE_DESCRIPTION, array($taxonDescription->uuid, $structured_description_featuretree_uuid));
|
134
|
if(!$naturallanguage_textData){
|
135
|
drupal_set_message('The \'FeatureTree\' for the generation of natural language representations is not configured correctly, please select a \'FeatureTree\' in the '.l('CDM Dataportal Settings', 'admin/settings/cdm_dataportal/layout/taxon'), 'warning');
|
136
|
}
|
137
|
$taxonDescription->elements = null;
|
138
|
$taxonDescription->elements = array($naturallanguage_textData);
|
139
|
}
|
140
|
$nonStructuredDescriptions[] = $taxonDescription;
|
141
|
}
|
142
|
$taxonDescriptions = null; // release memory
|
143
|
}
|
144
|
|
145
|
$mergedTrees = cdm_ws_descriptions_by_featuretree($featureTree, $nonStructuredDescriptions, variable_get('cdm_dataportal_descriptions_separated', FALSE));
|
146
|
|
147
|
$out .= '<div id="general">';
|
148
|
$out .= theme('cdm_taxon_page_description', $taxon, $mergedTrees, $media, $hideImages);
|
149
|
$out .= '</div>';
|
150
|
}
|
151
|
|
152
|
// --- IMAGES --- //
|
153
|
if(!$hideImages && $page_part == 'images' || $page_part == 'all'){
|
154
|
$out .= '<div id="images">';
|
155
|
if($page_part == 'all'){
|
156
|
$out .= '<h2>'.t('Images').'</h2>';
|
157
|
}
|
158
|
|
159
|
// get the image gallery as configured by the admin
|
160
|
$taxon_image_gallery = call_user_func_array( 'taxon_image_gallery_' . variable_get('image_gallery_viewer', 'default'),
|
161
|
array($taxon, $media));
|
162
|
$out .= $taxon_image_gallery;
|
163
|
|
164
|
$out .= '</div>';
|
165
|
|
166
|
if($theme == 'garland_cichorieae'){
|
167
|
$out .= theme('cdm_taxon_page_images_cichorieae_copyright');
|
168
|
}
|
169
|
}
|
170
|
|
171
|
// --- SYNONYMY --- //
|
172
|
if($page_part == 'synonymy' || $page_part == 'all'){
|
173
|
$out .= '<div id="synonymy">';
|
174
|
if($page_part == 'all'){
|
175
|
$out .= '<h2>'.t('Synonymy').'</h2>';
|
176
|
}
|
177
|
$addAcceptedTaxon = variable_get('cdm_dataportal_nomref_in_title', CDM_DATAPORTAL_NOMREF_IN_TITLE);
|
178
|
$out .= theme('cdm_taxon_page_synonymy', $taxon, $addAcceptedTaxon);
|
179
|
|
180
|
$out .= '</div>';
|
181
|
}
|
182
|
|
183
|
// --- SPECIMENS --- //
|
184
|
if($specimensOrObersvationsCount > 0 && ($page_part == 'specimens' || $page_part == 'all') ){
|
185
|
$out .= '<div id="specimens">';
|
186
|
if($page_part == 'all'){
|
187
|
$out .= '<h2>'.t('Specimens').'</h2>';
|
188
|
}
|
189
|
$out .= theme('cdm_taxon_page_specimens', $taxon);
|
190
|
$out .= '</div>';
|
191
|
}
|
192
|
return $out;
|
193
|
}
|
194
|
|
195
|
|
196
|
/**
|
197
|
* Outputs all descriptive data and shows the preferred picture of the
|
198
|
* accepted taxon.
|
199
|
*
|
200
|
*/
|
201
|
function theme_cdm_taxon_page_description($taxon, $mergedTrees, $media = null, $hideImages = false){
|
202
|
|
203
|
if( variable_get('cdm_dataportal_show_default_image', false) && !$hideImages){
|
204
|
// preferred image
|
205
|
// hardcoded for testing;
|
206
|
$defaultRepresentationPart = false;
|
207
|
$defaultRepresentationPart->width = 184;
|
208
|
$defaultRepresentationPart->height = 144;
|
209
|
$defaultRepresentationPart->uri = drupal_get_path('theme', 'palmweb_2').'/images/no_picture.png';
|
210
|
|
211
|
// preferred image size 184px × 144
|
212
|
$imageMaxExtend = 184;
|
213
|
$out .= '<div class="preferredImage">'.$defaultRepresentationPart->uri.theme('cdm_preferredImage', $media, $defaultRepresentationPart, $imageMaxExtend).'</div>';
|
214
|
}
|
215
|
// description TOC
|
216
|
$out .= theme('cdm_featureTreeTOCs', $mergedTrees);
|
217
|
// description
|
218
|
$out .= theme('cdm_featureTrees', $mergedTrees, $taxon);
|
219
|
return $out;
|
220
|
}
|
221
|
|
222
|
|
223
|
function theme_cdm_taxon_page_specimens($taxon){
|
224
|
|
225
|
RenderHints::pushToRenderStack('taxon_page_specimens');
|
226
|
|
227
|
$specimensOrObersvations = cdm_ws_get(CDM_WS_TAXON, array($taxon->uuid, 'specimensOrObersvations') );
|
228
|
|
229
|
//collect media (fieldObjectMedia, derivedUnitMedia) and add as fields
|
230
|
foreach($specimensOrObersvations as $specimensOrObersvation) {
|
231
|
$specimensOrObersvation->_fieldObjectMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array($specimensOrObersvation->uuid, 'fieldObjectMedia') );
|
232
|
$specimensOrObersvation->_derivedUnitMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array($specimensOrObersvation->uuid, 'derivedUnitMedia') );
|
233
|
// $derivedUnitFacde = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array($descriptionElement->associatedSpecimenOrObservation->uuid) );
|
234
|
// $descriptionElement->_titleCache = $derivedUnitFacde->titleCache;
|
235
|
}
|
236
|
|
237
|
if(variable_get('cdm_dataportal_map_openlayers', 1)){
|
238
|
$occurrenceQuery = cdm_ws_get(CDM_WS_GEOSERVICE_OCCURRENCEMAP, $taxon->uuid);
|
239
|
$occurrenceQuery = $occurrenceQuery->String;
|
240
|
$out .= get_openlayers_map(variable_get('cdm_dataportal_geoservice_display_width', false), $occurrenceQuery);
|
241
|
}
|
242
|
|
243
|
|
244
|
|
245
|
if($specimensOrObersvations){
|
246
|
$out_specimenList = '<table class="specimens">';
|
247
|
$i = 1;
|
248
|
foreach($specimensOrObersvations as $specimensOrObersvation) {
|
249
|
$i++;
|
250
|
|
251
|
$mediaList = array();
|
252
|
if(is_array($specimensOrObersvation->_fieldObjectMedia)){
|
253
|
$mediaList = array_merge($mediaList, $specimensOrObersvation->_fieldObjectMedia);
|
254
|
}
|
255
|
if(is_array($specimensOrObersvation->_derivedUnitMedia)){
|
256
|
$mediaList = array_merge($mediaList, $specimensOrObersvation->_derivedUnitMedia);
|
257
|
}
|
258
|
|
259
|
// --- render the title cache
|
260
|
$out_row = '<tr class="descriptionElement descriptionElement_IndividualsAssociation '.($i%2?'odd':'even').'">';
|
261
|
if($specimensOrObersvation->class != 'FieldObservation'){
|
262
|
$label_html = cdm_dynabox($specimensOrObersvation->titleCache,
|
263
|
cdm_compose_url('portal/'.CDM_WS_DERIVEDUNIT_FACADE, array($specimensOrObersvation->uuid)),
|
264
|
'cdm_derivedUnitFacade',
|
265
|
'Click for details',
|
266
|
array('div', 'div'));
|
267
|
} else {
|
268
|
$label_html = $specimensOrObersvation->titleCache;
|
269
|
}
|
270
|
$out_row .= '<td>' . $label_html . '</td>';
|
271
|
|
272
|
// --- render associated media
|
273
|
if(count($mediaList) > 0){
|
274
|
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME);
|
275
|
$gallery_name = $specimensOrObersvation->uuid;
|
276
|
$captionElements = array('#uri'=>t('open media'));
|
277
|
$gallery_html = theme(
|
278
|
'cdm_media_gallerie',
|
279
|
$mediaList,
|
280
|
$gallery_name ,
|
281
|
$gallery_settings['cdm_dataportal_media_maxextend'],
|
282
|
$gallery_settings['cdm_dataportal_media_cols'],
|
283
|
$gallery_settings['cdm_dataportal_media_maxRows'],
|
284
|
$captionElements, 'LIGHTBOX', null, null);
|
285
|
} else {
|
286
|
$gallery_html = '';
|
287
|
}
|
288
|
$out_row .= '<td>'.$gallery_html.'</td></tr>';
|
289
|
$out_specimenList .= $out_row;
|
290
|
}
|
291
|
$out_specimenList .= '</table>';
|
292
|
}
|
293
|
|
294
|
$out .= $out_specimenList;
|
295
|
|
296
|
|
297
|
RenderHints::popFromRenderStack();
|
298
|
return $out;
|
299
|
}
|
300
|
|
301
|
function specimens_search_form() {
|
302
|
|
303
|
//form select options
|
304
|
$form['specimens_search_options'] = array(
|
305
|
'#type' => 'value',
|
306
|
'#value' => array(t('No sort'), t('Name'), t('CatalogNumber'), t('Gallery'))
|
307
|
);
|
308
|
|
309
|
//the form
|
310
|
$form['specimens_search'] = array(
|
311
|
'#title' => t('Speciments sort'),
|
312
|
'#type' => 'fieldset',
|
313
|
'#description' => t('Select your sort criteria.'),
|
314
|
'#collapsible' => TRUE,
|
315
|
'#collapsed' => FALSE
|
316
|
);
|
317
|
|
318
|
//criteria
|
319
|
$form['specimens_search']['first_criteria'] = array(
|
320
|
'#title' => t('First criteria'),
|
321
|
'#type' => 'select',
|
322
|
'#options' => $form['specimens_search_options']['#value']
|
323
|
);
|
324
|
$form['specimens_search']['second_criteria'] = array(
|
325
|
'#title' => t('Second criteria'),
|
326
|
'#type' => 'select',
|
327
|
'#options' => $form['specimens_search_options']['#value']
|
328
|
);
|
329
|
$form['specimens_search']['third_criteria'] = array(
|
330
|
'#title' => t('Third criteria'),
|
331
|
'#type' => 'select',
|
332
|
'#options' => $form['specimens_search_options']['#value']
|
333
|
);
|
334
|
|
335
|
//submit button
|
336
|
$form['specimens_search']['submit'] = array(
|
337
|
'#type' => 'submit',
|
338
|
'#value' => t('Sort')
|
339
|
);
|
340
|
|
341
|
/*
|
342
|
//from properties
|
343
|
$form['#method'] = 'post';
|
344
|
$form['#action'] = 'http://example.com/?q=foo/bar';
|
345
|
$form['#attributes'] = array(
|
346
|
'enctype' => 'multipart/form-data',
|
347
|
'target' => 'name_of_target_frame'
|
348
|
);
|
349
|
$form['#prefix'] = '<div class="my-form-class">';
|
350
|
$form['#suffix'] = '</div>';
|
351
|
*/
|
352
|
|
353
|
//returning value
|
354
|
return $form;
|
355
|
}
|
356
|
|
357
|
/**
|
358
|
* Show whole synonymy for the accepted taxon. Synonymy list is headed by the complete scientific name
|
359
|
* of the accepted taxon with nomenclatural reference.
|
360
|
*
|
361
|
*/
|
362
|
function theme_cdm_taxon_page_synonymy($taxon, $addAcceptedTaxon){
|
363
|
|
364
|
RenderHints::pushToRenderStack('taxon_page_synonymy');
|
365
|
$synomymie = cdm_ws_get(CDM_WS_PORTAL_TAXON_SYNONYMY, $taxon->uuid);
|
366
|
$skip = array(UUID_BASIONYM);
|
367
|
|
368
|
//render full accepted taxon
|
369
|
if($addAcceptedTaxon){
|
370
|
if(isset($taxon->name->nomenclaturalReference)){
|
371
|
$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
|
372
|
}
|
373
|
|
374
|
$accepted_name = theme('cdm_taxonName', $taxon->name, null, $referenceUri);
|
375
|
$out .= '<span class="accepted-name">';
|
376
|
$out .= $accepted_name;
|
377
|
$out .= '</span>';
|
378
|
|
379
|
$special_annotations_array = array();
|
380
|
$special_annotations_array[] = $taxon->name;
|
381
|
$special_annotations_array[] = $taxon;
|
382
|
$out .= theme('cdm_annotations_as_footnotekeys',
|
383
|
$special_annotations_array,
|
384
|
RenderHints::getRenderPath() . '-annotations');
|
385
|
RenderHints::setFootnoteListKey(RenderHints::getRenderPath() . '-annotations');
|
386
|
}
|
387
|
//render accepted taxon homotypic synonymy groups or type desygnations
|
388
|
//if(!isset($synomymie->homotypicSynonymsByHomotypicGroup[0])){
|
389
|
//if($addAcceptedTaxon && !isset($synomymie->homotypicSynonymsByHomotypicGroup[0])){
|
390
|
// display the type information for the added taxon
|
391
|
//}
|
392
|
|
393
|
//render accepted taxon homotypic synonymy groups or type desygnations but
|
394
|
//show only the typedesignations at the homotypic synonymy group
|
395
|
if (!$synomymie->homotypicSynonymsByHomotypicGroup[0]->name->uuid){
|
396
|
$typeDesignations = cdm_ws_get(CDM_WS_PORTAL_TAXON_NAMETYPEDESIGNATIONS, $taxon->uuid);
|
397
|
if($typeDesignations){
|
398
|
$out .= theme('cdm_typedesignations', $typeDesignations);
|
399
|
$out .= '<ul class="homotypicSynonyms">' . '</ul>';
|
400
|
}
|
401
|
}
|
402
|
// render the homotypicSynonymyGroup including the type information
|
403
|
if($synomymie->homotypicSynonymsByHomotypicGroup){
|
404
|
$out .= theme('cdm_homotypicSynonymyGroup', $synomymie->homotypicSynonymsByHomotypicGroup, $taxon->uuid);
|
405
|
}
|
406
|
/*
|
407
|
else{
|
408
|
$out .= '<ul class="homotypicSynonyms"></ul>';
|
409
|
}
|
410
|
*/
|
411
|
//render accepted taxon heterotypic synonymy groups
|
412
|
if($synomymie->heterotypicSynonymyGroups) {
|
413
|
foreach($synomymie->heterotypicSynonymyGroups as $homotypicalGroup){
|
414
|
$out .= theme('cdm_heterotypicSynonymyGroup', $homotypicalGroup);
|
415
|
}
|
416
|
}
|
417
|
//render taxon relationships
|
418
|
if(variable_get(CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT)){
|
419
|
$taxonRelationships = cdm_ws_get(CDM_WS_PORTAL_TAXON_RELATIONS, $taxon->uuid);
|
420
|
$out .= theme('cdm_taxonRelationships', $taxonRelationships);
|
421
|
}
|
422
|
//render name relationships
|
423
|
$name_rels_to_show = variable_get('name_relationships_to_show', null);
|
424
|
$skip = array();
|
425
|
if($name_rels_to_show){
|
426
|
foreach ($name_rels_to_show as $key => $value){
|
427
|
if ($value === 0){
|
428
|
$skip[] = $key;
|
429
|
}
|
430
|
}
|
431
|
if (sizeof($name_rels_to_show) != sizeof($skip)){
|
432
|
$nameRelationships = cdm_ws_get(CDM_WS_PORTAL_TAXON_TO_NAMERELATIONS, $taxon->uuid);
|
433
|
$out .= theme('cdm_nameRelationships', $nameRelationships, $skip);
|
434
|
}
|
435
|
}
|
436
|
/*
|
437
|
if(variable_get(CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS_DEFAULT)){
|
438
|
$nameRelationships = cdm_ws_get(CDM_WS_PORTAL_TAXON_TO_NAMERELATIONS, $taxon->uuid);
|
439
|
// TODO is it correct to skip relationsFromThisName since all relationships are to be understood as 'is .... of'
|
440
|
if(variable_get('cdm_dataportal_name_relations_skiptype_basionym', 1)){
|
441
|
$skip = array(UUID_BASIONYM);
|
442
|
}
|
443
|
$out .= theme('cdm_nameRelationships', $nameRelationships, $skip);
|
444
|
}
|
445
|
*/
|
446
|
|
447
|
//render the annontations text for the accepted taxa
|
448
|
if ($addAcceptedTaxon){
|
449
|
$out .= theme('cdm_footnotes', RenderHints::getRenderPath() . '-annotations', 'li');
|
450
|
}
|
451
|
RenderHints::popFromRenderStack();
|
452
|
|
453
|
return $out;
|
454
|
}
|
455
|
|
456
|
|
457
|
/**
|
458
|
* TODO Implementation of Hook taxon_image_gallery()
|
459
|
*
|
460
|
* @param unknown_type $taxon
|
461
|
* @param unknown_type $media
|
462
|
* @return unknown_type
|
463
|
*/
|
464
|
function taxon_image_gallery_default($taxon, $media){
|
465
|
|
466
|
$hasImages = isset($media[0]);
|
467
|
|
468
|
if($hasImages){
|
469
|
//
|
470
|
$maxExtend = 150;
|
471
|
$cols = 3;
|
472
|
$maxRows = false;
|
473
|
$alternativeMediaUri = null;
|
474
|
$captionElements = array('title', 'rights', '#uri'=>t('open Image'));
|
475
|
$gallery_name = $taxon->uuid;
|
476
|
$mediaLinkType = 'LIGHTBOX';
|
477
|
|
478
|
//$gallery_settings = getGallerySettings(CDM_DATAPORTAL_MEDIA_GALLERY_NAME);
|
479
|
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_TAXON_MEDIA_GALLERY_NAME_TAB);
|
480
|
$out = '<div class="image-gallerie">';
|
481
|
$out .= theme('cdm_media_gallerie',
|
482
|
$media,
|
483
|
$gallery_name,
|
484
|
$gallery_settings['cdm_dataportal_media_maxextend'],
|
485
|
$gallery_settings['cdm_dataportal_media_cols'],
|
486
|
0, // ignore maxrows settings
|
487
|
$captionElements,
|
488
|
$mediaLinkType,
|
489
|
null,
|
490
|
null,
|
491
|
$gallery_settings['cdm_dataportal_show_thumbnail_captions']);
|
492
|
$out .= '</div>';
|
493
|
}else{
|
494
|
$out = 'No images available.';
|
495
|
|
496
|
}
|
497
|
return $out;
|
498
|
|
499
|
}
|
500
|
|
501
|
/**
|
502
|
* TODO Implementation of Hook taxon_image_gallery()
|
503
|
*
|
504
|
* @param unknown_type $taxon
|
505
|
* @param unknown_type $media
|
506
|
* @return unknown_type
|
507
|
*/
|
508
|
function taxon_image_gallery_fsi($taxon, $media){
|
509
|
|
510
|
$flashLink = isset($media[0]);
|
511
|
|
512
|
if($flashLink){
|
513
|
|
514
|
$taggedName = $taxon->name->taggedName;
|
515
|
|
516
|
$nameArray = array();
|
517
|
foreach($taggedName as $taggedText){
|
518
|
if($taggedText->type == 'name'){
|
519
|
$nameArray[] = $taggedText->text;
|
520
|
}
|
521
|
}
|
522
|
|
523
|
$query = join("%5F", $nameArray) . '%20AND%20EditWP6%20AND%20jpg';
|
524
|
|
525
|
$out = '
|
526
|
|
527
|
<script type="text/javascript" src="http://media.bgbm.org/erez/js/fsiwriter.js"></script>
|
528
|
|
529
|
<script type="text/javascript">
|
530
|
<!--
|
531
|
writeFlashCode( "http://media.bgbm.org/erez/fsi/fsi.swf?&cfg=showcase_presets/showcase_info.fsi&effects=%26quality%3D95&showcase_query='.$query.'&skin=silver&showcase_labeltextheight=50&textbox_textfrom=IPTC_WP6&textbox_height=50¶m_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343&plugins=textbox,fullscreen",
|
532
|
"http://media.bgbm.org/erez/erez?src=erez-private/flashrequired.svg&tmp=Large&quality=97&width=620&height=400",
|
533
|
"width=620;height=400;bgcolor=454343;wmode=opaque");
|
534
|
// -->
|
535
|
</script>
|
536
|
<noscript>
|
537
|
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="470" height="400">
|
538
|
<param name="movie" value="http://media.bgbm.org/erez/fsi/fsi.swf?&cfg=showcase_presets/showcase_info.fsi&effects=%26quality%3D95&showcase_query='.$query.'&skin=silver&showcase_labeltextheight=50&textbox_textfrom=IPTC_WP6&textbox_height=50¶m_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343plugins=textbox,fullscreen"/>
|
539
|
<param name="bgcolor" value="454343" />
|
540
|
<param name="wmode" value="opaque" />
|
541
|
<param name="allowscriptaccess" value="always" />
|
542
|
<param name="allowfullscreen" value="true" />
|
543
|
<param name="quality" value="high" />
|
544
|
<embed src="http://media.bgbm.org/erez/fsi/fsi.swf?&cfg=showcase_presets/showcase_info.fsi&effects=%26quality%3D95&showcase_query='.$query.'&skin=silver&showcase_labeltextheight=50&textbox_textfrom=IPTC_WP6&textbox_height=50¶m_backgroundcolor=454343&publishwmode=opaque&showcase_hscroll=true&showcase_basecolor=454343plugins=PrintSave,textbox,fullscreen"
|
545
|
width="620"
|
546
|
height="400"
|
547
|
bgcolor="454343"
|
548
|
wmode="opaque"
|
549
|
allowscriptaccess="always"
|
550
|
allowfullscreen="true"
|
551
|
quality="high"
|
552
|
type="application/x-shockwave-flash"
|
553
|
pluginspage="http://www.adobe.com/go/getflashplayer">
|
554
|
</embed>
|
555
|
</object>
|
556
|
|
557
|
</noscript>';
|
558
|
|
559
|
}else{
|
560
|
$out = 'No images available.';
|
561
|
|
562
|
}
|
563
|
return $out;
|
564
|
|
565
|
}
|
566
|
/**
|
567
|
* Show a reference in it's atomized form
|
568
|
*/
|
569
|
function theme_cdm_reference_page($referenceTO){
|
570
|
|
571
|
/*
|
572
|
if($referenceTO->titleCache) {
|
573
|
drupal_set_title($referenceTO->titleCache);
|
574
|
} else {
|
575
|
drupal_set_title($referenceTO->fullCitation);
|
576
|
}
|
577
|
*/
|
578
|
|
579
|
$field_order = array(
|
580
|
"title",
|
581
|
//"titleCache",
|
582
|
//"citation",
|
583
|
"authorTeam",
|
584
|
"editor",
|
585
|
"publisher",
|
586
|
"placePublished",
|
587
|
"datePublished",
|
588
|
"year",
|
589
|
"edition", // class Book
|
590
|
"volume", // class Article
|
591
|
"seriesPart",
|
592
|
"inReference",
|
593
|
//"inJournal", // class Article
|
594
|
//"inBook", // class BookSection
|
595
|
"nomRefBase", // class BookSection, Book, Article
|
596
|
//"inProceedings", // class InProceedings
|
597
|
"pages", // class Article
|
598
|
"series", // class Article, PrintSeries
|
599
|
"school", // class Thesis
|
600
|
"institution", // class Report
|
601
|
"organization", // class Proceedings
|
602
|
"nextVersion",
|
603
|
"previousVersion",
|
604
|
"isbn", // class Book
|
605
|
"issn", // class Journal
|
606
|
"uri",
|
607
|
);
|
608
|
/*
|
609
|
$table_rows = array();
|
610
|
foreach($field_order as $fieldname){
|
611
|
|
612
|
if(isset($referenceTO->$fieldname)){
|
613
|
|
614
|
if($fieldname == "datePublished") {
|
615
|
$partial = $referenceTO->$fieldname;
|
616
|
$datePublished = '';
|
617
|
if($partial->start){
|
618
|
//var_dump ($partial->start);
|
619
|
$datePublishedYear = substr($partial->start, 0, 4);
|
620
|
$datePublishedMonth = substr($partial->start, 5, 2);
|
621
|
|
622
|
if (!(preg_match('#[0-9]#',$datePublishedMonth))){
|
623
|
$datePublishedMonth = '00';
|
624
|
}
|
625
|
|
626
|
$datePublishedDay = substr($partial->start, 7, 2);
|
627
|
if (!(preg_match('#[0-9]#',$datePublishedDay))){
|
628
|
$datePublishedDay = '00';
|
629
|
}
|
630
|
$datePublished = $datePublishedYear.'-'.$datePublishedMonth.'-'.$datePublishedDay;
|
631
|
}
|
632
|
if($partial->end){
|
633
|
$datePublished = (strlen($datePublished) > 0 ? ' '.t('to').' ' : '').substr($partial->end, 0, 4).'-'.substr($partial->end, 4, 2).'-'.substr($partial->end, 6, 2);
|
634
|
}
|
635
|
$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $datePublished);
|
636
|
//$datePublished = array(t(ucfirst(strtolower($fieldname))), $datePublished);
|
637
|
} else if(is_object($referenceTO->$fieldname)){
|
638
|
if ($fieldname == "authorTeam"){
|
639
|
$dump = $referenceTO->$fieldname;
|
640
|
$teammembers = "teamMembers";
|
641
|
$team = $dump->$teammembers;
|
642
|
$nameArray = array();
|
643
|
|
644
|
foreach($team as $member){
|
645
|
if (strlen($member->lastname)> 0){
|
646
|
$nname = $member->lastname;
|
647
|
$name = $nname;
|
648
|
if (strlen($member->firstname)> 0){
|
649
|
$vname = $member->firstname;
|
650
|
$name =$vname." ". $nname;
|
651
|
}
|
652
|
$nameArray[] =$name;
|
653
|
}else{
|
654
|
if (strlen($member->titleCache)> 0){
|
655
|
$nameArray[] = $member->titleCache;
|
656
|
}
|
657
|
}
|
658
|
}
|
659
|
$names = join($nameArray, ", ");
|
660
|
}else if ($fieldname == "inReference"){
|
661
|
$type = $referenceTO ->$fieldname-> type;
|
662
|
$names = $referenceTO-> $fieldname-> titleCache;
|
663
|
switch ($type) {
|
664
|
case "Book":
|
665
|
$fieldname = "in book";
|
666
|
break;
|
667
|
case "Journal":
|
668
|
$fieldname = "in journal";
|
669
|
break;
|
670
|
case "Proceedings":
|
671
|
$fieldname = "in proceedings";
|
672
|
break;
|
673
|
}
|
674
|
|
675
|
}else{
|
676
|
$names = $referenceTO->$fieldname-> titleCache;
|
677
|
}
|
678
|
$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $names);
|
679
|
//$name = array(t(ucfirst(strtolower($fieldname))), $names);
|
680
|
|
681
|
} else {
|
682
|
$table_rows[] = array(t(ucfirst(strtolower($fieldname))), $referenceTO->$fieldname);
|
683
|
//$name = array(t(ucfirst(strtolower($fieldname))), $referenceTO->$fieldname);
|
684
|
}
|
685
|
}
|
686
|
}
|
687
|
*/
|
688
|
|
689
|
//select the type of the reference and find the in Reference attribute
|
690
|
|
691
|
$referenceData = array(
|
692
|
"title" => NULL,
|
693
|
//"titleCache",
|
694
|
//"citation",
|
695
|
"authorTeam" => NULL,
|
696
|
"editor" => NULL,
|
697
|
"publisher" => NULL,
|
698
|
"placePublished" => NULL,
|
699
|
"datePublished" => NULL,
|
700
|
"year" => NULL,
|
701
|
"edition" => NULL, // class Book
|
702
|
"volume" => NULL, // class Article
|
703
|
"seriesPart" => NULL,
|
704
|
"inReference" => NULL,
|
705
|
//"inJournal", // class Article
|
706
|
//"inBook", // class BookSection
|
707
|
"nomRefBase" => NULL, // class BookSection, Book, Article
|
708
|
//"inProceedings", // class InProceedings
|
709
|
"pages" => NULL, // class Article
|
710
|
"series" => NULL, // class Article, PrintSeries
|
711
|
"school" => NULL, // class Thesis
|
712
|
"institution" => NULL, // class Report
|
713
|
"organization" => NULL, // class Proceedings
|
714
|
"nextVersion" => NULL,
|
715
|
"previousVersion" => NULL,
|
716
|
"isbn" => NULL, // class Book
|
717
|
"issn" => NULL, // class Journal
|
718
|
"uri" => NULL,
|
719
|
);
|
720
|
|
721
|
foreach($field_order as $fieldname){
|
722
|
|
723
|
if(isset($referenceTO->$fieldname)){
|
724
|
switch($fieldname){
|
725
|
case "datePublished":
|
726
|
$partial = $referenceTO->$fieldname;
|
727
|
$datePublished = '';
|
728
|
if($partial->start){
|
729
|
$datePublishedYear = substr($partial->start, 0, 4);
|
730
|
$datePublishedMonth = substr($partial->start, 5, 2);
|
731
|
if (!(preg_match('#[0-9]#',$datePublishedMonth))){
|
732
|
$datePublishedMonth = '00';
|
733
|
}
|
734
|
$datePublishedDay = substr($partial->start, 7, 2);
|
735
|
if (!(preg_match('#[0-9]#',$datePublishedDay))){
|
736
|
$datePublishedDay = '00';
|
737
|
}
|
738
|
$datePublished = $datePublishedYear.'-'.$datePublishedMonth.'-'.$datePublishedDay;
|
739
|
}
|
740
|
if($partial->end){
|
741
|
$datePublished = (strlen($datePublished) > 0 ? ' '.t('to').' ' : '').substr($partial->end, 0, 4).'-'.substr($partial->end, 4, 2).'-'.substr($partial->end, 6, 2);
|
742
|
}
|
743
|
|
744
|
$referenceData[$fieldname] = $datePublishedYear;
|
745
|
break;
|
746
|
|
747
|
default:
|
748
|
if(is_object($referenceTO->$fieldname)){
|
749
|
if ($fieldname == "authorTeam"){
|
750
|
$dump = $referenceTO->$fieldname;
|
751
|
$teammembers = "teamMembers";
|
752
|
$team = $dump->$teammembers;
|
753
|
$nameArray = array();
|
754
|
|
755
|
foreach($team as $member){
|
756
|
if (strlen($member->lastname)> 0){
|
757
|
$nname = $member->lastname;
|
758
|
$name = $nname;
|
759
|
if (strlen($member->firstname)> 0){
|
760
|
$vname = $member->firstname;
|
761
|
$name =$vname." ". $nname;
|
762
|
}
|
763
|
$nameArray[] =$name;
|
764
|
}else{
|
765
|
if (strlen($member->titleCache)> 0){
|
766
|
$nameArray[] = $member->titleCache;
|
767
|
}
|
768
|
}
|
769
|
}
|
770
|
$names = join($nameArray, ", ");
|
771
|
$referenceData[$fieldname] = $names;
|
772
|
}else if ($fieldname == "inReference"){
|
773
|
$names = $referenceTO->$fieldname->titleCache;
|
774
|
$referenceData[$fieldname] = $names;
|
775
|
}else{
|
776
|
$names = $referenceTO->$fieldname->titleCache;
|
777
|
$referenceData[$fieldname] = $names;
|
778
|
}
|
779
|
}else{
|
780
|
$referenceData[$fieldname] = $referenceTO->$fieldname;
|
781
|
}
|
782
|
|
783
|
}
|
784
|
}
|
785
|
}
|
786
|
$author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $referenceTO->uuid);
|
787
|
//return "" . ((strlen($referenceData["authorTeam"])>0) ? ($referenceData["authorTeam"] . '. ') : '')
|
788
|
return "" . ((strlen($author_team->titleCache)>0) ? ($author_team->titleCache . '. ') : '')
|
789
|
. ((strlen($referenceData["datePublished"])>0) ? ($referenceData["datePublished"] . '. ') : '')
|
790
|
. ((strlen($referenceData["title"])>0) ? ($referenceData["title"] . '. ') : "")
|
791
|
. ((strlen($referenceData["placePublished"])>0) ? ($referenceData["placePublished"] . '. ') : '')
|
792
|
. ((strlen($referenceData["editor"])>0) ? ($referenceData["editor"] . '. ') : '')
|
793
|
. ((strlen($referenceData["publisher"])>0) ? ($referenceData["publisher"] . '. ') : '')
|
794
|
. ((strlen($referenceData["inReference"])>0) ? ($referenceData["inReference"] . '. ') : '')
|
795
|
. ((strlen($referenceData["series"])>0) ? ($referenceData["series"] . '. ') : '')
|
796
|
. ((strlen($referenceData["volume"])>0) ? ($referenceData["volume"] . '. ') : '')
|
797
|
. ((strlen($referenceData["pages"])>0) ? ($referenceData["pages"] . '. ') : '')
|
798
|
. ((strlen($referenceData["isbn"])>0) ? ($referenceData["isbn"] . '. ') : '')
|
799
|
. ((strlen($referenceData["issn"])>0) ? ($referenceData["issn"] . '. ') : '')
|
800
|
. ((strlen($referenceData["uri"])>0) ? ($referenceData["uri"] . '. ') : '');
|
801
|
|
802
|
}
|
803
|
|
804
|
|
805
|
function theme_cdm_media_page($media, $mediarepresentation_uuid = false, $partId = false){
|
806
|
$out = '';
|
807
|
// determine which reprresentation and which part to show
|
808
|
$representationIdx = 0;
|
809
|
if($mediarepresentation_uuid){
|
810
|
$i = 0;
|
811
|
foreach($media->representations as $representation) {
|
812
|
if($representation->uuid == $mediarepresentation_uuid){
|
813
|
$representationIdx = $i;
|
814
|
}
|
815
|
$i++;
|
816
|
}
|
817
|
} else {
|
818
|
$mediarepresentation_uuid = $media->representations[0]->uuid;
|
819
|
}
|
820
|
|
821
|
$partIdx = 0;
|
822
|
if(!is_numeric($partId)){
|
823
|
// assuming it is an uuid
|
824
|
$i = 0;
|
825
|
foreach($media->representations[$representationIdx]->parts as $part) {
|
826
|
if($part->uuid == $partId){
|
827
|
$partIdx = $i;
|
828
|
}
|
829
|
$i++;
|
830
|
}
|
831
|
} else {
|
832
|
// assuming it is an index
|
833
|
$partIdx = $partId;
|
834
|
}
|
835
|
|
836
|
$media_metadata = cdm_read_media_metadata($media);
|
837
|
//$title = $media->titleCache;
|
838
|
$title = $media_metadata['title'];
|
839
|
|
840
|
$imageMaxExtend = variable_get('image-page-maxextend', 400);
|
841
|
|
842
|
if(!$title){
|
843
|
$title = 'Media '.$media->uuid.'';
|
844
|
}
|
845
|
|
846
|
drupal_set_title($title);
|
847
|
|
848
|
|
849
|
$out .= '<div class="media">';
|
850
|
|
851
|
//$out .= '<div class="viewer">';
|
852
|
$out .= theme(cdm_back_to_image_gallery_button);
|
853
|
$out .= '<div class="viewer">';
|
854
|
//$out .= theme('cdm_media_gallerie_image', $representation->parts[$partIdx], $imageMaxExtend);
|
855
|
$out .= theme('cdm_openlayers_image', $media->representations[$representationIdx]->parts[$partIdx], $imageMaxExtend);
|
856
|
$out .= '</div>';
|
857
|
|
858
|
// general media metadata
|
859
|
//$media_metadata = cdm_ws_get(CDM_WS_MEDIA_METADATA, array($media->uuid));
|
860
|
//vardump("PRINTING MEDIA METADATA");
|
861
|
//vardump($media_metadata);
|
862
|
//vardump("PRINTING MEDIA");
|
863
|
//vardump($media);
|
864
|
$metadataToPrint = theme('cdm_media_caption', $media);
|
865
|
$out .= $metadataToPrint;
|
866
|
|
867
|
|
868
|
//tabs for the different representations
|
869
|
//ul.secondary
|
870
|
$out .= '<ul class="primary">';
|
871
|
foreach($media->representations as $representation){
|
872
|
$out .= '<li>'.l($media->representations[$representationIdx]->mimeType, path_to_media($media->uuid, $mediarepresentation_uuid, $partIdx)).'</li>';
|
873
|
}
|
874
|
$out .= '</ul>';
|
875
|
|
876
|
// representation(-part) specific metadata
|
877
|
$thumbnailMaxExtend = 100;
|
878
|
$out .= '<table>';
|
879
|
//$out .= '<tr><th colspan="3">'.t('MimeType').': '.$media->representations[$representationIdx]->mimeType.'</th></tr>';
|
880
|
$i = 0;
|
881
|
foreach($media->representations[$representationIdx]->parts as $part){
|
882
|
$out .= '<tr><th>'.t('Part').' '.($i + 1).'</th><td>';
|
883
|
switch($part->class){
|
884
|
case 'ImageFile': $out .= $part->width.' x '.$part->height.' - '.$part->size.'k'; break;
|
885
|
case 'AudioFile':
|
886
|
case 'MovieFile': $out .= t('Duration').': '.$part->duration.'s - '.$part->size.'k'; break;
|
887
|
default: $out .= $part->size.'k';
|
888
|
}
|
889
|
$out .= '</td><td><a href="'.url(path_to_media($media->uuid, $mediarepresentation_uuid, $i)).'">'
|
890
|
.theme('cdm_media_gallerie_image', $part, $thumbnailMaxExtend, true);'</a></td><tr>';
|
891
|
$i++;
|
892
|
}
|
893
|
$out .= '</table>';
|
894
|
$out .= '</div>';
|
895
|
|
896
|
return $out;
|
897
|
}
|
898
|
|
899
|
/**
|
900
|
* Allows theming of the taxon page tabs
|
901
|
*
|
902
|
* @param $tabname
|
903
|
* @return unknown_type
|
904
|
*/
|
905
|
function theme_cdm_taxonpage_tab($tabname){
|
906
|
//TODO replace by using translations or theme the menue tabs itself instead?
|
907
|
switch($tabname){
|
908
|
default: return t($tabname);
|
909
|
}
|
910
|
}
|
911
|
|