Project

General

Profile

« Previous | Next » 

Revision aaa81689

Added by Andreas Kohlbecker almost 8 years ago

no rank limit as default to avoid performance problems

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
1210 1210
 * @param string $ignore_rank_limit
1211 1211
 *   Whether to ignore the variable 'taxontree_ranklimit' set by admin in the settings
1212 1212
 *
1213
 * @return A cdm REST service URL path to a Classification
1213
 * @return string
1214
 *   A cdm REST service URL path to a Classification
1214 1215
 */
1215 1216
function cdm_compose_taxonomy_root_level_path($taxon_uuid = FALSE, $ignore_rank_limit = FALSE) {
1216 1217

  
1217 1218
  $view_uuid = get_current_classification_uuid();
1218 1219
  $rank_uuid = NULL;
1219 1220
  if (!$ignore_rank_limit) {
1220
    $rank_uuid = variable_get('taxontree_ranklimit', DEFAULT_TAXONTREE_RANKLIMIT);
1221
    $rank_uuid = variable_get(TAXONTREE_RANKLIMIT, TAXONTREE_RANKLIMIT_DEFAULT);
1221 1222
  }
1222 1223

  
1223 1224
  if (!empty($taxon_uuid)) {
......
1227 1228
    ));
1228 1229
  }
1229 1230
  else {
1230
    if (!empty($rank_uuid)) {
1231
    if (is_uuid($rank_uuid)) {
1231 1232
      return cdm_compose_url(CDM_WS_PORTAL_TAXONOMY_CHILDNODES_AT_RANK, array(
1232 1233
        $view_uuid,
1233 1234
        $rank_uuid,
......
1301 1302
}
1302 1303

  
1303 1304
/**
1304
 * @todo Enter description here...
1305
 * Determines the tree path of the taxon given as uuid to the root of the classification tree.
1306
 * 
1307
 * The root either is the absolute root of the tree or a rank specific root if the TAXONTREE_RANKLIMIT
1308
 * variable is set.
1305 1309
 *
1306 1310
 * @param string $taxon_uuid
1307 1311
 *
1308 1312
 * @return array
1313
 *   An array of CDM TaxonNodeDTO objects
1309 1314
 */
1310 1315
function cdm_ws_taxonomy_pathFromRoot($taxon_uuid) {
1311 1316
  $view_uuid = get_current_classification_uuid();
1312
  $rank_uuid = variable_get('taxontree_ranklimit', DEFAULT_TAXONTREE_RANKLIMIT);
1317
  $rank_uuid = variable_get(TAXONTREE_RANKLIMIT, TAXONTREE_RANKLIMIT_DEFAULT);
1313 1318

  
1314 1319
  $response = NULL;
1315
  if ($rank_uuid) {
1320
  if (is_uuid($rank_uuid)) {
1316 1321
    $response = cdm_ws_get(CDM_WS_PORTAL_TAXONOMY_PATH_FROM_TO_RANK, array(
1317 1322
      $view_uuid,
1318 1323
      $taxon_uuid,
modules/cdm_dataportal/settings.php
7 7

  
8 8
  // TODO Genus UUID.
9 9

  
10
  define('DEFAULT_TAXONTREE_RANKLIMIT', '1b11c34c-48a8-4efa-98d5-84f7f66ef43a');
10
  define('TAXONTREE_RANKLIMIT', 'cdm_taxontree_ranklimit');
11
  define('TAXONTREE_RANKLIMIT_DEFAULT', 0);
11 12
  define('CDM_TAXONOMICTREE_UUID', 'cdm_taxonomictree_uuid');
12 13
  define('CDM_TAXONTREE_INCLUDES', 'taxontree_includes');
13 14

  
......
1130 1131
      with a manual user change.'),
1131 1132
  );
1132 1133

  
1133
  $form['taxon_tree']['taxontree_ranklimit'] = array(
1134
  $form['taxon_tree'][TAXONTREE_RANKLIMIT] = array(
1134 1135
    '#type' => 'select',
1135 1136
    '#title' => t('Rank of highest displayed taxon') . ':',
1136 1137
     // Before DEFAULT_TAXONTREE_RANKLIMIT_UUID.
1137
    '#default_value' => variable_get('taxontree_ranklimit', DEFAULT_TAXONTREE_RANKLIMIT),
1138
    '#default_value' => variable_get(TAXONTREE_RANKLIMIT, TAXONTREE_RANKLIMIT_DEFAULT),
1138 1139
    '#options' => cdm_rankVocabulary_as_option(),
1139 1140
    '#description' => t('This is the rank of the highest displayed taxon in the
1140 1141
      <em>taxon tree</em>. You can select here which rank should be at the top

Also available in: Unified diff