Project

General

Profile

« Previous | Next » 

Revision 38da4e54

Added by Andreas Kohlbecker almost 8 years ago

#5887 root nodes available in classification breadcrumbs

View differences:

modules/cdm_dataportal/includes/pages.inc
959 959
  _add_js_taxonomic_children('#classification-breadcrumbs .taxonomic-children-button');
960 960

  
961 961
  $render_array = array();
962
  if(!is_uuid($taxon_uuid)){
963
    return $render_array;
964
  }
965 962

  
966 963
  $render_array['#theme'] = 'item_list';
967 964
  $render_array['#type'] = 'ul';
......
971 968
  );
972 969

  
973 970
  $items = array();
974
  $parent_taxon_nodes = cdm_ws_taxonomy_pathFromRoot($taxon_uuid);
975

  
976
  foreach ($parent_taxon_nodes as $node){
977 971

  
978
    $is_first_item = count($items) == 0;
979
    $node_name = cdm_dataportal_shortname_of($node);
980
    $path = path_to_taxon($node->taxonUuid);
972
  $parent_taxon_nodes = null;
973
  if($taxon_uuid){
974
    $parent_taxon_nodes = cdm_ws_taxonomy_pathFromRoot($taxon_uuid);
975
  }
981 976

  
982
    $children_indicator = '';
983
    if($node->taxonomicChildrenCount){
984
      $children_indicator =  '<span class="taxonomic-children-button" data-cdm-taxon-uuid="'. $node->taxonUuid. '" > '
985
        . font_awesome_icon_markup('fa-chevron-right')
986
        . ' </span>';
977
  $classifications = cdm_ws_fetch_all(CDM_WS_PORTAL_TAXONOMY);
978
  // find current classification in list
979
  $classification = null;
980
  $current_classification_uuid = get_current_classification_uuid();
981
  foreach ($classifications as $classification){
982
    if($classification->uuid == $current_classification_uuid){
983
      break;
987 984
    }
985
  }
988 986

  
989
    $items[] =
990
      ($is_first_item ? '':  ' ')
991
      . l($node_name, $path)
992
      . $children_indicator;
987
  $node_name = '';
988
  if(count($classifications) > 1 ){
989
    // need to add the current classification as first label
990
    $node_name = '<span '. html_class_attribute_ref($classification) .'>'
991
      . $classification->titleCache . '</span>';
993 992
  }
994 993

  
994
  $rank_limit_uuid = variable_get(TAXONTREE_RANKLIMIT, TAXONTREE_RANKLIMIT_DEFAULT);
995

  
996
  /*
997
  if($parent_taxon_nodes) {
998
    // the path to root never contains the classification->root, by asking for
999
    // the parent node we either get this or the predecessor of the virtual root node.
1000
    $root_parent_taxon_node_dto = cdm_ws_get(CDM_WS_TAXONNODE_PARENT, array($parent_taxon_nodes[0]->uuid));
1001
  } else {
1002

  
1003

  
1004
  }*/
1005

  
1006
  $children_indicator =  '<span class="taxonomic-children-button" data-classification-uuid="'. $current_classification_uuid
1007
    . '" data-rank-limit-uuid="'. $rank_limit_uuid . '" > '
1008
    . font_awesome_icon_markup('fa-chevron-right')
1009
    . ' </span>';
1010

  
1011
  $items[] = $node_name . $children_indicator;
1012

  
1013
    foreach ($parent_taxon_nodes as $node){
1014

  
1015
      $is_first_item = count($items) == 0;
1016
      $node_name = cdm_dataportal_shortname_of($node);
1017
      $path = path_to_taxon($node->taxonUuid);
1018

  
1019
      $children_indicator = '';
1020
      if($node->taxonomicChildrenCount){
1021
        $children_indicator =  '<span class="taxonomic-children-button" data-cdm-taxon-uuid="'. $node->taxonUuid. '" > '
1022
          . font_awesome_icon_markup('fa-chevron-right')
1023
          . ' </span>';
1024
      }
1025

  
1026
      $items[] =
1027
        ($is_first_item ? '':  ' ')
1028
        . l($node_name, $path)
1029
        . $children_indicator;
1030
    }
1031

  
995 1032

  
996 1033
  $render_array['#items'] = $items;
997 1034

  

Also available in: Unified diff