Example #1
0
 /**
  * @inherit
  */
 public function toHtml(\A3gZ\Menu\Interfaces\MenuItemInterface $root)
 {
     ob_start();
     foreach ($root->getChildren() as $priority => $children) {
         foreach ($children as $pr2 => $child) {
             echo $child->toHtml();
         }
     }
     $html = ob_get_clean();
     return $html;
 }
Example #2
0
File: Item.php Project: a3gz/menu
 /**
  *
  */
 public function getUrlRoot()
 {
     if (isset($this->settings['urlRoot'])) {
         $urlRoot = $this->settings['urlRoot'];
         if (substr($urlRoot, -1) == '/') {
             $urlRoot = substr($urlRoot, 0, -1);
         }
         return $urlRoot;
     } elseif ($this->owner == null) {
         return '';
     }
     return $this->owner->getUrlRoot();
 }
Example #3
0
    /**
     * @inherit
     */
    public function toHtml(\A3gZ\Menu\Interfaces\MenuItemInterface $root)
    {
        ob_start();
        $href = $root->getUrl();
        $liItemClass = '';
        $aItemClass = '';
        if ($root->hasChildren()) {
            $href = "#sm-{$root->getId()}";
            $aItemClass = 'treeview';
        }
        if ($root->isActive()) {
            $liItemClass .= 'active ';
        }
        $aItemClass = "{$liItemClass} {$aItemClass} ";
        ?>
        <li 
            <?php 
        if ($liItemClass != '') {
            ?>
                class="<?php 
            echo $liItemClass;
            ?>
"
            <?php 
        }
        ?>
        >
            <a	
                <?php 
        if ($aItemClass != '') {
            ?>
                    class="<?php 
            echo $aItemClass;
            ?>
"
                <?php 
        }
        ?>
                href="<?php 
        echo "{$href}";
        ?>
" 
            >
                <?php 
        if ($icon = $root->getIcon()) {
            echo $icon;
        }
        ?>
                
                <span><?php 
        echo $root->getLabel();
        ?>
</span>
                
                <?php 
        if ($root->hasChildren()) {
            ?>
                    <i class="fa fa-angle-left pull-right"></i>
                    <?php 
        }
        ?>
            </a>
            
            <?php 
        if ($root->hasChildren()) {
            ?>
        
                <ul class="treeview-menu nav-<?php 
            echo $root->level + 2;
            ?>
n-level" id="<?php 
            echo $root->getId();
            ?>
">
                    <?php 
            foreach ($root->getChildren() as $pr1 => $children) {
                foreach ($children as $pr2 => $child) {
                    echo $child->toHtml();
                }
            }
            ?>
                </ul>
                <?php 
        }
        ?>
        </li>
        <?php 
        $html = ob_get_clean();
        return $html;
    }