Revision 5ac909c0
Added by Patrick Plitzner over 4 years ago
modules/cdm_dataportal/includes/pages.inc | ||
---|---|---|
1169 | 1169 |
|
1170 | 1170 |
$description = cdm_ws_get(CDM_WS_PORTAL_DESCRIPTION, [$description_uuid]); |
1171 | 1171 |
$dataSet = NULL; |
1172 |
// find dataset
|
|
1172 |
// dataset passed as parameter
|
|
1173 | 1173 |
if ($descriptive_dataset_uuid != NULL) { |
1174 | 1174 |
foreach ($description->descriptiveDataSets as $set) { |
1175 | 1175 |
if ($set->uuid == $descriptive_dataset_uuid) { |
... | ... | |
1178 | 1178 |
} |
1179 | 1179 |
} |
1180 | 1180 |
} |
1181 |
if (!isset($dataSet) && !empty($description->descriptiveDataSets) && sizeof($description->descriptiveDataSets) == 1) { |
|
1182 |
foreach ($description->descriptiveDataSets as $dataSet) { |
|
1183 |
break; |
|
1184 |
} |
|
1185 |
} |
|
1186 |
// generate page title |
|
1187 |
if (isset($dataSet)) { |
|
1188 |
$associated_description_cdm_entity = isset($description->describedSpecimenOrObservation) |
|
1189 |
? $description->describedSpecimenOrObservation->titleCache |
|
1190 |
: (isset($description->taxon) ? $description->taxon->titleCache : NULL); |
|
1191 |
$title = 'Descriptive Data ' . $dataSet->titleCache; |
|
1192 |
if (isset($associated_description_cdm_entity)) { |
|
1193 |
$title .= ' for ' . $associated_description_cdm_entity; |
|
1181 |
if(!empty($description->descriptiveDataSets)) { |
|
1182 |
// only one dataset present |
|
1183 |
if (!isset($dataSet) && sizeof($description->descriptiveDataSets) == 1) { |
|
1184 |
foreach ($description->descriptiveDataSets as $dataSet) { |
|
1185 |
break; |
|
1186 |
} |
|
1194 | 1187 |
} |
1195 |
drupal_set_title($title); |
|
1196 |
if (isset($description->types)) { |
|
1197 |
foreach ($description->types as $type) { |
|
1198 |
if ($type == 'CLONE_FOR_SOURCE') { |
|
1199 |
$render_array[] = markup_to_render_array("Aggregation source from " . $description->created . '<br><br>'); |
|
1200 |
break; |
|
1188 |
// generate page title |
|
1189 |
if (isset($dataSet)) { |
|
1190 |
$associated_description_cdm_entity = isset($description->describedSpecimenOrObservation) |
|
1191 |
? $description->describedSpecimenOrObservation->titleCache |
|
1192 |
: (isset($description->taxon) ? $description->taxon->titleCache : NULL); |
|
1193 |
$title = 'Descriptive Data ' . $dataSet->titleCache; |
|
1194 |
if (isset($associated_description_cdm_entity)) { |
|
1195 |
$title .= ' for ' . $associated_description_cdm_entity; |
|
1196 |
} |
|
1197 |
drupal_set_title($title); |
|
1198 |
if (isset($description->types)) { |
|
1199 |
foreach ($description->types as $type) { |
|
1200 |
if ($type == 'CLONE_FOR_SOURCE') { |
|
1201 |
$render_array[] = markup_to_render_array("Aggregation source from " . $description->created . '<br><br>'); |
|
1202 |
break; |
|
1203 |
} |
|
1201 | 1204 |
} |
1202 | 1205 |
} |
1203 | 1206 |
} |
1204 |
} |
|
1205 |
else { |
|
1206 |
$items = []; |
|
1207 |
foreach ($description->descriptiveDataSets as $dataSet) { |
|
1208 |
$path = path_to_description($description->uuid, $dataSet->uuid); |
|
1209 |
$attributes['class'][] = html_class_attribute_ref($description); |
|
1210 |
$items[] = [ |
|
1211 |
'data' => $dataSet->titleCache . icon_link($path), |
|
1207 |
// multiple datasets present |
|
1208 |
else { |
|
1209 |
$items = []; |
|
1210 |
foreach ($description->descriptiveDataSets as $dataSet) { |
|
1211 |
$path = path_to_description($description->uuid, $dataSet->uuid); |
|
1212 |
$attributes['class'][] = html_class_attribute_ref($description); |
|
1213 |
$items[] = [ |
|
1214 |
'data' => $dataSet->titleCache . get_icon_link($path), |
|
1215 |
]; |
|
1216 |
} |
|
1217 |
$render_array[] = [ |
|
1218 |
'#title' => 'Available data sets for description', |
|
1219 |
'#theme' => 'item_list', |
|
1220 |
'#type' => 'ul', |
|
1221 |
'#items' => $items, |
|
1212 | 1222 |
]; |
1213 | 1223 |
} |
1214 |
$render_array[] = [ |
|
1215 |
'#title' => 'Available data sets for description', |
|
1216 |
'#theme' => 'item_list', |
|
1217 |
'#type' => 'ul', |
|
1218 |
'#items' => $items, |
|
1219 |
]; |
|
1220 | 1224 |
} |
1221 | 1225 |
|
1222 | 1226 |
if (isset($description->describedSpecimenOrObservation)) { |
Also available in: Unified diff
ref #8595 Only show available datasets label when data available