Revision c10f70e4
Added by Katja Luther over 5 years ago
modules/cdm_dataportal/includes/pages.inc | ||
---|---|---|
50 | 50 |
|
51 | 51 |
$by_associatedtaxon_query = http_build_query($by_associatedtaxon_query_parameters); |
52 | 52 |
|
53 |
$pager = cdm_ws_get(CDM_WS_OCCURRENCE_BY_ASSOCIATEDTAXON, |
|
54 |
null, |
|
55 |
$by_associatedtaxon_query . '&taxonUuid=' . $taxon->uuid |
|
56 |
); |
|
53 |
$specimensOrObservations = cdm_ws_get(CDM_WS_TAXON, array( $taxon->uuid, 'specimensOrObservations')); |
|
57 | 54 |
|
58 |
$specimensOrObservations = array(); |
|
59 |
if(isset($pager->records[0])){ |
|
60 |
$specimensOrObservations = $pager->records; |
|
61 |
} |
|
55 |
// cdm_ws_get(CDM_WS_OCCURRENCE_FIELDUNIT_DTO_BY_ASSOCIATEDTAXON, |
|
56 |
// null, |
|
57 |
// $by_associatedtaxon_query . '&taxonUuid=' . $taxon->uuid |
|
58 |
// ); |
|
59 |
|
|
60 |
// $specimensOrObservations = array(); |
|
61 |
// if(isset($pager->records[0])){ |
|
62 |
// $specimensOrObservations = $pager->records; |
|
63 |
// } |
|
62 | 64 |
|
63 | 65 |
// order occurrences by date but types should be on top of the list |
64 | 66 |
$type_specimens = array(); |
... | ... | |
75 | 77 |
|
76 | 78 |
// Collect media (fieldObjectMedia, derivedUnitMedia) and add as a custom field |
77 | 79 |
// $occurrence->_fieldObjectMedia |
78 |
foreach ($specimensOrObservations as &$occurrence) { |
|
79 |
$occurrence->_fieldObjectMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array( |
|
80 |
$occurrence->uuid, |
|
81 |
'fieldObjectMedia', |
|
82 |
)); |
|
83 |
$occurrence->_derivedUnitMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array( |
|
84 |
$occurrence->uuid, |
|
85 |
'derivedUnitMedia', |
|
86 |
)); |
|
87 |
} |
|
80 |
// foreach ($specimensOrObservations as &$occurrence) {
|
|
81 |
// $occurrence->_fieldObjectMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array(
|
|
82 |
// $occurrence->uuid,
|
|
83 |
// 'fieldObjectMedia',
|
|
84 |
// ));
|
|
85 |
// $occurrence->_derivedUnitMedia = cdm_ws_get(CDM_WS_DERIVEDUNIT_FACADE, array(
|
|
86 |
// $occurrence->uuid,
|
|
87 |
// 'derivedUnitMedia',
|
|
88 |
// ));
|
|
89 |
//}
|
|
88 | 90 |
|
89 | 91 |
// --- get map service HTTP query parameters |
92 |
|
|
90 | 93 |
if (count($specimensOrObservations) > 0) { |
91 |
$occurrence_queryDto = cdm_ws_get(CDM_WS_GEOSERVICE_OCCURRENCEMAP, $taxon->uuid, $by_associatedtaxon_query); |
|
94 |
//the information about the points are already available |
|
95 |
$points = array(); |
|
96 |
foreach ($specimensOrObservations as &$occurrence) { |
|
97 |
if ($occurrence != null) { |
|
98 |
$points[] = $occurrence->uuid; |
|
99 |
} |
|
100 |
} |
|
101 |
|
|
102 |
$parameterFieldUnitUuids = 'fieldUnitUuidList=' . urlencode(implode(',', $points)); |
|
103 |
// $occurrence_queryDto = cdm_ws_get(CDM_WS_GEOSERVICE_OCCURRENCEMAP, $taxon->uuid, $by_associatedtaxon_query); |
|
104 |
|
|
105 |
$occurrence_queryDto = cdm_ws_get(CDM_WS_GEOSERVICE_OCCURRENCEMAP_FOR_FIELDUNITS, null, $parameterFieldUnitUuids); |
|
92 | 106 |
|
93 | 107 |
$map_visibility = variable_get(SPECIMEN_MAP_VISIBILITY, SPECIMEN_MAP_VISIBILITY_DEFAULT); |
94 | 108 |
if($map_visibility == 'always' || |
... | ... | |
155 | 169 |
foreach ($specimensOrObservations as $specimenOrObservation) { |
156 | 170 |
|
157 | 171 |
$mediaList = array(); |
158 |
if (is_array($specimenOrObservation->_fieldObjectMedia)) {
|
|
159 |
$mediaList = array_merge($mediaList, $specimenOrObservation->_fieldObjectMedia);
|
|
172 |
if (is_array($specimenOrObservation->listOfMedia)) {
|
|
173 |
$mediaList = array_merge($mediaList, $specimenOrObservation->listOfMedia);
|
|
160 | 174 |
} |
161 |
if (is_array($specimenOrObservation->_derivedUnitMedia)) {
|
|
175 |
if (is_array($specimenOrObservation->_derivedUnitMedia)) { |
|
162 | 176 |
$mediaList = array_merge($mediaList, $specimenOrObservation->_derivedUnitMedia); |
163 | 177 |
} |
164 | 178 |
|
... | ... | |
182 | 196 |
// -> Dynabox for the specimenOrObservation |
183 | 197 |
$gallery_name = $specimenOrObservation->uuid; |
184 | 198 |
|
185 |
$derived_unit_ws_request = cdm_compose_url(CDM_WS_OCCURRENCE, array( $specimenOrObservation->uuid)); |
|
199 |
$derived_unit_ws_request = cdm_compose_url(CDM_WS_OCCURRENCE, array( $specimenOrObservation->taxonRelatedDerivedUnits[0], 'occurrencesDTO') ); |
|
200 |
|
|
201 |
//here we should use the data we already have |
|
186 | 202 |
$label_html = cdm_dynabox( |
187 | 203 |
$specimenOrObservation->uuid, |
188 | 204 |
$type_label . $specimenOrObservation->titleCache, |
... | ... | |
472 | 488 |
} |
473 | 489 |
|
474 | 490 |
// --- GET specimensOrObservations --- // |
475 |
$specimensOrObservations = cdm_ws_get(CDM_WS_TAXON, array( $taxon->uuid, 'specimensOrObservations')); |
|
491 |
$specimensOrObservations = cdm_ws_get(CDM_WS_TAXON, array( $taxon->uuid, 'specimensOrObservationsCount'));
|
|
476 | 492 |
|
477 |
$specimensOrObservationsCount = is_array($specimensOrObservations) ? count($specimensOrObservations) : 0;
|
|
493 |
$specimensOrObservationsCount = $specimensOrObservations != null ? $specimensOrObservations->result : 0;
|
|
478 | 494 |
if ($specimensOrObservationsCount == 0 || ($tabsToDisplay["Specimens"] == '0')) { |
479 | 495 |
taxon_page_tabs_hidden('specimens'); |
480 | 496 |
} |
Also available in: Unified diff
first steps of specimen page with DTOs