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