Project

General

Profile

« Previous | Next » 

Revision 07d37acc

Added by Andreas Kohlbecker over 2 years ago

fix #9715 Option to choose summaryLabel or collectingString for fieldUnit label

View differences:

modules/cdm_dataportal/classes/DerivationTreeComposer.php
7 7
  private $focused_unit_uuid = null;
8 8
  private $with_details = false;
9 9
  private $collapsible = false;
10
  private $use_field_unit_short_label = null;
10 11

  
11 12
  /**
12 13
   * @return bool
......
29 30
    return $this->with_details;
30 31
  }
31 32

  
33
  private function useFieldUnitShortLabel() {
34
      if($this->use_field_unit_short_label === null){
35
        $specimen_derivate_tree_options = get_array_variable_merged(CDM_SPECIMEN_DERIVATE_TREE_OPTIONS, CDM_SPECIMEN_DERIVATE_TREE_OPTIONS_DEFAULT);
36
        $this->use_field_unit_short_label = $specimen_derivate_tree_options['field_unit_short_label'];
37
      } else {
38
        return $this->use_field_unit_short_label;
39
      }
40
  }
41

  
32 42
  public function collapsibleItemClassAttribute($has_sub_derivatives) {
33 43
    return $this->isCollapsible() & $has_sub_derivatives === TRUE ? ' tree-item-collapsible' : '';
34 44

  
......
240 250
      $unit_header_wrapper_sub_items_class_attr = ' unit-header-wrapper-with-sub-items';
241 251
    }
242 252
    if( $sob_dto->type == 'FieldUnit' ){
243
      $label = $sob_dto->label;
253
      if($this->useFieldUnitShortLabel() && isset_not_empty($sob_dto->collectingString)){
254
        $label = $sob_dto->collectingString;
255
      } else {
256
        $label = $sob_dto->label;
257
      }
244 258
    } else {
245 259
      $label = $sob_dto->specimenShortTitle;
246 260
    }
modules/cdm_dataportal/settings.php
44 44
 const CDM_SPECIMEN_LIST_VIEW_MODE_OPTION_DERIVATE_TABLE = 'derivate_table';
45 45
 const CDM_SPECIMEN_LIST_VIEW_MODE_OPTION_DERIVATE_TREE = 'derivate_tree';
46 46
 const CDM_SPECIMEN_LIST_VIEW_MODE_OPTION_DERIVATE_PATH = 'derivate_path';
47
 const CDM_SPECIMEN_DERIVATE_TREE_OPTIONS = 'cdm_specimen_derivate_tree_options';
48
 const CDM_SPECIMEN_DERIVATE_TREE_OPTIONS_DEFAULT = ['field_unit_short_label' => 0];
47 49
  define('CDM_DATAPORTAL_DISPLAY_IS_ACCEPTED_FOR', 0);
48 50
  define('CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE', 'cdm_synonymy_accepted_taxon_sec_separate');
49 51
  define('CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL', 'cdm_synonymy_accepted_taxon_sec_separate_label');
......
2477 2479

  
2478 2480
  $form['taxon_specimens'][CDM_SPECIMEN_LIST_VIEW_MODE] = array(
2479 2481
      '#type' => 'radios',
2480
      '#title' => t('View mode for lists of specimens or occurrences.'),
2482
      '#title' => 'View mode for lists of specimens or occurrences.',
2481 2483
      '#default_value' => variable_get(CDM_SPECIMEN_LIST_VIEW_MODE, CDM_SPECIMEN_LIST_VIEW_MODE_DEFAULT),
2482 2484
      '#options' => [
2483 2485
        CDM_SPECIMEN_LIST_VIEW_MODE_OPTION_DERIVATE_TABLE => 'Compressed derivate table',
......
2493 2495
       </ul>'
2494 2496
  );
2495 2497

  
2498
  $specimen_derivate_tree_options = get_array_variable_merged(CDM_SPECIMEN_DERIVATE_TREE_OPTIONS, CDM_SPECIMEN_DERIVATE_TREE_OPTIONS_DEFAULT);
2499
  $form['taxon_specimens'][CDM_SPECIMEN_DERIVATE_TREE_OPTIONS] = [
2500
    '#type' => 'fieldset',
2501
    '#tree' => TRUE,
2502
    '#title' => 'Derivate tree options',
2503
    '#collapsible' => FALSE,
2504
    '#collapsed' => FALSE,
2505
    '#description' => t('These setting only apply to the <i>Derivate tree</i> view mode (see above).'),
2506
  ];
2507

  
2508
  $form['taxon_specimens'][CDM_SPECIMEN_DERIVATE_TREE_OPTIONS]['field_unit_short_label'] = [
2509
    '#type' => 'checkbox',
2510
    '#title' => 'Field unit short label',
2511
    '#default_value' => $specimen_derivate_tree_options['field_unit_short_label'],
2512
    '#description' => t('Use the short collecting string for field units 
2513
    instead of the long summary label, which also includes location information.'),
2514
  ];
2515

  
2496 2516
  $featureTrees = cdm_get_featureTrees_as_options(TRUE);
2497 2517
  $profile_feature_tree_uuid = variable_get(CDM_OCCURRENCE_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE);
2498 2518
  if(!isset($featureTrees['options'][$profile_feature_tree_uuid])) {

Also available in: Unified diff