1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Functions for dealing with CDM entities of type SpecimenOrOccurrences
|
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
|
* @author
|
16
|
* - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
|
17
|
*/
|
18
|
|
19
|
|
20
|
/**
|
21
|
* Provides the HTML markup for a specimen page
|
22
|
*
|
23
|
* @param $specimen
|
24
|
*
|
25
|
* @return string
|
26
|
* The markup for a specimen page
|
27
|
*/
|
28
|
function render_cdm_specimen_page($specimen, $is_specimen_page = false)
|
29
|
{
|
30
|
$detail_html = "";
|
31
|
//link to specimen page
|
32
|
$pathToSpecimen = path_to_specimen($specimen->uuid);
|
33
|
if (!$is_specimen_page) {
|
34
|
$specimenPageLink = l($specimen->accessionNumber, $pathToSpecimen, array('attributes' => array('target' => '_blank')));
|
35
|
$detail_html .= "<strong>Specimen summary: $specimenPageLink</strong><br>";
|
36
|
}
|
37
|
|
38
|
|
39
|
if($is_specimen_page) {
|
40
|
if($specimen->citation){
|
41
|
$detail_html .= "<br>".$specimen->citation."<br>";
|
42
|
|
43
|
}
|
44
|
}
|
45
|
if ($specimen->preferredStableUri) {
|
46
|
$stableIdentifierLink = l($specimen->preferredStableUri, $specimen->preferredStableUri, array('attributes' => array('target' => '_blank')));
|
47
|
$detail_html .= create_label("Preferred stable URI") . $stableIdentifierLink . "<br>";
|
48
|
}
|
49
|
if ($is_specimen_page) {
|
50
|
// associated taxa
|
51
|
if ($specimen->associatedTaxa) {
|
52
|
$detail_html .= "<br>";
|
53
|
$detail_html .= create_label("Associated with");
|
54
|
if (sizeof($specimen->associatedTaxa) > 1) {
|
55
|
$detail_html .= "<br>";
|
56
|
}
|
57
|
foreach ($specimen->associatedTaxa as $associatedTaxon) {
|
58
|
$detail_html .= l($associatedTaxon->second, path_to_taxon($associatedTaxon->first, "specimens"));//$associatedTaxon->second."<br>";
|
59
|
}
|
60
|
$detail_html .= "<br>";
|
61
|
}
|
62
|
}
|
63
|
// - type information
|
64
|
$types = "";
|
65
|
if (isset($specimen->types)) {
|
66
|
//typed taxa
|
67
|
foreach ($specimen->types as $typeStatus => $typedTaxa) {
|
68
|
if($specimen->types){
|
69
|
if(empty($typeStatus) || $typeStatus == "_empty_"|| $typeStatus == ""){
|
70
|
$detail_html .= "<i>Type for:</i> ";
|
71
|
} else {
|
72
|
$detail_html .= "<i>".$typeStatus."</i> of ";
|
73
|
}
|
74
|
foreach($typedTaxa as $typedTaxon){
|
75
|
$detail_html .= $typedTaxon." ";
|
76
|
|
77
|
}
|
78
|
} else {
|
79
|
$types .= $typeStatus . " ";
|
80
|
|
81
|
}
|
82
|
}
|
83
|
}
|
84
|
$derivateDataDTO = $specimen->derivateDataDTO;
|
85
|
// - specimen scans
|
86
|
$specimenScans = create_html_links($derivateDataDTO->specimenScans, true);
|
87
|
// - molecular data
|
88
|
$molecularData = "";
|
89
|
if ($derivateDataDTO->molecularDataList) {
|
90
|
foreach ($derivateDataDTO->molecularDataList as $molecular) {
|
91
|
//provider link
|
92
|
if (isset($molecular->providerLink)) {
|
93
|
$molecularData .= create_html_link($molecular->providerLink, true);
|
94
|
} else {
|
95
|
$molecularData .= "[no provider]";
|
96
|
}
|
97
|
//contig link
|
98
|
if (isset($molecular->contigFiles)) {
|
99
|
$molecularData .= "[";
|
100
|
if (sizeof($molecular->contigFiles) > 0) {
|
101
|
foreach ($molecular->contigFiles as $contigFile) {
|
102
|
if (isset($contigFile->contigLink)) {
|
103
|
if (isset($contigFile->contigLink->uri) and $contigFile->contigLink->uri != null) {
|
104
|
$molecularData .= create_html_link($contigFile->contigLink, true) . " ";
|
105
|
}
|
106
|
} else {
|
107
|
$molecularData .= "no contig ";
|
108
|
}
|
109
|
//primer links
|
110
|
if (isset($contigFile->primerLinks)) {
|
111
|
$molecularData .= create_html_links($contigFile->primerLinks, true);
|
112
|
}
|
113
|
}
|
114
|
}
|
115
|
$molecularData = rtrim($molecularData, " ");
|
116
|
$molecularData .= "]";
|
117
|
}
|
118
|
//FIXME separate with comma (remove trailing comma)
|
119
|
}
|
120
|
}
|
121
|
// - detail images
|
122
|
$detailImages = create_html_links($derivateDataDTO->detailImages, true);
|
123
|
|
124
|
if ($types) {
|
125
|
$detail_html .= $is_specimen_page ? "<br>" : "";
|
126
|
$detail_html .= create_label("Type(s)") . $types . "<br>";
|
127
|
}
|
128
|
if ($specimenScans and !$is_specimen_page) {
|
129
|
$detail_html .= create_label("Specimen Scans") . $specimenScans . "<br>";
|
130
|
}
|
131
|
//specimen scan image gallery
|
132
|
if ($is_specimen_page and isset($derivateDataDTO->specimenScanUuids) and !empty($derivateDataDTO->specimenScanUuids)) {
|
133
|
$detail_html .= addImageGallery("Specimen scans", $derivateDataDTO->specimenScanUuids);
|
134
|
}
|
135
|
|
136
|
if ($molecularData) {
|
137
|
$detail_html .= $is_specimen_page ? "<br>" : "";
|
138
|
$detail_html .= create_label("Molecular Data") . $molecularData . "<br>";
|
139
|
}
|
140
|
|
141
|
if ($detailImages and !$is_specimen_page) {
|
142
|
$detail_html .= create_label("Detail Images") . $detailImages . "<br>";
|
143
|
}
|
144
|
|
145
|
//detail image gallery
|
146
|
if ($is_specimen_page and isset($derivateDataDTO->detailImageUuids) and !empty($derivateDataDTO->detailImageUuids)) {
|
147
|
$detail_html .= addImageGallery("Detail Images", $derivateDataDTO->detailImageUuids);
|
148
|
}
|
149
|
|
150
|
//character data
|
151
|
if ($specimen->characterData) {
|
152
|
$detail_html .= $is_specimen_page ? "<br>" : "";
|
153
|
$detail_html .= create_label("Character Data");
|
154
|
if ($is_specimen_page) {
|
155
|
$detail_html .= "<br>";
|
156
|
foreach ($specimen->characterData as $characterStatePair) {
|
157
|
$detail_html .= "<i>" . $characterStatePair->first . "</i>:" . $characterStatePair->second;
|
158
|
$detail_html .= "<br>";
|
159
|
}
|
160
|
} else {
|
161
|
$detail_html .= l("detail page", $pathToSpecimen, array('attributes' => array('target' => '_blank')));
|
162
|
$detail_html .= "<br>";
|
163
|
}
|
164
|
}
|
165
|
return $detail_html;
|
166
|
}
|
167
|
|
168
|
function addImageGallery($galleryName, $imageUuids)
|
169
|
{
|
170
|
$images = array();
|
171
|
foreach ($imageUuids as $uuid) {
|
172
|
$images[] = cdm_ws_get(CDM_WS_PORTAL_MEDIA, $uuid);
|
173
|
}
|
174
|
|
175
|
$gallery_html = '';
|
176
|
if (count($imageUuids) > 0) {
|
177
|
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME);
|
178
|
$captionElements = array(
|
179
|
'title',
|
180
|
'rights',
|
181
|
);
|
182
|
$alternativeMediaUris = array();
|
183
|
foreach ($images as $image) {
|
184
|
$mediaUri = getMediaUri($image);
|
185
|
if ($mediaUri) {
|
186
|
$alternativeMediaUris[] = $mediaUri;
|
187
|
} else {
|
188
|
$alternativeMediaUris[] = path_to_media($image->uuid);
|
189
|
}
|
190
|
}
|
191
|
|
192
|
$gallery_html = compose_cdm_media_gallerie(array(
|
193
|
'mediaList' => $images,
|
194
|
'galleryName' => $galleryName,
|
195
|
'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],
|
196
|
'cols' => $gallery_settings['cdm_dataportal_media_cols'],
|
197
|
'maxRows' => isset($gallery_settings['cdm_dataportal_media_maxRows']) ? isset($gallery_settings['cdm_dataportal_media_maxRows']) : null,
|
198
|
'captionElements' => $captionElements,
|
199
|
'mediaLinkType' => 'LIGHTBOX',
|
200
|
'alternativeMediaUri' => $alternativeMediaUris,
|
201
|
'galleryLinkUri' => NULL,
|
202
|
));
|
203
|
}
|
204
|
return "<br>" . create_label($galleryName) . "<br>" . $gallery_html;
|
205
|
}
|
206
|
|
207
|
function getMediaUri($media)
|
208
|
{
|
209
|
if (isset($media->representations) && sizeof($media->representations) == 1
|
210
|
&& isset($media->representations[0]->parts) &&
|
211
|
sizeof($media->representations[0]->parts) == 1) {
|
212
|
return $media->representations[0]->parts[0]->uri;
|
213
|
}
|
214
|
return null;
|
215
|
}
|
216
|
|
217
|
|
218
|
/**
|
219
|
* Formats the given string to a label for displaying key-object pairs in HTML
|
220
|
* @return string
|
221
|
*/
|
222
|
function create_label($label)
|
223
|
{
|
224
|
return "<span class='specimen_table_label'>" . $label . ": </span>";
|
225
|
}
|
226
|
|
227
|
/**
|
228
|
* Compose an render array from a CDM DerivedUnitFacade object.
|
229
|
*
|
230
|
* compose_hook() implementation
|
231
|
*
|
232
|
* @param object $specimenOrObservation
|
233
|
* the CDM instance of type SpecimenOrObservation to compose
|
234
|
* the render array for
|
235
|
* @param array $derivatives
|
236
|
* the render array which contains the compositions of the derivatives
|
237
|
* of the supplied $specimenOrObservation
|
238
|
*
|
239
|
* @return array
|
240
|
* the supplied render array $derivatives to which the composition of the supplied
|
241
|
* $specimenOrObservation has been added to
|
242
|
*
|
243
|
* @ingroup compose
|
244
|
*/
|
245
|
|
246
|
function compose_cdm_specimen_or_observation($specimenOrObservation, &$derivatives = null)
|
247
|
{
|
248
|
$exclude_occurrence_fields = &drupal_static(__FUNCTION__);
|
249
|
if (!isset($exclude_occurrence_fields)) {
|
250
|
$exclude_occurrence_fields = array(
|
251
|
'derivationEvents',
|
252
|
'titleCache',
|
253
|
'protectedTitleCache',
|
254
|
'derivedUnitMedia',
|
255
|
'created',
|
256
|
'publish',
|
257
|
'updated',
|
258
|
'class',
|
259
|
'uuid',
|
260
|
''
|
261
|
);
|
262
|
}
|
263
|
|
264
|
|
265
|
// only show uuid it the user is logged in
|
266
|
if(user_is_logged_in() && ($a_idx = array_search('uuid', $exclude_occurrence_fields)) !== FALSE ) {
|
267
|
unset($exclude_occurrence_fields[$a_idx]);
|
268
|
}
|
269
|
|
270
|
if (!isset($derivatives)) {
|
271
|
$derivatives = array();
|
272
|
}
|
273
|
|
274
|
$descriptions = null;
|
275
|
$derivedFrom = null;
|
276
|
|
277
|
if (is_object($specimenOrObservation)) {
|
278
|
|
279
|
// request again for deeper initialization
|
280
|
$specimenOrObservation = cdm_ws_get("portal/" . CDM_WS_OCCURRENCE, $specimenOrObservation->uuid);
|
281
|
|
282
|
|
283
|
$type_label = $specimenOrObservation->class;
|
284
|
RenderHints::setFootnoteListKey($type_label . '-' . $specimenOrObservation->uuid);
|
285
|
|
286
|
// collect typeStatus as label
|
287
|
if (isset($specimenOrObservation->specimenTypeDesignations)) {
|
288
|
$type_status = array();
|
289
|
foreach ($specimenOrObservation->specimenTypeDesignations as $typeDesignation) {
|
290
|
if (isset($typeDesignation->typeStatus->representation_L10n)) {
|
291
|
$type_status[] = $typeDesignation->typeStatus->representation_L10n;
|
292
|
}
|
293
|
}
|
294
|
if (count($type_status) > 0) {
|
295
|
$type_label = implode(', ', $type_status);
|
296
|
}
|
297
|
}
|
298
|
|
299
|
$title = $type_label . ': ' . $specimenOrObservation->titleCache;
|
300
|
|
301
|
$groups = array();
|
302
|
// --- add initialized fields
|
303
|
foreach (get_object_vars($specimenOrObservation) as $field => $value) {
|
304
|
if (!in_array($field, $exclude_occurrence_fields) && ($value && (!is_object($value) || isset($value->class)))) {
|
305
|
switch ($field) {
|
306
|
|
307
|
/* ---- java.lang.Object --- */
|
308
|
case 'class':
|
309
|
if ($value != '' /* FieldUnit' */) {
|
310
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value);
|
311
|
}
|
312
|
break;
|
313
|
|
314
|
case 'markers':
|
315
|
$dd_elements = array();
|
316
|
foreach ($value as $marker) {
|
317
|
$dd_elements[] = compose_cdm_marker($marker);
|
318
|
}
|
319
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements);
|
320
|
break;
|
321
|
|
322
|
|
323
|
case 'annotations':
|
324
|
$dd_elements = array();
|
325
|
foreach ($value as $annotation) {
|
326
|
// TODO respect annotation type filter settings
|
327
|
$dd_elements[] = $annotation->text;
|
328
|
}
|
329
|
@_description_list_group_add($groups, t('Notes'), $dd_elements);
|
330
|
break;
|
331
|
|
332
|
/* ---- SpecimenOrObservationBase --- */
|
333
|
case 'sex':
|
334
|
case 'lifeStage':
|
335
|
case 'kindOfUnit':
|
336
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value->representation_L10n);
|
337
|
break;
|
338
|
|
339
|
case 'definition':
|
340
|
// TODO
|
341
|
break;
|
342
|
|
343
|
case 'preferredStableUri':
|
344
|
|
345
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), array(array('#markup' => cdm_external_uri($value, false))));
|
346
|
break;
|
347
|
|
348
|
case 'specimenTypeDesignations':
|
349
|
@_description_list_group_add(
|
350
|
$groups,
|
351
|
cdm_occurrence_field_name_label($field),
|
352
|
array(
|
353
|
'#markup' => theme('cdm_typedesignations', array('typeDesignations' => $value)),
|
354
|
)
|
355
|
);
|
356
|
break;
|
357
|
|
358
|
case 'determinations':
|
359
|
$dd_elements = array();
|
360
|
$glue = ', ';
|
361
|
|
362
|
foreach ($value as $determinationEvent) {
|
363
|
$timeperiod_string = NULL;
|
364
|
if (isset($determinationEvent->timeperiod)) {
|
365
|
$timeperiod_string = timePeriodToString($determinationEvent->timeperiod);
|
366
|
}
|
367
|
$weight = isset($determinationEvent->preferred) && $determinationEvent->preferred == 1 ? '0' : ($timeperiod_string ? $timeperiod_string : '1');
|
368
|
// check key exists
|
369
|
while (array_key_exists($weight, $dd_elements)) {
|
370
|
$weight .= '0';
|
371
|
}
|
372
|
|
373
|
$taxon_name = '';
|
374
|
$name_link = '';
|
375
|
if ($determinationEvent->taxonName) {
|
376
|
$taxon_name = $determinationEvent->taxonName;
|
377
|
} else if ($determinationEvent->taxon) {
|
378
|
$taxon_name = cdm_ws_get(CDM_WS_TAXON . '/$0/name', $determinationEvent->taxon->uuid);
|
379
|
$name_link = path_to_taxon($determinationEvent->taxon->uuid);
|
380
|
}
|
381
|
if ($taxon_name) {
|
382
|
$taxon_html = render_taxon_or_name($taxon_name, $name_link);
|
383
|
$dd_elements[$weight] = $taxon_html;
|
384
|
}
|
385
|
if (isset($determinationEvent->modifier)) {
|
386
|
$dd_elements[$weight] .= cdm_term_representation($determinationEvent->modifier);
|
387
|
}
|
388
|
if ($timeperiod_string) {
|
389
|
$dd_elements[$weight] .= $glue . $timeperiod_string;
|
390
|
}
|
391
|
if (isset($determinationEvent->actor->titleCache)) {
|
392
|
$dd_elements[$weight] .= $glue . $determinationEvent->actor->titleCache;
|
393
|
}
|
394
|
if (isset($determinationEvent->description)) {
|
395
|
$dd_elements[$weight] .= $glue . $determinationEvent->description;
|
396
|
}
|
397
|
}
|
398
|
ksort($dd_elements);
|
399
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('determinations'), $dd_elements);
|
400
|
break;
|
401
|
|
402
|
case 'descriptions':
|
403
|
$occurrence_featureTree = cdm_get_occurrence_featureTree();
|
404
|
$dd_elements = array();
|
405
|
|
406
|
foreach ($value as $description) {
|
407
|
$description = cdm_ws_get(CDM_WS_PORTAL_DESCRIPTION, $description->uuid);
|
408
|
// if($description->imageGallery == TRUE) {
|
409
|
// continue;
|
410
|
// }
|
411
|
$elements_by_feature = _mergeFeatureTreeDescriptions($occurrence_featureTree->root->childNodes, $description->elements);
|
412
|
$description_render_elements = _block_get_renderable_array(make_feature_block_list($elements_by_feature, null));
|
413
|
$dd_elements[] = $description_render_elements;
|
414
|
}
|
415
|
|
416
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements);
|
417
|
break;
|
418
|
|
419
|
case 'sources':
|
420
|
$dd_elements = array();
|
421
|
foreach ($value as $identifiable_source) {
|
422
|
$dd_elements[] = theme('cdm_OriginalSource', array('source' => $identifiable_source));
|
423
|
}
|
424
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements);
|
425
|
break;
|
426
|
|
427
|
|
428
|
/* ---- DerivedUnitBase --- */
|
429
|
case 'derivedFrom':
|
430
|
$derivedFrom = $value;
|
431
|
break;
|
432
|
|
433
|
case 'collection':
|
434
|
$sub_dl_groups = array();
|
435
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('code'), $value->code, NULL, 1);
|
436
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('codeStandard'), $value->codeStandard, NULL, 2);
|
437
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('institute'), $value->institute, NULL, 3);
|
438
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('townOrLocation'), $value->townOrLocation, NULL, 4);
|
439
|
// TODO "superCollection"
|
440
|
// TODO may have media
|
441
|
|
442
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field),
|
443
|
array(
|
444
|
array('#markup' => $value->titleCache),
|
445
|
array('#theme' => 'description_list', '#groups' => $sub_dl_groups)
|
446
|
)
|
447
|
);
|
448
|
break;
|
449
|
|
450
|
case 'storedUnder':
|
451
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('storedUnder'), render_taxon_or_name($value));
|
452
|
break;
|
453
|
|
454
|
|
455
|
/* ---- Specimen --- */
|
456
|
case 'sequences':
|
457
|
$dd_elements = array();
|
458
|
foreach ($value as $sequence) {
|
459
|
$dd_elements[] = compose_cdm_sequence($sequence);
|
460
|
}
|
461
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements);
|
462
|
break;
|
463
|
|
464
|
// TODO preservation
|
465
|
// TODO exsiccatum
|
466
|
|
467
|
|
468
|
/* ---- FieldObservation --- */
|
469
|
case 'gatheringEvent':
|
470
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('collector'), $value->actor->titleCache);
|
471
|
@_description_list_group_add($groups, t('Gathering time'), timePeriodToString($value->timeperiod));
|
472
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('description'), $value->description);
|
473
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('locality'), $value->locality->text);
|
474
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('country'), $value->country->representation_L10n);
|
475
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('collectingMethod'), $value->collectingMethod);
|
476
|
if (isset($value->absoluteElevation)) {
|
477
|
$min_max_markup = min_max_measure($value, 'absoluteElevation');
|
478
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('absoluteElevation'), $min_max_markup);
|
479
|
}
|
480
|
if (isset($value->distanceToGround)) {
|
481
|
$min_max_markup = min_max_measure($value, 'distanceToGround');
|
482
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('distanceToGround'), $min_max_markup);
|
483
|
}
|
484
|
if (isset($value->distanceToWaterSurface)) {
|
485
|
$min_max_markup = min_max_measure($value, 'distanceToWaterSurface');
|
486
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('distanceToWaterSurface'), $min_max_markup);
|
487
|
}
|
488
|
|
489
|
if (isset($value->collectingAreas) && count($value->collectingAreas) > 0) {
|
490
|
$area_representations = array();
|
491
|
foreach ($value->collectingAreas as $area) {
|
492
|
$area_representations[] = l($area->representation_L10n, path_to_named_area($area->uuid));
|
493
|
}
|
494
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('collectingAreas'),
|
495
|
array(
|
496
|
array('#markup' => implode(', ', $area_representations))
|
497
|
)
|
498
|
);
|
499
|
}
|
500
|
if (isset($value->exactLocation) && $value->exactLocation->sexagesimalString) {
|
501
|
$sub_dl_groups = array();
|
502
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('errorRadius'), $value->exactLocation->errorRadius, ' m', 1);
|
503
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('longitude'), round($value->exactLocation->longitude, 7), '°', 2);
|
504
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('latitude'), round($value->exactLocation->latitude, 7), '°', 3);
|
505
|
if (isset($value->exactLocation->referenceSystem)) {
|
506
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('referenceSystem'), $value->exactLocation->referenceSystem->representation_L10n, '', 4);
|
507
|
}
|
508
|
|
509
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('exactLocation'),
|
510
|
array(
|
511
|
array('#markup' => $value->exactLocation->sexagesimalString),
|
512
|
array(
|
513
|
'#theme' => 'description_list',
|
514
|
'#groups' => $sub_dl_groups
|
515
|
),
|
516
|
)
|
517
|
);
|
518
|
}
|
519
|
break;
|
520
|
|
521
|
default:
|
522
|
if (is_object($value) || is_array($value)) {
|
523
|
drupal_set_message("Unhandled type in compose_cdm_specimen_or_observation() for field " . $field, "warning");
|
524
|
} else {
|
525
|
_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value);
|
526
|
}
|
527
|
|
528
|
}
|
529
|
|
530
|
}
|
531
|
} // END of loop over $derivedUnitFacade fields
|
532
|
|
533
|
// Extensions
|
534
|
$extensions = cdm_ws_fetch_all(CDM_WS_PORTAL_OCCURRENCE . '/' . $specimenOrObservation->uuid . '/extensions', array($specimenOrObservation->uuid));
|
535
|
if ($extensions && count($extensions)) {
|
536
|
|
537
|
$extensions_render_array = compose_extensions($extensions);
|
538
|
@_description_list_group_add($groups, t('Extensions') . ':',
|
539
|
$extensions_render_array,
|
540
|
'', 100);
|
541
|
}
|
542
|
|
543
|
|
544
|
// template_preprocess_description_list() is not worting by weight so we do it right here
|
545
|
uasort($groups, 'element_sort');
|
546
|
|
547
|
$occurrence_elements = array(
|
548
|
'#title' => $title,
|
549
|
'#theme' => 'description_list',
|
550
|
'#groups' => $groups,
|
551
|
'#attributes' => array('class' => html_class_attribute_ref($specimenOrObservation)),
|
552
|
);
|
553
|
$derivatives[] = $occurrence_elements;
|
554
|
// all footnotes which has been assembled so far (e.g. from typeDesignations) to here
|
555
|
$foonote_li_elements = theme('cdm_footnotes', array('footnoteListKey' => RenderHints::getFootnoteListKey(), 'enclosingTag' => 'span'));
|
556
|
if (!empty($foonote_li_elements)) {
|
557
|
$derivatives[] = array(
|
558
|
'#markup' => '<div class="footnotes">' . $foonote_li_elements . '</div>',
|
559
|
);
|
560
|
}
|
561
|
|
562
|
// --- recurse into originals
|
563
|
if (!isset($derivedFrom)) {
|
564
|
$derivedFrom = cdm_ws_get(
|
565
|
CDM_WS_OCCURRENCE,
|
566
|
array($specimenOrObservation->uuid, 'derivedFrom')
|
567
|
);
|
568
|
}
|
569
|
|
570
|
if (isset($derivedFrom)) {
|
571
|
if (isset($derivedFrom->originals)) {
|
572
|
$derived_from_label = t('derived');
|
573
|
$preposition = t('from');
|
574
|
if(isset($derivedFrom->type)){
|
575
|
$derived_from_label = $derivedFrom->type->representation_L10n;
|
576
|
if($derivedFrom->type->uuid == UUID_DERIVATIONEVENTTYPE_ACCESSIONING){
|
577
|
$preposition = t('of');
|
578
|
}
|
579
|
}
|
580
|
if (count($groups) > 0) {
|
581
|
// TODO annotations
|
582
|
|
583
|
// only display the derived from information when the derivative has any element which will be diplayed
|
584
|
$derivatives[] = array(
|
585
|
'#markup' => '<div class="derived_from">' . $derived_from_label . ' ' . $preposition . ': </div>',
|
586
|
);
|
587
|
}
|
588
|
foreach ($derivedFrom->originals as $original) {
|
589
|
compose_cdm_specimen_or_observation($original, $derivatives);
|
590
|
}
|
591
|
}
|
592
|
}
|
593
|
|
594
|
} // END of $specimenOrObservation exists
|
595
|
|
596
|
return $derivatives;
|
597
|
}
|
598
|
|
599
|
|
600
|
/**
|
601
|
* Compose an render array from a CDM Sequence object.
|
602
|
*
|
603
|
* compose_hook() implementation
|
604
|
*
|
605
|
* @param object $sequence
|
606
|
* CDM instance of type Sequence
|
607
|
* @return array
|
608
|
* A render array containing the fields of the supplied $sequence
|
609
|
*
|
610
|
* @ingroup compose
|
611
|
*/
|
612
|
function compose_cdm_sequence($sequence, $isSpecimenPage = false)
|
613
|
{
|
614
|
|
615
|
$exclude_sequence_fields = &drupal_static(__FUNCTION__);
|
616
|
if (!isset($exclude_sequence_fields)) {
|
617
|
$exclude_sequence_fields = array(
|
618
|
'titleCache',
|
619
|
'protectedTitleCache',
|
620
|
'microReference',
|
621
|
'created',
|
622
|
'updated',
|
623
|
'class',
|
624
|
'dnaMarker'
|
625
|
);
|
626
|
}
|
627
|
|
628
|
$groups = array();
|
629
|
|
630
|
// -- retrieve additional data if neesscary
|
631
|
// TODO below call disabled since sequences are not yet supported,
|
632
|
// see #3347 (services and REST service controller for molecular classes implemented)
|
633
|
//
|
634
|
// cdm_load_annotations($sequence);
|
635
|
|
636
|
foreach (get_object_vars($sequence) as $field => $value) {
|
637
|
|
638
|
|
639
|
if (!in_array($field, $exclude_sequence_fields) && ($value && (!is_object($value) || isset($value->class)))) {
|
640
|
switch ($field) {
|
641
|
|
642
|
case 'geneticAccessionNumber';
|
643
|
|
644
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value, NULL, 2);
|
645
|
break;
|
646
|
|
647
|
|
648
|
/*case 'dnaMarker': // FIXME 3.3 now dnaMarker (DefinedTerm) if multiple amplifications where used to build this consensus sequence it may be the super set of the markers used in amplification.
|
649
|
/*if (isset($value->name)) {
|
650
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value->name, NULL, 3);
|
651
|
}
|
652
|
if (isset($value->description)) {
|
653
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field) . ' ' . t('description'), $value->description, NULL, 4);
|
654
|
}
|
655
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field) , $value, NULL, 4);
|
656
|
break;
|
657
|
*/
|
658
|
case 'consensusSequence':
|
659
|
// format in genbank style, force linebreaks after each 70 nucleotites
|
660
|
// see also http://stackoverflow.com/questions/499137/css-how-can-i-force-a-long-string-without-any-blank-to-be-wrapped-in-xul-and
|
661
|
if ($value->length > 0) {
|
662
|
@_description_list_group_add(
|
663
|
$groups,
|
664
|
cdm_occurrence_field_name_label($field),
|
665
|
array(
|
666
|
array(
|
667
|
'#markup' => '<div class="sequence-length">' . $value->length . ' ' . t('pb') . '</div><div>' . wordwrap($value->string, 70, '</br>', TRUE) . '</div>',
|
668
|
'#wrapper_attributes' => array('class' => 'dna-sequence')
|
669
|
)
|
670
|
),
|
671
|
5);
|
672
|
}
|
673
|
break;
|
674
|
|
675
|
case 'dnaSample': // FIXME 3.3 implement
|
676
|
break;
|
677
|
case 'singleReads': // FIXME 3.3 implement
|
678
|
break;
|
679
|
case 'contigFile': // FIXME 3.3 implement - Media
|
680
|
break;
|
681
|
case 'pherograms': // FIXME 3.3 implement - Media
|
682
|
break;
|
683
|
case 'haplotype': // FIXME 3.3 implement
|
684
|
break;
|
685
|
case 'dateSequenced': // FIXME 3.3 now in SingelRead
|
686
|
@_description_list_group_add($groups, t('Sequencing date'), timePeriodToString($value), NULL, 6);
|
687
|
break;
|
688
|
|
689
|
case 'barcode': // boolean
|
690
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value ? 'Yes' : 'No', NULL, 7);
|
691
|
break;
|
692
|
case 'barcodeSequencePart': // FIXME 3.3 implement, compose sequence
|
693
|
break;
|
694
|
|
695
|
case 'citation':
|
696
|
@_description_list_group_add($groups,
|
697
|
cdm_occurrence_field_name_label($field),
|
698
|
theme('cdm_reference', array('reference' => $value, 'microReference' => $sequence->microReference)),
|
699
|
NULL,
|
700
|
8
|
701
|
);
|
702
|
break;
|
703
|
|
704
|
case 'publishedIn':
|
705
|
@_description_list_group_add($groups,
|
706
|
cdm_occurrence_field_name_label($field),
|
707
|
theme('cdm_reference', array('reference' => $value)),
|
708
|
NULL,
|
709
|
7
|
710
|
);
|
711
|
break;
|
712
|
|
713
|
case 'rights':
|
714
|
array_merge($groups, cdm_rights_as_dl_groups($value));
|
715
|
break;
|
716
|
|
717
|
case 'annotations':
|
718
|
$dd_elements = array();
|
719
|
foreach ($value as $annotation) {
|
720
|
// TODO respect annotation type filter settings
|
721
|
$dd_elements[] = $annotation->text;
|
722
|
}
|
723
|
@_description_list_group_add($groups, t('Notes'), $dd_elements, NULL, 9);
|
724
|
break;
|
725
|
|
726
|
case 'markers':
|
727
|
$dd_elements = array();
|
728
|
foreach ($value as $marker) {
|
729
|
$dd_elements[] = compose_cdm_marker($marker);
|
730
|
}
|
731
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements, NULL, 10);
|
732
|
break;
|
733
|
|
734
|
case 'chromatograms':
|
735
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field),
|
736
|
array(
|
737
|
'#markup' => compose_cdm_media_gallerie(array('medialist' => $value)),
|
738
|
),
|
739
|
NULL,
|
740
|
11);
|
741
|
break;
|
742
|
|
743
|
default:
|
744
|
if (is_object($value) || is_array($value)) {
|
745
|
drupal_set_message("Unhandled type in compose_cdm_sequence() for field " . $field, "warning");
|
746
|
} else {
|
747
|
if (!is_array($value) && strpos($value, 'http:') !== false ){
|
748
|
//make links for urls
|
749
|
$value = l($value, $value, array('attributes' => array('target' => '_blank')));
|
750
|
}
|
751
|
_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value, NULL, 20, null, false);
|
752
|
}
|
753
|
}
|
754
|
}
|
755
|
}
|
756
|
|
757
|
// template_preprocess_description_list() is not worting by weight so we do it right here
|
758
|
uasort($groups, 'element_sort');
|
759
|
if ($isSpecimenPage) {
|
760
|
$sequence_elements = array(
|
761
|
'#title' => $sequence->dnaMarker,
|
762
|
'#theme' => 'description_list',
|
763
|
'#groups' => $groups
|
764
|
);
|
765
|
} else{
|
766
|
$sequence_elements = array(
|
767
|
'#title' => $sequence->dnaMarker -> titleCache,
|
768
|
'#theme' => 'description_list',
|
769
|
'#groups' => $groups
|
770
|
);
|
771
|
}
|
772
|
|
773
|
return $sequence_elements;
|
774
|
}
|
775
|
/**
|
776
|
* Creates an array from a list of FieldUnitDTOs.
|
777
|
*
|
778
|
*
|
779
|
* @param object $specimenOrObservations
|
780
|
* list of FieldUnitDTOs
|
781
|
* @return array
|
782
|
* An array containing the hierarchy of the field units corresponding to the taxon
|
783
|
*
|
784
|
* @ingroup compose
|
785
|
*/
|
786
|
function compose_specimen_array(array $specimenOrObservations){
|
787
|
$items_specimen = array();
|
788
|
$items = array();
|
789
|
|
790
|
//we need one more item to contain the items of one level (fieldunit, derivate data etc.)
|
791
|
foreach ($specimenOrObservations as &$specimenOrObservation) {
|
792
|
|
793
|
$items['data'] = $specimenOrObservation->listLabel ;
|
794
|
$specimen = compose_cdm_specimen_or_observation_tree_entry($specimenOrObservation);
|
795
|
$children = array();
|
796
|
$child = array();
|
797
|
$child['data'] =$specimen;
|
798
|
// $children[] = create_specimen_array($specimenOrObservation->derivates);
|
799
|
if (isset($specimenOrObservation->derivates) && sizeof($specimenOrObservation->derivates) > 0){
|
800
|
$child['children']= compose_specimen_array($specimenOrObservation->derivates);
|
801
|
}
|
802
|
$children[]=$child;
|
803
|
$items['children'] = $children;
|
804
|
$items_specimen[] = $items;
|
805
|
}
|
806
|
return $items_specimen;
|
807
|
}
|
808
|
|
809
|
|
810
|
/**
|
811
|
* Compose an render array from a CDM DerivedUnitFacade object.
|
812
|
*
|
813
|
* compose_hook() implementation
|
814
|
*
|
815
|
* @param object $specimenOrObservation
|
816
|
* the CDM instance of type SpecimenOrObservation to compose
|
817
|
* the render array for
|
818
|
* @param array $derivatives
|
819
|
* the render array which contains the compositions of the derivatives
|
820
|
* of the supplied $specimenOrObservation
|
821
|
*
|
822
|
* @return array
|
823
|
* the supplied render array $derivatives to which the composition of the supplied
|
824
|
* $specimenOrObservation has been added to
|
825
|
*
|
826
|
* @ingroup compose
|
827
|
*/
|
828
|
|
829
|
function compose_cdm_specimen_or_observation_tree_entry($specimenOrObservation)
|
830
|
{
|
831
|
$exclude_occurrence_fields = &drupal_static(__FUNCTION__);
|
832
|
if (!isset($exclude_occurrence_fields)) {
|
833
|
$exclude_occurrence_fields = array(
|
834
|
'type',
|
835
|
'derivationEvent',
|
836
|
'taxonRelatedDerivedUnits',
|
837
|
'label',
|
838
|
'titleCache',
|
839
|
'listLabel',
|
840
|
'protectedTitleCache',
|
841
|
'class',
|
842
|
'uuid',
|
843
|
'collectionDTO',
|
844
|
'derivates'
|
845
|
);
|
846
|
}
|
847
|
$items = array();
|
848
|
|
849
|
// only show uuid it the user is logged in
|
850
|
if (user_is_logged_in() && ($a_idx = array_search('uuid', $exclude_occurrence_fields)) !== FALSE) {
|
851
|
// unset($exclude_occurrence_fields[$a_idx]);
|
852
|
}
|
853
|
|
854
|
|
855
|
if (is_object($specimenOrObservation)) {
|
856
|
|
857
|
$type_label = $specimenOrObservation->recordBase;
|
858
|
RenderHints::setFootnoteListKey($type_label . '-' . $specimenOrObservation->uuid);
|
859
|
|
860
|
// collect typeStatus as label
|
861
|
if (isset($specimenOrObservation->specimenTypeDesignations)) {
|
862
|
$type_status = array();
|
863
|
foreach ($specimenOrObservation->specimenTypeDesignations as $typeDesignation) {
|
864
|
if (isset($typeDesignation->typeStatus->representation_L10n)) {
|
865
|
$type_status[] = $typeDesignation->typeStatus->representation_L10n;
|
866
|
}
|
867
|
}
|
868
|
if (count($type_status) > 0) {
|
869
|
$type_label = implode(', ', $type_status);
|
870
|
}
|
871
|
}
|
872
|
|
873
|
$title = $type_label . ': ' . $specimenOrObservation->titleCache;
|
874
|
$items['data'] = $title;
|
875
|
|
876
|
$groups = array();
|
877
|
$items['children'] = $groups;
|
878
|
$children_items = array();
|
879
|
// --- add initialized fields
|
880
|
foreach (get_object_vars($specimenOrObservation) as $field => $value) {
|
881
|
$child_item = array();
|
882
|
|
883
|
if (!in_array($field, $exclude_occurrence_fields) && ($value && (!is_object($value) || isset($value->class)))) {
|
884
|
switch ($field) {
|
885
|
|
886
|
/* ---- SpecimenOrObservationBase --- */
|
887
|
|
888
|
case 'kindOfUnit':
|
889
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value, NULL, 1);
|
890
|
break;
|
891
|
|
892
|
|
893
|
case 'preferredStableUri':
|
894
|
|
895
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), array(array('#markup' => cdm_external_uri($value, false))));
|
896
|
break;
|
897
|
|
898
|
case 'specimenTypeDesignations':
|
899
|
@_description_list_group_add(
|
900
|
$groups,
|
901
|
cdm_occurrence_field_name_label($field),
|
902
|
array(
|
903
|
'#markup' => theme('cdm_typedesignations', array('typeDesignations' => $value)),
|
904
|
)
|
905
|
);
|
906
|
break;
|
907
|
|
908
|
|
909
|
|
910
|
case 'listOfMedia':
|
911
|
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME);
|
912
|
$captionElements = array(
|
913
|
'#uri' => t('open media'),
|
914
|
);
|
915
|
$gallery_html = compose_cdm_media_gallerie(array(
|
916
|
'mediaList' => $value,
|
917
|
'galleryName' => $specimenOrObservation->label,
|
918
|
'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'],
|
919
|
'cols' => $gallery_settings['cdm_dataportal_media_cols'],
|
920
|
'maxRows' => isset($gallery_settings['cdm_dataportal_media_maxRows']) ? isset($gallery_settings['cdm_dataportal_media_maxRows']) : null,
|
921
|
'captionElements' => $captionElements,
|
922
|
'mediaLinkType' => 'LIGHTBOX',
|
923
|
'alternativeMediaUri' => NULL,
|
924
|
'galleryLinkUri' => NULL,
|
925
|
));
|
926
|
|
927
|
//@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $gallery_html);
|
928
|
break;
|
929
|
|
930
|
|
931
|
|
932
|
/* ---- DerivedUnitBase --- */
|
933
|
|
934
|
|
935
|
case 'collection':
|
936
|
|
937
|
$sub_dl_groups = array();
|
938
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('code'), $value->code, NULL, 1);
|
939
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('codeStandard'), $value->codeStandard, NULL, 2);
|
940
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('institute'), $value->institute, NULL, 3);
|
941
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('townOrLocation'), $value->townOrLocation, NULL, 4);
|
942
|
// TODO "superCollection"
|
943
|
// TODO may have media
|
944
|
|
945
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field),
|
946
|
array(
|
947
|
array('#markup' => $value->titleCache),
|
948
|
array('#theme' => 'description_list', '#groups' => $sub_dl_groups)
|
949
|
)
|
950
|
);
|
951
|
|
952
|
break;
|
953
|
|
954
|
|
955
|
|
956
|
|
957
|
/* ---- Specimen --- */
|
958
|
case 'sequences':
|
959
|
$dd_elements = array();
|
960
|
foreach ($value as $sequence) {
|
961
|
$dd_elements[] = compose_cdm_sequence($sequence, true);
|
962
|
$dd_elements[] = "";
|
963
|
}
|
964
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements,'', 100);
|
965
|
break;
|
966
|
|
967
|
// TODO preservation
|
968
|
// TODO exsiccatum
|
969
|
|
970
|
|
971
|
/* ---- FieldObservation --- */
|
972
|
case 'gatheringEvent':
|
973
|
|
974
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('collector'), $value->collector);
|
975
|
@_description_list_group_add($groups, t('Gathering time'), timePeriodToString($value->timeperiod));
|
976
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('description'), $value->description);
|
977
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('locality'), $value->locality);
|
978
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('country'), $value->country);
|
979
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('collectingMethod'), $value->collectingMethod);
|
980
|
if (isset($value->absoluteElevation)) {
|
981
|
$min_max_markup = min_max_measure($value, 'absoluteElevation');
|
982
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('absoluteElevation'), $min_max_markup);
|
983
|
}
|
984
|
if (isset($value->distanceToGround) && $value->distanceToGround >0) {
|
985
|
$min_max_markup = min_max_measure($value, 'distanceToGround');
|
986
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('distanceToGround'), $min_max_markup);
|
987
|
}
|
988
|
if (isset($value->distanceToWaterSurface) && $value->distanceToWaterSurface > 0) {
|
989
|
$min_max_markup = min_max_measure($value, 'distanceToWaterSurface');
|
990
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('distanceToWaterSurface'), $min_max_markup);
|
991
|
}
|
992
|
|
993
|
if (isset($value->collectingAreas)) {
|
994
|
$area_representations = array();
|
995
|
foreach ($value->collectingAreas as $area) {
|
996
|
// $area_representations[] = l($area->representation_L10n, path_to_named_area($area->uuid));
|
997
|
$area_representations[] = $area;
|
998
|
}
|
999
|
if (!empty($area_representations))
|
1000
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('collectingAreas'),
|
1001
|
array(
|
1002
|
array('#markup' => implode(', ', $area_representations))
|
1003
|
)
|
1004
|
);
|
1005
|
}
|
1006
|
if (isset($value->exactLocation) ) {
|
1007
|
$sub_dl_groups = array();
|
1008
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('errorRadius'), $value->exactLocation->errorRadius, ' m', 1);
|
1009
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('longitude'), round($value->exactLocation->longitude, 7), '°', 2);
|
1010
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('latitude'), round($value->exactLocation->latitude, 7), '°', 3);
|
1011
|
if (isset($value->exactLocation->referenceSystem)) {
|
1012
|
@_description_list_group_add($sub_dl_groups, cdm_occurrence_field_name_label('referenceSystem'), $value->exactLocation->referenceSystem->representation_L10n, '', 4);
|
1013
|
}
|
1014
|
if ( isSet($value->exactLocation->sexagesimalString)){
|
1015
|
@_description_list_group_add($groups, cdm_occurrence_field_name_label('exactLocation'),
|
1016
|
array(
|
1017
|
array('#markup' => $value->exactLocation->sexagesimalString),
|
1018
|
array(
|
1019
|
'#theme' => 'description_list',
|
1020
|
'#groups' => $sub_dl_groups
|
1021
|
),
|
1022
|
)
|
1023
|
);
|
1024
|
}
|
1025
|
}
|
1026
|
|
1027
|
break;
|
1028
|
|
1029
|
/* ---- DerivationEvent --- */
|
1030
|
case 'derivationEvents':
|
1031
|
//@_description_list_group_add($groups, t('Association type'), $value->description);
|
1032
|
break;
|
1033
|
|
1034
|
|
1035
|
default:
|
1036
|
if (is_object($value) || is_array($value)) {
|
1037
|
drupal_set_message("Unhandled type in compose_cdm_specimenOrObservation() for field " . $field, "warning");
|
1038
|
} else {
|
1039
|
_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value);
|
1040
|
}
|
1041
|
|
1042
|
}
|
1043
|
|
1044
|
|
1045
|
}
|
1046
|
} // END of loop over $derivedUnitFacade fields
|
1047
|
|
1048
|
|
1049
|
|
1050
|
// template_preprocess_description_list() is not worting by weight so we do it right here
|
1051
|
uasort($groups, 'element_sort');
|
1052
|
|
1053
|
$occurrence_elements = array(
|
1054
|
// '#title' => $title,
|
1055
|
'#theme' => 'description_list',
|
1056
|
'#groups' => $groups,
|
1057
|
'#attributes' => array('class' => html_class_attribute_ref($specimenOrObservation)),
|
1058
|
);
|
1059
|
$output = drupal_render($occurrence_elements);
|
1060
|
if (isset($gallery_html)){
|
1061
|
$output .= $gallery_html;
|
1062
|
}
|
1063
|
if (!($specimenOrObservation->type == 'FieldUnit')){
|
1064
|
$pathToSpecimen = path_to_specimen($specimenOrObservation->uuid);
|
1065
|
$output .= l("detail page", $pathToSpecimen, array('attributes' => array('target' => '_blank')));
|
1066
|
}
|
1067
|
|
1068
|
|
1069
|
|
1070
|
|
1071
|
|
1072
|
|
1073
|
|
1074
|
|
1075
|
|
1076
|
|
1077
|
} // END of $specimenOrObservation exists
|
1078
|
|
1079
|
return $output;
|
1080
|
}
|
1081
|
|