示例#1
0
 function addSorted(&$root, $sortMode)
 {
     $this->sortLinks($sortMode);
     $sub = new SB_Tree_Node(array('name' => SB_T($this->tree->sortModeLabel[$sortMode]), 'nid' => $sortMode, 'nid_parent' => $this->switches['root'] ? $this->switches['root'] : ''));
     foreach ($this->root->getLinksSlice(10) as $link) {
         $sub->addLink($link);
     }
     $root->addNode($sub);
 }
示例#2
0
 function loadNodes(&$parent, $loadLinks = true, $right = 'select', $includeHidden = false)
 {
     // If we are deleted then do not load child nodes
     if ($parent->deleted_by) {
         return;
     }
     $rset = $this->db->select(null, 'sitebar_node', array('nid_parent' => $parent->id, '^1' => 'AND', 'deleted_by' => null), 'name');
     // COLLATE utf8_general_ci
     while ($rnode = $this->db->fetchRecord($rset)) {
         $node = new SB_Tree_Node($rnode);
         if ($node->deleted_by) {
             continue;
         }
         $node->setParent($parent);
         if (($this->expandedNodes == null || SB_safeVal($this->expandedNodes, $node->id) == 'Y') && ($this->maxLevel == -1 || $parent->level < $this->maxLevel) || !$node->hasRight($right)) {
             // Must be twice inside this function: occurence 1
             // - here it limits the depth
             $this->loadNodes($node, $loadLinks, $right, $includeHidden);
         }
         // If we have direct right or visible children
         if (($node->hasRight($right) || $node->childrenCount()) && ($includeHidden || !isset($this->um->hiddenFolders[$node->id]))) {
             // Must be twice inside this function: occurence 2
             // - here it ensures it is properly stored for frontend
             $node->setParent($parent);
             $parent->addNode($node);
         }
     }
     if ($loadLinks) {
         $this->loadLinks($parent);
     }
 }