Project

General

Profile

« Previous | Next » 

Revision 660d36e4

Added by Andreas Kohlbecker about 16 years ago

taxon tree working in expanded and in compact mode

View differences:

.gitattributes
50 50
modules/cdm_dataportal/cdm_taxontree/plus.png -text
51 51
modules/cdm_dataportal/cdm_taxontree/resources/Invisible.gif -text
52 52
modules/cdm_dataportal/cdm_taxontree/resources/Visible.gif -text
53
modules/cdm_dataportal/cdm_taxontree/resources/concept_switch.psd -text
54
modules/cdm_dataportal/cdm_taxontree/resources/eye.png -text
53 55
modules/cdm_dataportal/cdm_taxontree/visible.gif -text
54 56
modules/cdm_dataportal/cdm_taxontree/visible_implicit.gif -text
55 57
modules/cdm_dataportal/cdm_taxontree/visible_implicit_small.gif -text
modules/cdm_dataportal/cdm_dataportal.module
338 338
 *
339 339
 * @param String $uuid the UUID of the taxon
340 340
 */
341
function cdm_dataportal_view_taxon($uuid, $arg2){
341
function cdm_dataportal_view_taxon($uuid, $arg2 = null){
342 342

  
343 343

  
344 344
  if(isset($arg2) && !is_numeric($arg2)){
modules/cdm_dataportal/cdm_taxontree/cdm_taxontree.module
88 88
    $secRefUuid = $secRef['uuid'];
89 89
  }
90 90

  
91
  // get the root
92
  $root_tree = cdm_ws_get(CDM_WS_TREENODE_ROOT, $secRefUuid);
93
  $root_tree = _cdm_resultset2tree($root_tree);
91
  $filtersActive = isset($_SESSION['cdm']['filters']) && count($_SESSION['cdm']['filters']) > 0;
92
  $compact_tree = $filtersActive && $_SESSION['cdm']['taxontree']['compact'] == 1;
94 93
  
95
  // the paths up to active filters are inactivated and thus cannot be browsed by expanding nodes
96
  // therefore we need to build up the branches for all nodes which are set as filters
97
  // the branches are merged with the root
98
  if(isset($_SESSION['cdm']['filters'])){
99
    // ###$compact_tree = $_SESSION['cdm']['taxontree']['compact'] == 1;
100
    foreach($_SESSION['cdm']['filters'] as $uuid=>$filter){
101
      $branch = cdm_taxontree_build_branch($uuid /* #### , !$compact_tree  #### */);
94
  if(!$compact_tree){
95
    // get the root
96
    $root_tree = cdm_ws_get(CDM_WS_TREENODE_ROOT, $secRefUuid);
97
    $root_tree = _cdm_resultset2tree($root_tree);
98
    
99
    if($filtersActive){
100
      // the paths up to active filters are inactivated and thus cannot be browsed by expanding nodes
101
      // therefore we need to build up the branches for all nodes which are set as filters
102
      // the branches are merged with the root
103
      foreach($_SESSION['cdm']['filters'] as $uuid=>$filter){
104
        $branch = cdm_taxontree_build_branch($uuid);
105
        $root_tree = _cdm_taxontree_merge($root_tree, $branch);
106
      }
107
    }
108
    // build the the branch for the focused node and merge it with the root
109
    if($taxonUuid){
110
      $branch = cdm_taxontree_build_branch($taxonUuid);
102 111
      $root_tree = _cdm_taxontree_merge($root_tree, $branch);
103 112
    }
113
  } else {
114
    $root_tree = $_SESSION['cdm']['filters'];
115
      /*  if(){
116
        foreach($_SESSION['cdm']['filters'] as $uuid=>$filter){
117
          $branch = cdm_taxontree_build_branch($uuid  #### , !$compact_tree  #### );
118
          $root_tree = _cdm_taxontree_merge($root_tree, $branch);
119
        }
120
      }*/
104 121
  }
122
  
105 123

  
106
  // build the the branch for the focused node and merge it with the root
107
  if($taxonUuid){
108
    $branch = cdm_taxontree_build_branch($taxonUuid);
109
    $root_tree = _cdm_taxontree_merge($root_tree, $branch);
110
  }
111 124

  
112 125
  return $root_tree;
113 126
}
......
159 172
            if(is_array($branch[$uuid]->children) && is_array($tree[$uuid]->children)) {
160 173
              // merge recursive
161 174
              $tree[$uuid]->children = _cdm_taxontree_merge($tree[$uuid]->children, $branch[$uuid]->children);
162
            } else {
175
            } else if(is_array($branch[$uuid]->children)){
163 176
              $tree[$uuid] =  $branch[$uuid];
164
            }
177
            }  
165 178
        } 
166 179
    }
167 180
    unset($uuid, $node);
......
192 205
  
193 206
  $out = '<ul class="cdm_taxontree">';
194 207
  foreach($tree as $node){
195
    
196
   /* if($isVisibleSubtree){
197
      $isVisibleNode = true;
198
    } else {
199
      $isVisibleNode = isset($_SESSION['cdm']['filters'][$node->uuid]);
200
    }
201
   */
202 208
    $out .= theme('cdm_taxontree_node', $node, $taxonUuid_inFocus == $node->uuid, $filterIncludes);
203 209
  }
204 210
  $out .= '</ul>';
......
221 227
    // 
222 228
    $name = l(cdm_dataportal_shortname_of($node), cdm_dataportal_taxon_path($node->uuid));
223 229
    $filter_icon = 'visible_implicit.gif';
230
    $filter_on = false;
224 231
  } else {
225 232
    $filter_on = isset($_SESSION['cdm']['filters'][$node->uuid]);
226 233
    if($filter_on) {

Also available in: Unified diff