Exemplo n.º 1
0
 function drawNodeOpen(&$node, $last = false)
 {
     $showChildren = $this->showChildren($node);
     $node->aclstr = '';
     foreach ($node->getACL() as $right => $value) {
         if (!$value) {
             continue;
         }
         list($prefix, $name) = explode('_', $right);
         $node->aclstr .= $name[0];
     }
     if ($node->deleted_by) {
         $node->aclstr .= 'p';
     }
     if ($node->isRoot) {
         echo '<div class="tree">' . "\r";
     }
     $nodename = 'n' . $node->id;
     /* Init images */
     $inode = SB_Skin::img('node', 'n', $nodename);
     $inodeo = SB_Skin::img('node_open', 'n', $nodename);
     $iplus = SB_Skin::img('plus', 's', $nodename);
     $iplusl = SB_Skin::img('plus_last', 's', $nodename);
     $iminus = SB_Skin::img('minus', 's', $nodename);
     $iminusl = SB_Skin::img('minus_last', 's', $nodename);
     $onclick = 'SB_node(event,this.parentNode)';
     if ($this->loadOpenNodesOnly) {
         $onclick = 'SB_nodeReload(event,this.parentNode)';
     }
     echo '<div id="' . $nodename . '"' . ' class="node"' . ' x_level="' . $node->level . '"' . ' x_acl="' . $node->aclstr . ($node->deleted_by ? '' : '*') . '"' . '><span' . ' onclick="' . $onclick . '"' . ' oncontextmenu="return SB_menuOn(event,this.parentNode)">';
     $this->nodeCount++;
     $hasChildren = $node->childrenCount() || !$showChildren && $this->loadOpenNodesOnly;
     if (!$node->isRoot) {
         if ($hasChildren == 0) {
             $iplus = $this->ijoin;
             $iplusl = $this->ijoinl;
             $iminus = $this->ijoin;
             $iminusl = $this->ijoinl;
         }
         echo implode('', $this->treearr) . ($last ? $showChildren ? $iminusl : $iplusl : ($showChildren ? $iminus : $iplus));
         array_push($this->treearr, $last ? $this->iempty : $this->iconnect);
     } else {
         if ($node->deleted_by == null) {
             $inodeo = SB_Skin::img('root', 'n', $nodename, 'root');
             if ($hasChildren == 0) {
                 $inode = $inodeo;
             } else {
                 $inode = SB_Skin::img('root_plus', 'n', $nodename, 'root');
             }
         } else {
             $inode = SB_Skin::img('root_deleted', 'n', $nodename, 'root');
             $inodeo = $inode;
         }
     }
     $decorated = $this->showACL && $node->hasACL();
     echo '<a id="a' . $nodename . '" name="n' . $node->id . '"' . ($decorated && !$node->isRoot ? ' class="acl"' : '') . ($this->useToolTips ? SB_Page::toolTip() : '') . ($node->comment ? ' ' . ($this->useToolTips ? 'x_' : '') . 'title="' . $this->quoteAtt($node->comment) . '"' : '') . ($this->um->getParam('user', 'menu_icon') ? '' : SB_Page::dragDropNode($node->id)) . '>' . ($showChildren ? $inodeo : $inode) . $this->nmenu . ($decorated && $node->isRoot ? '<span class="acl">' : '') . $this->quoteText($node->name) . ($decorated && $node->isRoot ? '</span>' : '') . "</a></span>\r" . '<div id="c' . $nodename . '" class="children' . ($showChildren ? 'Expanded' : 'Collapsed') . '">' . "\r";
 }