Revision c70b93c3
Added by Andreas Kohlbecker over 11 years ago
.gitattributes | ||
---|---|---|
876 | 876 |
7.x/modules/cdm_dataportal/images/loading_circle_grey_16.gif -text |
877 | 877 |
7.x/modules/cdm_dataportal/images/macFFBgHack.png -text |
878 | 878 |
7.x/modules/cdm_dataportal/images/print_icon.gif -text |
879 |
7.x/modules/cdm_dataportal/includes/occurrences.inc -text |
|
880 |
7.x/modules/cdm_dataportal/includes/pages.inc -text |
|
879 | 881 |
7.x/modules/cdm_dataportal/jenkins-ci/dataportal-version-update/HOWTO-UPDATE -text |
880 | 882 |
7.x/modules/cdm_dataportal/jenkins-ci/dataportal-version-update/update-to.sh -text |
881 | 883 |
7.x/modules/cdm_dataportal/jenkins-ci/deploy.sh -text |
7.x/modules/cdm_dataportal/cdm_dataportal.info | ||
---|---|---|
11 | 11 |
files[] = classes/footnotemanager.php |
12 | 12 |
files[] = classes/renderhints.php |
13 | 13 |
|
14 |
|
|
14 | 15 |
configure = admin/config/cdm_dataportal/settings |
7.x/modules/cdm_dataportal/cdm_dataportal.module | ||
---|---|---|
22 | 22 |
module_load_include('php', 'cdm_dataportal', 'help'); |
23 | 23 |
module_load_include('php', 'cdm_dataportal', 'cdm_dataportal.search'); |
24 | 24 |
|
25 |
module_load_include('php', 'cdm_dataportal', 'cdm_dataportal.page.php');
|
|
26 |
module_load_include('php', 'cdm_dataportal', 'cdm_dataportal.occurrences.php');
|
|
25 |
module_load_include('inc', 'cdm_dataportal', 'includes/pages');
|
|
26 |
module_load_include('inc', 'cdm_dataportal', 'includes/occurrences');
|
|
27 | 27 |
|
28 | 28 |
module_load_include('theme', 'cdm_dataportal', 'theme/cdm_dataportal.common'); |
29 | 29 |
module_load_include('theme', 'cdm_dataportal', 'theme/cdm_dataportal.descriptions'); |
7.x/modules/cdm_dataportal/includes/occurrences.inc | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* @file |
|
4 |
* Functions for dealing with CDM entities of type SpeciemenOrOccurrences |
|
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 |
|
7.x/modules/cdm_dataportal/includes/pages.inc | ||
---|---|---|
1 |
<?php |
|
2 |
/** |
|
3 |
* @file |
|
4 |
* Page functions. |
|
5 |
* |
|
6 |
* @copyright |
|
7 |
* (C) 2007-2012 EDIT |
|
8 |
* European Distributed Institute of Taxonomy |
|
9 |
* http://www.e-taxonomy.eu |
|
10 |
* |
|
11 |
* The contents of this module are subject to the Mozilla |
|
12 |
* Public License Version 1.1. |
|
13 |
* @see http://www.mozilla.org/MPL/MPL-1.1.html |
|
14 |
* |
|
15 |
* @author |
|
16 |
* - Andreas Kohlbecker <a.kohlbecker@BGBM.org> |
|
17 |
*/ |
|
18 |
|
|
19 |
|
|
20 |
/** |
|
21 |
* Creates a render array representing the ocurrences associetad with the $taxon. |
|
22 |
* |
|
23 |
* The resulting render array contains two elements: |
|
24 |
* - 'map': A map showing all point locations of the occurences is availabale |
|
25 |
* - 'specimen_list': the list of occurences prepated as table for theme_table() |
|
26 |
* |
|
27 |
* @param object $taxon |
|
28 |
* A cdm Taxon object |
|
29 |
* @return |
|
30 |
* A render array suitable for drupal_render() |
|
31 |
* |
|
32 |
* FIXME: map not including locations of related taxa !!!! |
|
33 |
*/ |
|
34 |
function cdm_dataportal_taxon_page_specimens($taxon) { |
|
35 |
|
|
36 |
$render_array = array(); |
|
37 |
RenderHints::pushToRenderStack('taxon_page_specimens'); |
|
38 |
|
|
39 |
$congruentTo = "60974c98-64ab-4574-bb5c-c110f6db634d"; //TODO make configurable in settings |
|
40 |
$specimensOrObservations = cdm_ws_get(CDM_WS_OCCURRENCE_BY_ASSOCIATEDTAXON, |
|
41 |
null, |
|
42 |
drupal_http_build_query(array( |
|
43 |
'taxonUuid' => $taxon->uuid, |
|
44 |
'relationshipUuids' => $congruentTo, |
|
45 |
'relationshipInversUuids' => $congruentTo, |
|
46 |
'pageSize' => null // al hits in one page |
|
47 |
) |
|
48 |
) |
|
49 |
); |
|
50 |
|
|
51 |
// TODO uncomment once CDM_WS_OCCURRENCE_BY_ASSOCIATEDTAXON is returning a pager |
|
52 |
// $specimensOrObservations = array(); |
|
53 |
// if(isset($pager->records[0])){ |
|
54 |
// $specimensOrObservations = $pager->records; |
|
55 |
// } |
|
56 |
|
|
57 |
// Collect media (fieldObjectMedia, derivedUnitMedia) and add as a custom field |
|
58 |
// $occurrence->_fieldObjectMedia |
|
59 |
foreach ($specimensOrObservations as &$occurrence) { |
|
60 |
$occurrence->_fieldObjectMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array( |
|
61 |
$occurrence->uuid, |
|
62 |
'fieldObjectMedia', |
|
63 |
)); |
|
64 |
$occurrence->_derivedUnitMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array( |
|
65 |
$occurrence->uuid, |
|
66 |
'derivedUnitMedia', |
|
67 |
)); |
|
68 |
} |
|
69 |
|
|
70 |
// --- get map service HTTP query paramaters |
|
71 |
if (count($specimensOrObservations) > 0) { |
|
72 |
$occurrenceQuery = cdm_ws_get(CDM_WS_GEOSERVICE_OCCURRENCEMAP, $taxon->uuid); |
|
73 |
|
|
74 |
if( isset($occurrenceQuery->String) ) { |
|
75 |
$occurrenceQuery = $occurrenceQuery->String; |
|
76 |
|
|
77 |
$legendFormatQueryStr = null; |
|
78 |
if (variable_get('cdm_dataportal_map_openlayers', 1)) { |
|
79 |
$map_html = get_openlayers_map(variable_get('cdm_dataportal_geoservice_display_width', 680), variable_get('cdm_dataportal_geoservice_bounding_box', FALSE), $occurrenceQuery, NULL, |
|
80 |
$legendFormatQueryStr, variable_get('cdm_dataportal_geoservice_map_caption', '')); |
|
81 |
} |
|
82 |
else { |
|
83 |
// get_image_map($width, $occurrenceQuery = FALSE, $distributionQuery = FALSE, $legendFormatQuery = FALSE, $map_caption = FALSE ) |
|
84 |
$map_html = get_image_map(variable_get('cdm_dataportal_geoservice_display_width', 680), variable_get('cdm_dataportal_geoservice_bounding_box', FALSE), $occurrenceQuery, NULL, |
|
85 |
$legendFormatQueryStr, variable_get('cdm_dataportal_geoservice_map_caption', '')); |
|
86 |
} |
|
87 |
$render_array['map'] = markup_to_render_array($map_html, 0); |
|
88 |
} |
|
89 |
} |
|
90 |
|
|
91 |
// --- generate the specimen list as table |
|
92 |
$specimen_table = array( |
|
93 |
'#theme' => 'table', |
|
94 |
'#weight' => 2, |
|
95 |
// prefix attributes and rows with '#' to let it pass to the theme function, |
|
96 |
// otherwise it is handled as child render array |
|
97 |
'#attributes' => array('class' => 'specimens'), |
|
98 |
'#rows' => array(), |
|
99 |
); |
|
100 |
|
|
101 |
if ($specimensOrObservations) { |
|
102 |
|
|
103 |
foreach ($specimensOrObservations as $specimensOrObservation) { |
|
104 |
|
|
105 |
$mediaList = array(); |
|
106 |
if (is_array($specimensOrObservation->_fieldObjectMedia)) { |
|
107 |
$mediaList = array_merge($mediaList, $specimensOrObservation->_fieldObjectMedia); |
|
108 |
} |
|
109 |
if (is_array($specimensOrObservation->_derivedUnitMedia)) { |
|
110 |
$mediaList = array_merge($mediaList, $specimensOrObservation->_derivedUnitMedia); |
|
111 |
} |
|
112 |
|
|
113 |
// --- Render the title cache. |
|
114 |
if ($specimensOrObservation->class != 'FieldObservation') { |
|
115 |
// details are loaded on request via the cdm_dynabox by AJAX from the |
|
116 |
// CDM_WS_DERIVEDUNIT_FACADE (derivedUnitFacade/{uuid}) webservice |
|
117 |
// and will be rendered by the theme_cdm_derivedUnitFacade() function |
|
118 |
$derived_unit_ws_request = cdm_compose_url('portal/' . CDM_WS_DERIVEDUNIT_FACADE, array( $specimensOrObservation->uuid)); |
|
119 |
$label_html = cdm_dynabox( |
|
120 |
$specimensOrObservation->titleCache, |
|
121 |
$derived_unit_ws_request, |
|
122 |
'cdm_derivedUnitFacade', // the theme function to use |
|
123 |
'Click for details', |
|
124 |
array('div','div') |
|
125 |
); |
|
126 |
} else { |
|
127 |
// Fieldobservations are not yet fully handled, only the titleChach will be displayed |
|
128 |
$label_html = $specimensOrObservation->titleCache; |
|
129 |
} |
|
130 |
|
|
131 |
// --- Render associated media. |
|
132 |
$gallery_html = ''; |
|
133 |
if (count($mediaList) > 0) { |
|
134 |
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME); |
|
135 |
$gallery_name = $specimensOrObservation->uuid; |
|
136 |
$captionElements = array( |
|
137 |
'#uri' => t('open media'), |
|
138 |
); |
|
139 |
|
|
140 |
$gallery_html = theme('cdm_media_gallerie', array( |
|
141 |
'mediaList' => $mediaList, |
|
142 |
'galleryName' => $gallery_name, |
|
143 |
'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'], |
|
144 |
'cols' => $gallery_settings['cdm_dataportal_media_cols'], |
|
145 |
'maxRows' => isset($gallery_settings['cdm_dataportal_media_maxRows']) ? isset($gallery_settings['cdm_dataportal_media_maxRows']) : null, |
|
146 |
'captionElements' => $captionElements, |
|
147 |
'mediaLinkType' => 'LIGHTBOX', |
|
148 |
'alternativeMediaUri' => NULL, |
|
149 |
'galleryLinkUri' => NULL, |
|
150 |
)); |
|
151 |
} |
|
152 |
|
|
153 |
$specimen_table['#rows'][] = array( |
|
154 |
// An array of table rows. Every row is an array of cells, or an associative array |
|
155 |
'data' => array( |
|
156 |
// Each cell can be either a string or an associative array |
|
157 |
$label_html, |
|
158 |
$gallery_html, |
|
159 |
), |
|
160 |
'class' => array( |
|
161 |
'descriptionElement', |
|
162 |
'descriptionElement_IndividualsAssociation' |
|
163 |
), |
|
164 |
); |
|
165 |
} |
|
166 |
} |
|
167 |
|
|
168 |
$render_array['specimen_list'] = $specimen_table; |
|
169 |
|
|
170 |
RenderHints::popFromRenderStack(); |
|
171 |
return $render_array; |
|
172 |
} |
7.x/modules/cdm_dataportal/theme/cdm_dataportal.page.theme | ||
---|---|---|
338 | 338 |
|
339 | 339 |
|
340 | 340 |
|
341 |
/** |
|
342 |
* |
|
343 |
* @param array $variables |
|
344 |
* An array with the following keys: |
|
345 |
* - 'taxon': A cdm Taxon object |
|
346 |
* @return |
|
347 |
* A render array suitable for drupal_render() |
|
348 |
* |
|
349 |
* @todo Please document this function. |
|
350 |
* @see http://drupal.org/node/1354 |
|
351 |
*/ |
|
352 |
function cdm_dataportal_taxon_page_specimens($taxon) { |
|
353 |
|
|
354 |
$render_array = array(); |
|
355 |
RenderHints::pushToRenderStack('taxon_page_specimens'); |
|
356 |
|
|
357 |
$congruentTo = "60974c98-64ab-4574-bb5c-c110f6db634d"; //TODO make configurable in settings |
|
358 |
$specimensOrObservations = cdm_ws_get(CDM_WS_OCCURRENCE_BY_ASSOCIATEDTAXON, |
|
359 |
null, |
|
360 |
drupal_http_build_query(array( |
|
361 |
'taxonUuid' => $taxon->uuid, |
|
362 |
'relationshipUuids' => $congruentTo, |
|
363 |
'relationshipInversUuids' => $congruentTo, |
|
364 |
'pageSize' => null // al hits in one page |
|
365 |
) |
|
366 |
) |
|
367 |
); |
|
368 |
|
|
369 |
// TODO uncomment once CDM_WS_OCCURRENCE_BY_ASSOCIATEDTAXON is returning a pager |
|
370 |
// $specimensOrObservations = array(); |
|
371 |
// if(isset($pager->records[0])){ |
|
372 |
// $specimensOrObservations = $pager->records; |
|
373 |
// } |
|
374 |
|
|
375 |
// Collect media (fieldObjectMedia, derivedUnitMedia) and add as field a custom field |
|
376 |
// $occurrence->_fieldObjectMedia |
|
377 |
foreach ($specimensOrObservations as &$occurrence) { |
|
378 |
$occurrence->_fieldObjectMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array( |
|
379 |
$occurrence->uuid, |
|
380 |
'fieldObjectMedia', |
|
381 |
)); |
|
382 |
$occurrence->_derivedUnitMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array( |
|
383 |
$occurrence->uuid, |
|
384 |
'derivedUnitMedia', |
|
385 |
)); |
|
386 |
} |
|
387 |
|
|
388 |
// --- get map service HTTP query paramaters |
|
389 |
if (count($specimensOrObservations) > 0) { |
|
390 |
$occurrenceQuery = cdm_ws_get(CDM_WS_GEOSERVICE_OCCURRENCEMAP, $taxon->uuid); |
|
391 |
|
|
392 |
if( isset($occurrenceQuery->String) ) { |
|
393 |
$occurrenceQuery = $occurrenceQuery->String; |
|
394 |
|
|
395 |
$legendFormatQueryStr = null; |
|
396 |
if (variable_get('cdm_dataportal_map_openlayers', 1)) { |
|
397 |
$map_html = get_openlayers_map(variable_get('cdm_dataportal_geoservice_display_width', 680), variable_get('cdm_dataportal_geoservice_bounding_box', FALSE), $occurrenceQuery, NULL, |
|
398 |
$legendFormatQueryStr, variable_get('cdm_dataportal_geoservice_map_caption', '')); |
|
399 |
} |
|
400 |
else { |
|
401 |
// get_image_map($width, $occurrenceQuery = FALSE, $distributionQuery = FALSE, $legendFormatQuery = FALSE, $map_caption = FALSE ) |
|
402 |
$map_html = get_image_map(variable_get('cdm_dataportal_geoservice_display_width', 680), variable_get('cdm_dataportal_geoservice_bounding_box', FALSE), $occurrenceQuery, NULL, |
|
403 |
$legendFormatQueryStr, variable_get('cdm_dataportal_geoservice_map_caption', '')); |
|
404 |
} |
|
405 |
$render_array['map'] = markup_to_render_array($map_html, 0); |
|
406 |
} |
|
407 |
} |
|
408 |
|
|
409 |
// --- generate the specimen list as table |
|
410 |
$specimen_table = array( |
|
411 |
'#theme' => 'table', |
|
412 |
'#weight' => 2, |
|
413 |
// prefix attributes and rows with '#' to let it pass to the theme function, |
|
414 |
// otherwise it is handled as child render array |
|
415 |
'#attributes' => array('class' => 'specimens'), |
|
416 |
'#rows' => array(), |
|
417 |
); |
|
418 |
|
|
419 |
if ($specimensOrObservations) { |
|
420 |
|
|
421 |
foreach ($specimensOrObservations as $specimensOrObservation) { |
|
422 |
|
|
423 |
$mediaList = array(); |
|
424 |
if (is_array($specimensOrObservation->_fieldObjectMedia)) { |
|
425 |
$mediaList = array_merge($mediaList, $specimensOrObservation->_fieldObjectMedia); |
|
426 |
} |
|
427 |
if (is_array($specimensOrObservation->_derivedUnitMedia)) { |
|
428 |
$mediaList = array_merge($mediaList, $specimensOrObservation->_derivedUnitMedia); |
|
429 |
} |
|
430 |
|
|
431 |
// --- Render the title cache. |
|
432 |
if ($specimensOrObservation->class != 'FieldObservation') { |
|
433 |
// details are loaded on request via the cdm_dynabox by AJAX from the |
|
434 |
// CDM_WS_DERIVEDUNIT_FACADE (derivedUnitFacade/{uuid}) webservice |
|
435 |
// and will be rendered by the theme_cdm_derivedUnitFacade() function |
|
436 |
$derived_unit_ws_request = cdm_compose_url('portal/' . CDM_WS_DERIVEDUNIT_FACADE, array( $specimensOrObservation->uuid)); |
|
437 |
$label_html = cdm_dynabox( |
|
438 |
$specimensOrObservation->titleCache, |
|
439 |
$derived_unit_ws_request, |
|
440 |
'cdm_derivedUnitFacade', |
|
441 |
'Click for details', |
|
442 |
array('div','div') |
|
443 |
); |
|
444 |
} else { |
|
445 |
// Fieldobservations are not yet fully handled, only the titleChach will be displayed |
|
446 |
$label_html = $specimensOrObservation->titleCache; |
|
447 |
} |
|
448 |
|
|
449 |
// --- Render associated media. |
|
450 |
$gallery_html = ''; |
|
451 |
if (count($mediaList) > 0) { |
|
452 |
$gallery_settings = getGallerySettings(CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME); |
|
453 |
$gallery_name = $specimensOrObservation->uuid; |
|
454 |
$captionElements = array( |
|
455 |
'#uri' => t('open media'), |
|
456 |
); |
|
457 |
|
|
458 |
$gallery_html = theme('cdm_media_gallerie', array( |
|
459 |
'mediaList' => $mediaList, |
|
460 |
'galleryName' => $gallery_name, |
|
461 |
'maxExtend' => $gallery_settings['cdm_dataportal_media_maxextend'], |
|
462 |
'cols' => $gallery_settings['cdm_dataportal_media_cols'], |
|
463 |
'maxRows' => isset($gallery_settings['cdm_dataportal_media_maxRows']) ? isset($gallery_settings['cdm_dataportal_media_maxRows']) : null, |
|
464 |
'captionElements' => $captionElements, |
|
465 |
'mediaLinkType' => 'LIGHTBOX', |
|
466 |
'alternativeMediaUri' => NULL, |
|
467 |
'galleryLinkUri' => NULL, |
|
468 |
)); |
|
469 |
} |
|
470 |
|
|
471 |
$specimen_table['#rows'][] = array( |
|
472 |
// An array of table rows. Every row is an array of cells, or an associative array |
|
473 |
'data' => array( |
|
474 |
// Each cell can be either a string or an associative array |
|
475 |
$label_html, |
|
476 |
$gallery_html, |
|
477 |
), |
|
478 |
'class' => array( |
|
479 |
'descriptionElement', |
|
480 |
'descriptionElement_IndividualsAssociation' |
|
481 |
), |
|
482 |
); |
|
483 |
} |
|
484 |
} |
|
485 |
|
|
486 |
$render_array['specimen_list'] = $specimen_table; |
|
487 |
|
|
488 |
RenderHints::popFromRenderStack(); |
|
489 |
return $render_array; |
|
490 |
} |
|
491 |
|
|
492 | 341 |
/** |
493 | 342 |
* Returns HTML containing the synonymy for the accepted taxon. |
494 | 343 |
* |
Also available in: Unified diff
starting to move functionality into new file structure