Project

General

Profile

« Previous | Next » 

Revision 3cea6e15

Added by Andreas Kohlbecker over 3 years ago

ref #8419 using tables to show occurrence details

View differences:

modules/cdm_dataportal/includes/occurrences.inc
1009 1009
    $specimen = compose_cdm_specimen_or_observation_tree_entry($fieldunit_dto);
1010 1010
    $children = array();
1011 1011
    $child = array();
1012
    $child['data'] =$specimen;
1012
    $child['data'] = $specimen;
1013 1013
    // $children[] = create_specimen_array($specimenOrObservation->derivates);
1014 1014
    if (isset($fieldunit_dto->derivates) && sizeof($fieldunit_dto->derivates) > 0){
1015 1015
      usort($fieldunit_dto->derivates, 'compare_specimen_or_observation_dtos');
......
1305 1305

  
1306 1306
  if (is_object($specimen_or_observation_dto)) {
1307 1307

  
1308
        $type_label = $specimen_or_observation_dto->recordBase;
1309
        RenderHints::setFootnoteListKey($type_label . '-' . $specimen_or_observation_dto->uuid);
1308
        $title = isset($specimen_or_observation_dto->specimenIdentifier) ? $specimen_or_observation_dto->specimenIdentifier : '';
1310 1309

  
1311 1310
        // collect typeStatus as label
1311
        $type_label = '';
1312 1312
        if (isset($specimen_or_observation_dto->specimenTypeDesignations)) {
1313 1313
            $type_status = array();
1314 1314
            foreach ($specimen_or_observation_dto->specimenTypeDesignations as $typeDesignation) {
......
1316 1316
                    $type_status[] = $typeDesignation->typeStatus_L10n;
1317 1317
                }
1318 1318
            }
1319
            if (count($type_status) > 0) {
1320
                $type_label = implode(', ', $type_status);
1321
          }
1322
        }
1323

  
1324
        if (isset($typeDesignation->typifiedNames)){
1325
            $title = $type_label . ' for: ' . $typeDesignation->typifiedNames;
1326
        }else{
1327
            $title = $type_label;
1319
           $type_label = implode(', ', $type_status);
1328 1320
        }
1329 1321

  
1330 1322
        $groups = array();
1331
        $children_items = array();
1332 1323
        // --- add initialized fields
1333 1324
        foreach (get_object_vars($specimen_or_observation_dto) as $field => $value) {
1334 1325
            $child_item = array();
......
1468 1459
                          $taxon_name = cdm_ws_get(CDM_WS_PORTAL_NAME, $name->uuid); // TODO why not ->uuid here?
1469 1460
                          $dd_elements[] = render_taxon_or_name($taxon_name, path_to_name($taxon_name->uuid));
1470 1461
                        }
1471
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label("Identification(s)"), $dd_elements,'', 100);
1462
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label("Identification(s)"),
1463
                          ['#markup' => join("<br/>",  $dd_elements)],
1464
                          '', 100);
1472 1465
                        break;
1473 1466

  
1474 1467
                    default:
......
1487 1480

  
1488 1481
        // template_preprocess_description_list() is not worting by weight so we do it right here
1489 1482
        uasort($groups, 'element_sort');
1490
        $occurrence_elements = array(
1491
           // '#title' => $title,
1492
            '#theme' => 'description_list',
1493
            '#groups' => $groups,
1494
            '#attributes' => array('class' => html_class_attribute_ref($specimen_or_observation_dto)),
1495
        );
1483
        $occurrence_elements = [
1484
            '#header' => [
1485
              'data' => [
1486
                'data' => ['#markup' => $title],
1487
                'colspan' => 2,
1488
              ],
1489
            ],
1490
            '#theme' => 'table',
1491
            '#rows' => dl_groups_to_table_rows($groups),
1492
            '#attributes' => ['class' => [html_class_attribute_ref($specimen_or_observation_dto)]],
1493
        ];
1496 1494
        $output = drupal_render($occurrence_elements);
1497 1495
        if (isset($gallery_html)){
1498 1496
            $output .= $gallery_html;
......
1504 1502
    return $output;
1505 1503
}
1506 1504

  
1505
function dl_groups_to_table_rows($groups){
1506
  $rows = [];
1507
  foreach ($groups as $key => $data){
1508
    if(is_array($data['description'])){
1509
      $row_data = ['data' => $data['description']];
1510
    } else {
1511
      $row_data = $data['description'];
1512
    }
1513
    $rows[] = [
1514
      'data' => [
1515
        $data['term'],
1516
        $row_data
1517
      ]
1518
    ];
1519
  }
1520
  return $rows;
1521
}
1522

  
1507 1523
function compose_table_of_blast_result(array $data){
1508 1524
   // get icon images
1509 1525
  $expand_icon = font_awesome_icon_markup(
modules/cdm_dataportal/js/map/openlayers_map.js
149 149
          opts.customWMSBaseLayerData.max_extent = null;
150 150
      }
151 151

  
152

  
153 152
      var legendImgSrc = null;
154 153

  
155 154
      var map = null;

Also available in: Unified diff