Project

General

Profile

« Previous | Next » 

Revision c407b10a

Added by Andreas Kohlbecker about 3 years ago

ref #7599 ref #6866 specimen details in floating tables - gathering details

View differences:

modules/cdm_dataportal/includes/occurrences_new.inc
200 200
  }
201 201
  if ($sob_dto->type == 'FieldUnit') {
202 202
    $render_array['field-unit'] = compose_cdm_field_unit_dto_location($sob_dto, $compact_mode);
203
    if(isset($sob_dto->gathering)){
204
      $render_array['gathering'] = compose_cdm_gathering_dto($sob_dto->gathering, $compact_mode);
203
    if(isset($sob_dto->gatheringEvent)){
204
      $render_array['gathering'] = compose_cdm_gathering_dto($sob_dto->gatheringEvent, $compact_mode);
205 205
    }
206 206
  }
207 207

  
......
261 261
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('fieldNotes'), $fu_dto->fieldNotes);
262 262
  }
263 263

  
264
  return cdm_sob_dto_table($table_heading, $table_row_data, $fu_dto);
264
  return cdm_sob_dto_table("Location", $table_row_data, $fu_dto);
265

  
265 266
}
266 267

  
267 268
/**
......
293 294

  
294 295
  $table_row_data = [];
295 296
  if (isset_not_empty($gathering_dto->date)) {
296
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('date'), partialToDate($gathering_dto->date));
297
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('date'),
298
      partialToDate($gathering_dto->date));
299
  }
300
  if (isset_not_empty($gathering_dto->collector)) {
301
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('collector'),
302
      $gathering_dto->collector);
303
  }
304
  if (isset_not_empty($gathering_dto->description)) {
305
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('description'),
306
      $gathering_dto->description);
307
  }
308
  if (isset_not_empty($gathering_dto->locality)) {
309
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('locality'),
310
      $gathering_dto->locality);
311
  }
312
  if (isset_not_empty($gathering_dto->country)) {
313
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('country'),
314
      $gathering_dto->country);
315
  }
316
  if (isset_not_empty($gathering_dto->collectingMethod)) {
317
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('collectingMethod'),
318
      $gathering_dto->collectingMethod);
319
  }
320
  if (isset($gathering_dto->exactLocation)) {
321
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('exactLocation'),
322
      render_point($gathering_dto->exactLocation));
323
  }
324
  if (isset($gathering_dto->absoluteElevation)) {
325
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('absoluteElevation'),
326
      statistical_values_from_gathering_event($gathering_dto, 'absoluteElevation'));
327
  }
328
  if (isset($gathering_dto->distanceToGround) && $gathering_dto->distanceToGround > 0) {
329
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('distanceToGround'),
330
      statistical_values_from_gathering_event($gathering_dto, 'distanceToGround'));
331
  }
332
  if (isset($gathering_dto->distanceToWaterSurface) && $gathering_dto->distanceToWaterSurface > 0) {
333
    $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('distanceToWaterSurface'),
334
      statistical_values_from_gathering_event($gathering_dto, 'distanceToWaterSurface'));
335
  }
336
  if(isset_not_empty($gathering_dto->collectingAreas)){
337
    $area_representations = array();
338
    foreach ($gathering_dto->collectingAreas as $area) {
339
      // $area_representations[] = l($area->representation_L10n, path_to_named_area($area->uuid));
340
      $area_representations[] = $area;
341
    }
342
    if (!empty($area_representations)) {
343
      $table_row_data[] = cdm_sob_dto_table_row(cdm_occurrence_field_name_label('collectingAreas'),
344
        implode(', ', $area_representations)
345
      );
346
    }
297 347
  }
298 348

  
299 349
  return cdm_sob_dto_table($table_heading, $table_row_data, $gathering_dto);
......
308 358
 * @param $sob_dto
309 359
 */
310 360
function cdm_sob_dto_table($table_heading, array $table_row_data, $sob_dto, $weight = null) {
311
  $sob_table = [
312
    "#theme" => "table",
313
    "#header" => [
314
      'data' => $table_heading,
361
  if(count($table_row_data) > 0 ) {
362
    $sob_table = [
363
      "#theme" => "table",
364
      "#header" => [
365
        'data' => $table_heading,
366
        "#attributes" => [
367
          'colspan' => 2
368
        ]
369
      ],
370
      "#rows" => $table_row_data,
315 371
      "#attributes" => [
316
        'colspan' => 2
317
      ]
318
    ],
319
    "#rows" => $table_row_data,
320
    "#attributes" => [
321
      "class" => [
322
        'specimen-or-observation-details',
323
        html_class_attribute_ref($sob_dto),
324
      ]
325
    ],
326
  ];
327
  if($weight){
328
    $sob_table['#weight'] = $weight;
372
        "class" => [
373
          'specimen-or-observation-details',
374
          html_class_attribute_ref($sob_dto),
375
        ]
376
      ],
377
    ];
378
    if($weight){
379
      $sob_table['#weight'] = $weight;
380
    }
381
    return $sob_table;
329 382
  }
330
  return $sob_table;
331 383
}
332 384

  
333 385
function cdm_sob_dto_table_row($label, $value) {
334
  return [
335
    'data' => [
336
      [
337
        'data' => str_replace(':', '', $label),
338
         'class' => [
339
          'label'
340
        ]
341
      ],
342
      $value],
343
    'no_striping' => TRUE,
344
  ];
386
  if($value){
387
    return [
388
      'data' => [
389
        [
390
          'data' => str_replace(':', '', $label),
391
           'class' => [
392
            'label'
393
          ]
394
        ],
395
        $value],
396
      'no_striping' => TRUE,
397
    ];
398
  }
345 399
}

Also available in: Unified diff