Project

General

Profile

« Previous | Next » 

Revision 121bd2f4

Added by Andreas Kohlbecker about 3 years ago

ref #7599 ref #6866 specimen details tables - using RecordBase as table header

View differences:

modules/cdm_dataportal/includes/occurrences_new.inc
306 306
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('fieldNotes'), $fu_dto->fieldNotes);
307 307
  }
308 308

  
309
  return cdm_sob_dto_table(t("Field unit"), $table_row_data, $fu_dto, 2);
310
}
311

  
312
/**
313
 * Compose a table of details for a DerivedUnitDTO.
314
 *
315
 * The resulting DOM block level element will have a header line and details.
316
 *
317
 * compose_hook() implementation
318
 *
319
 * @param object $du_dto
320
 *   the CDM DerivedUnitDTO
321
 * @param bool $compact_mode
322
 *   Currently unused,
323
 *
324
 * @return array
325
 *  The render array for the DerivedUnitDTO
326
 *
327
 * @ingroup compose
328
 */
329
function compose_cdm_derived_unit_dto_details($du_dto, $compact_mode = FALSE) {
330

  
331
  $table_row_data = sob_dto_details_rows($du_dto, $compact_mode);
332

  
333
  if (isset_not_empty($du_dto->characterData)) {
334
    $table_row_data[] = cdm_sob_dto_table_row(
335
      cdm_occurrence_field_name_label('characterData'),
336
      icon_link(path_to_specimen($du_dto->uuid), '', FALSE), false);
337
  }
338

  
339
  return cdm_sob_dto_table(t("Field unit"), $table_row_data, $du_dto, 2);
309
  $heading = $table_row_data[0]['data'][1];
310
  unset($table_row_data[0]);
311
  return cdm_sob_dto_table(t($heading), $table_row_data, $fu_dto, 2);
340 312
}
341 313

  
342 314
/**
......
476 448
}
477 449

  
478 450
/**
479
 * Compose an render array from the SpecimenOrObservationDTO.determinedNames.
451
 * Compose details table for a DerivedUnitDTO.
480 452
 *
481 453
 * The resulting DOM block level element will have a header line and details.
482 454
 *
483 455
 * compose_hook() implementation
484 456
 *
485
 * @param object $sob_dto
486
 *   the CDM SpecimenOrObservationDTO
457
 * @param object $du_dto
458
 *   the CDM DerivedUnitDTO
487 459
 * @param bool $compact_mode
488 460
 *   Currently unused,
489 461
 *
490 462
 * @return array
491
 *  The render array for the SpecimenOrObservationDTO.determinedNames
463
 *  The render array for the DerivedUnitDTO
492 464
 *
493 465
 * @ingroup compose
494 466
 */
495
function compose_cdm_derived_unit_dto_storage_details($sob_dto, $compact_mode = FALSE) {
467
function compose_cdm_derived_unit_dto_storage_details($du_dto, $compact_mode = FALSE) {
496 468

  
497
  $table_row_data = sob_dto_details_rows($sob_dto, $compact_mode);
469
  $table_row_data = sob_dto_details_rows($du_dto, $compact_mode);
498 470

  
499
  if (isset($sob_dto->accessionNumber)) {
471
  if (isset($du_dto->accessionNumber)) {
500 472
    $table_row_data[] = cdm_sob_dto_table_row(
501 473
      cdm_occurrence_field_name_label('accessionNumber'),
502
      $sob_dto->accessionNumber);
474
      $du_dto->accessionNumber);
503 475
  }
504
  if (isset($sob_dto->collection)) {
476
  if (isset($du_dto->collection)) {
505 477
    $table_row_data[] = cdm_sob_dto_table_row(
506 478
      cdm_occurrence_field_name_label('collection'),
507
      render_collection_dto($sob_dto->collection));
479
      render_collection_dto($du_dto->collection));
508 480
  }
509
  if (isset($sob_dto->storedUnder)) {
510
    $taxon_name = cdm_ws_get(CDM_WS_PORTAL_NAME, array($sob_dto->storedUnder->uuid));
481
  if (isset($du_dto->storedUnder)) {
482
    $taxon_name = cdm_ws_get(CDM_WS_PORTAL_NAME, array($du_dto->storedUnder->uuid));
511 483
    $table_row_data[] = cdm_sob_dto_table_row(
512 484
      cdm_occurrence_field_name_label('storedUnder'),
513 485
      render_taxon_or_name($taxon_name, path_to_name($taxon_name->uuid)));
514 486
  }
515
  return cdm_sob_dto_table(t('Storage'), $table_row_data, $sob_dto, 1);
487
  if (isset_not_empty($du_dto->characterData)) {
488
    $table_row_data[] = cdm_sob_dto_table_row(
489
      cdm_occurrence_field_name_label('characterData'),
490
      icon_link(path_to_specimen($du_dto->uuid), '', FALSE), false);
491
  }
492

  
493
  $heading = $table_row_data[0]['data'][1];
494
  unset($table_row_data[0]);
495
  return cdm_sob_dto_table(t($heading), $table_row_data, $du_dto, 1);
516 496
}
517 497

  
518 498
/**
......
597 577
 * @return array|null
598 578
 */
599 579
function cdm_sob_dto_table($table_heading, array $table_row_data, $sob_dto, $weight = NULL, $grid_col_span = 1) {
580

  
600 581
  if (count($table_row_data) > 0) {
601 582
    $wrapper_style = '';
602 583
    if($grid_col_span > 1){

Also available in: Unified diff