Пример #1
0
 /**
  * Render the sub-tree for this node.
  * @param TREE_NODE $node
  * @param boolean $is_last Is this a terminal node in this list?
  * @param TREE_NODE[] $nodes
  * @param boolean $sibling_has_children
  * @access private
  */
 public function iterate_node($node, $is_last, $nodes, $sibling_has_children)
 {
     $this->_depth += 1;
     if ($node) {
         $has_children = !empty($nodes);
         $this->start_node($node, $is_last, $has_children, $sibling_has_children);
         $icon_url = $this->node_info->get_icon_url($node);
         $caption = $this->node_info->get_caption($node);
         if (isset($this->decorator)) {
             $this->decorator->draw_pre_toggle($node, $caption, $icon_url);
         }
         if (count($this->_stack)) {
             foreach ($this->_stack as $s) {
                 if ($s) {
                     $this->draw_icon(Tree_line, $node);
                 } else {
                     $this->draw_icon(Tree_blank, $node);
                 }
             }
         }
         if ($this->_depth > $this->_min_depth_for_icons) {
             if ($is_last) {
                 if ($has_children) {
                     $this->draw_icon(Tree_ell_plus, $node);
                 } else {
                     $this->draw_icon(Tree_ell, $node);
                 }
                 array_push($this->_stack, 0);
             } else {
                 if ($has_children) {
                     $this->draw_icon(Tree_tee_plus, $node);
                 } else {
                     $this->draw_icon(Tree_tee, $node);
                 }
                 array_push($this->_stack, 1);
             }
         }
         if (isset($this->decorator)) {
             $this->decorator->draw_post_toggle($node, $caption, $icon_url);
         } else {
             echo $this->context->get_icon_with_text($icon_url, Sixteen_px, $caption);
         }
         if ($has_children) {
             $this->pre_draw_children($node);
             $this->iterate_nodes($nodes);
             $this->post_draw_children($node);
         }
         $this->finish_node($node, $is_last, $has_children);
         array_pop($this->_stack);
     }
     $this->_depth -= 1;
 }