Project

General

Profile

« Previous | Next » 

Revision 6c5e37d9

Added by Patrick Plitzner almost 8 years ago

#5890 Add option to list classification with rootNode uuid as key

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
2280 2280
 * @return array
2281 2281
 *   classifications in an array as options for a form element that allows multiple choices.
2282 2282
 */
2283
function cdm_get_taxontrees_as_options($add_none_option = FALSE) {
2283
function cdm_get_taxontrees_as_options($add_none_option = FALSE, $rootNodeUuidAsKey = FALSE) {
2284 2284

  
2285 2285
  $taxonTrees = cdm_ws_fetch_all(CDM_WS_PORTAL_TAXONOMY);
2286 2286

  
......
2295 2295
  if ($taxonTrees) {
2296 2296
    foreach ($taxonTrees as $tree) {
2297 2297
      if (!$default_classification_uuid || $default_classification_uuid != $tree->uuid) {
2298
        $taxonomic_tree_options[$tree->uuid] = $tree->titleCache;
2298
        if($rootNodeUuidAsKey){
2299
          $rootNode = cdm_ws_get(CDM_WS_PORTAL_TAXONOMY_CLASSIFICATION_ROOT_NODE, $tree->uuid);
2300
          $taxonomic_tree_options[$rootNode->uuid] = $tree->titleCache;
2301
        }
2302
      else{
2303
          $taxonomic_tree_options[$tree->uuid] = $tree->titleCache;
2304
        }
2299 2305
      } else {
2300 2306
        $taxonomic_tree_options[$tree->uuid] = '  '; // two Space characters to force on top but below 'none' option , will be replaced below by titleCache
2301 2307
        $default_classification_label = $tree->titleCache;
modules/cdm_dataportal/cdm_api/webservice_uris.php
77 77
 */
78 78
define('CDM_WS_PORTAL_TAXONOMY', 'portal/classification');
79 79
define('CDM_WS_PORTAL_TAXONOMY_CHILDNODES', 'portal/classification/$0/childNodes');
80
define('CDM_WS_PORTAL_TAXONOMY_CLASSIFICATION_ROOT_NODE', 'portal/classification/$0/classificationRootNode');
80 81
define('CDM_WS_PORTAL_TAXONOMY_CHILDNODES_AT_RANK', 'portal/classification/$0/childNodesAt/$1');
81 82
define('CDM_WS_PORTAL_TAXONOMY_CHILDNODES_OF_TAXON', 'portal/classification/$0/childNodesOf/$1');
82 83
define('CDM_WS_PORTAL_TAXONOMY_PATH_FROM', 'portal/classification/$0/pathFrom/$1');
modules/cdm_dataportal/cdm_csv_export/cdm_csv_export.module
85 85
        '#type' => 'select',
86 86
        '#title' => t('Classification').':',
87 87
        '#default_value' => variable_get(CDM_TAXONOMICTREE_UUID, FALSE),
88
        '#options' => cdm_get_taxontrees_as_options(),
88
        '#options' => cdm_get_taxontrees_as_options(FALSE, TRUE),
89 89
        '#attributes' => array(
90 90
            'name' => 'taxonNode',
91 91
            'onchange' => 'return validateForm()'),

Also available in: Unified diff