Project

General

Profile

« Previous | Next » 

Revision 141a7789

Added by Andreas Kohlbecker about 3 years ago

ref #7599 ref #6866 specimen details tables - derivation events

View differences:

modules/cdm_dataportal/includes/occurrences_new.inc
202 202
 * @ingroup compose
203 203
 */
204 204
function compose_cdm_specimen_or_observation_dto_details_grid($sob_dto, $compact_mode = FALSE, &$derivatives = NULL) {
205
  //TODO !!!! add derivation event information like method, etc
206 205
  $render_array = [];
207 206
  if (!$sob_dto) {
208 207
    return $render_array;
......
213 212
      $render_array['gathering'] = compose_cdm_gathering_dto_details($sob_dto->gatheringEvent, $compact_mode);
214 213
    }
215 214
  } else {
215
    if(isset($sob_dto->derivationEvent)){
216
      $render_array['derivation-event'] = compose_cdm_derivation_event($sob_dto->derivationEvent);
217
    }
216 218
    $render_array['storage'] = compose_cdm_derived_unit_dto_storage_details($sob_dto, $compact_mode);
217 219
    $render_array['type-designations'] = compose_cdm_unit_dto_type_designations($sob_dto, $compact_mode);
218 220
    if($sob_dto->type == 'DnaSample'){
......
278 280
  return $table_row_data;
279 281
}
280 282

  
283
/**
284
 * Compose a table of details for a DerivationEventDTO.
285
 *
286
 * compose_hook() implementation
287
 *
288
 * @param object $derivation_event_dto
289
 *   the CDM DerivationEventDTO
290
 * @param bool $compact_mode
291
 *   Currently unused,
292
 *
293
 * @return array
294
 *  The render array for the DerivationEventDTO
295
 *
296
 * @ingroup compose
297
 */
298
function compose_cdm_derivation_event($derivation_event_dto, $compact_mode = FALSE){
299

  
300
  $details_array = [];
301
  // $markup = t("Derivation") . ': ';
302
  $markup = ucfirst(cdm_term_representation($derivation_event_dto->eventType));
303
  if(isset_not_empty($derivation_event_dto->actor)){
304
    $details_array[] = $derivation_event_dto->actor;
305
  }
306
  if(isset_not_empty($derivation_event_dto->institute)){
307
    $details_array[] = $derivation_event_dto->institute;
308
  }
309
  if(isset_not_empty($derivation_event_dto->timePeriod)){
310
    $details_array[] = timePeriodToString($derivation_event_dto->timePeriod);
311
  }
312
  $details_markup = join(', ', $details_array);
313
  if($details_markup){
314
    $markup .= ': ' . $details_markup;
315
  }
316
  $render_array = [
317
    '#type' => 'container',
318
    '#attributes' => [
319
      'class' => [
320
        'derivation-event',
321
        html_class_attribute_ref($derivation_event_dto)
322
      ],
323
      'style' => [
324
        'grid-column-start: span 2'
325
      ]
326
    ],
327
    'content' => markup_to_render_array($markup)
328
  ];
329
  return $render_array;
330
}
281 331

  
282 332
/**
283 333
 * Compose a table of details for a FieldUnitDTO.

Also available in: Unified diff