Esempio n. 1
0
 function renderLevel($depth)
 {
     /*
      * Build the CSS class suffix
      */
     $class = 'li-' . RTAdminCSSMenu::cleanName($this->_current->title);
     if (strpos($this->_current->class, 'separator') !== false) {
         $class .= ' separator';
     }
     if (strpos($this->_current->class, 'disabled') !== false) {
         $class .= ' disabled';
     }
     if ($this->_current->hasChildren()) {
         $class .= ' parent';
         $this->_current->class .= ' daddy';
     }
     if ($depth == 1) {
         $class .= ' root';
         if (RTAdminCSSMenu::_isActive($this->_current->title)) {
             $class .= ' active';
         }
     }
     $this->_current->class .= ' item';
     //increment depth
     $depth++;
     /*
      * Print the item
      */
     echo '<li class="' . $class . '">';
     /*
      * Print a link if it exists
      */
     if ($this->_current->link != null) {
         echo "<a class=\"" . $this->_current->class . "\" href=\"" . $this->_current->link . "\"><span>" . $this->_current->title . "</span></a>";
     } elseif ($this->_current->title != null) {
         echo "<span class=\"" . $this->_current->class . "\"><span>" . $this->_current->title . "</span></span>\n";
     } else {
         echo "<span></span>";
     }
     /*
      * Recurse through children if they exist
      */
     while ($this->_current->hasChildren()) {
         if ($this->_current->class) {
             echo '<ul class="level' . $depth . ' parent-' . RTAdminCSSMenu::cleanName($this->_current->title) . '">' . "\n";
         } else {
             echo '<ul>' . "\n";
         }
         foreach ($this->_current->getChildren() as $child) {
             $this->_current =& $child;
             $this->renderLevel($depth);
         }
         echo "</ul>\n";
     }
     echo "</li>\n";
 }