Project

General

Profile

« Previous | Next » 

Revision dc58a71b

Added by Andreas Kohlbecker almost 5 years ago

fix #7966 using the TypeDesignationStatusFilter to simplify the registration search by status type

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
1387 1387
  return cdm_terms_as_options($terms, $term_label_callback, $empty_option);
1388 1388
}
1389 1389

  
1390
/**
1391
 * @param array $none_option
1392
 *    Will add a filter option to search for NULL values
1393
 * @param $with_empty_option
1394
 *    Will add an empty option to the beginning. Choosing this option will disable the filtering.
1395
 * @return array
1396
 *   An array of options with uuids as key and the localized term representation as value
1397
 */
1398
function cdm_type_designation_status_filter_terms_as_options($none_option_label, $with_empty_option = false){
1399
  $filter_terms = cdm_ws_get(CDM_WS_TYPE_DESIGNATION_STATUS_FILTER_TERMS);
1400

  
1401
  if(isset($filter_terms) && is_array($filter_terms)) {
1402
    foreach ($filter_terms as $filter_term) {
1403
      $options[join(',', $filter_term->uuids)] = $filter_term->label;
1404
    }
1405
  }
1406

  
1407
  if(is_string($none_option_label)){
1408
    $options = array_merge(array('NULL' => $none_option_label), $options);
1409
  }
1410

  
1411
  if($with_empty_option !== FALSE){
1412
    array_unshift ($options, "");
1413
  }
1414

  
1415

  
1416
  return $options;
1417
}
1418

  
1419

  
1390 1420

  
1391 1421
/**
1392 1422
 * @todo Please document this function.
modules/cdm_dataportal/cdm_api/webservice_uris.php
11 11
define('CDM_WS_NAME', 'name');
12 12
define('CDM_WS_NAME_NAMECAHE', 'name/$0/nameCache');
13 13
define('CDM_WS_NAME_TYPEDESIGNATIONS', 'name/$0/typeDesignations');
14
define('CDM_WS_TYPE_DESIGNATION_STATUS_FILTER_TERMS', 'name/typeDesignationStatusFilterTerms');
14 15

  
15 16
define('CDM_WS_PORTAL_NAME', 'portal/name');
16 17
define('CDM_WS_PORTAL_NAME_FINDBYNAME', 'name/findByName/');
modules/cdm_dataportal/cdm_dataportal.search.php
950 950
  static $query_param_map = array(
951 951
    'identifier' => 'identifierFilterPattern',
952 952
    'taxon_name'=> 'taxonNameFilterPattern',
953
    'type_designation_status' => 'typeDesignationStatusUuids',
953
    'type_designation_status_uuids' => 'typeDesignationStatusUuids',
954 954
  );
955 955

  
956 956
  $session_key = SESSION_KEY_SEARCH_REGISTRATION_FILTER;
......
1095 1095
  static $filter_presets_empty = array(
1096 1096
    'identifier'=> null,
1097 1097
    'taxon_name'=> null,
1098
    'type_designation_status' => null
1098
    'type_designation_status_uuids' => null
1099 1099
  );
1100 1100

  
1101 1101
  _add_font_awesome_font();
......
1125 1125
    '#size' => 20,
1126 1126
    '#maxlength' => 128
1127 1127
  );
1128
  $form['type_designation_status'] = array(
1128
  $form['type_designation_status_uuids'] = array(
1129 1129
    '#type' => 'select',
1130 1130
    '#title' => t('Type designation status'),
1131 1131
    '#multiple' => true,
1132
    '#options' => cdm_terms_by_type_as_option('TypeDesignationStatusBase', null, null, TRUE),
1133
    '#default_value' => $filter_presets['type_designation_status']
1132
    '#options' => cdm_type_designation_status_filter_terms_as_options('- none -'),
1133
    '#default_value' => $filter_presets['type_designation_status_uuids'],
1134
    "#description" => '<i>' . t('Ctrl + Click to unselect') . '</i>'
1134 1135
  );
1135 1136

  
1136 1137
  $form['submit'] = array(

Also available in: Unified diff