Ejemplo n.º 1
0
    protected function renderItem(RokMenuNode &$item, &$menu)
    {
        ?>
        <li id="idrops-<?php 
        echo $item->getId();
        ?>
"
            parent_id="idrops-<?php 
        echo $item->getParent();
        ?>
" <?php 
        if ($item->hasListItemClasses()) {
            ?>
class="<?php 
            echo $item->getListItemClasses();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->getCssId()) {
            ?>
id="<?php 
            echo $item->getCssId();
            ?>
"<?php 
        }
        ?>
>
        <?php 
        if (count($item->getChildren()) > 0 && $item->getParent() != 0) {
            ?>
            <small class="menucount"><?php 
            echo count($item->getChildren());
            ?>
</small>
        <?php 
        }
        ?>
            <a<?php 
        if ($item->hasLinkClasses()) {
            ?>
 class="<?php 
            echo $item->getLinkClasses();
            ?>
"<?php 
        }
        if ($item->hasLink()) {
            ?>
 href="<?php 
            echo $item->getLink();
            ?>
"<?php 
        }
        if ($item->getTarget()) {
            ?>
 target="<?php 
            echo $item->getTarget();
            ?>
"<?php 
        }
        if ($item->hasLinkAttribs()) {
            ?>
 <?php 
            echo $item->getLinkAttribs();
        }
        ?>
>
                <span <?php 
        if ($item->hasSpanClasses()) {
            ?>
class="<?php 
            echo $item->getSpanClasses();
            ?>
"<?php 
        }
        ?>
><?php 
        echo $item->getTitle();
        ?>
</span>
            </a>
        <?php 
        if ($item->hasChildren()) {
            ?>
            <ul>
            <?php 
            // force the parent menu item to appear
            $cls = explode(" ", $item->getListItemClasses());
            $isActive = in_array('active', $cls);
            if ($item->getParent() != 0) {
                ?>
                    <li class="subnav">
                        <a href="#" parent_id="idrops-<?php 
                echo $item->getParent();
                ?>
"
                           class="item backmenu"><span>Back</span></a>
                        <a href="#close" class="item closemenu"><span>Close</span></a>
                        <span class="clear"></span>
                    </li>
                <?php 
            }
            ?>
                <li class="root-sub<?php 
            echo $isActive ? ' active' : '';
            ?>
">
                <?php 
            if (count($item->getChildren()) > 0 && (!$item->getParent() && $item->getParent() != 0)) {
                ?>
                    <small class="menucount"><?php 
                echo count($item->getChildren());
                ?>
</small>
                <?php 
            }
            ?>
                    <a <?php 
            if ($item->hasLinkClasses()) {
                ?>
class="<?php 
                echo $item->getLinkClasses();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasLink()) {
                ?>
href="<?php 
                echo $item->getLink();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->getTarget()) {
                ?>
target="<?php 
                echo $item->getTarget();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasLinkAttribs()) {
                ?>
 <?php 
                echo $item->getLinkAttribs();
            }
            ?>
>
                        <span <?php 
            if ($item->hasSpanClasses()) {
                ?>
class="<?php 
                echo $item->getSpanClasses();
                ?>
"<?php 
            }
            ?>
><?php 
            echo $item->getTitle();
            ?>
</span>
                    </a>
                <?php 
            foreach ($item->getChildren() as $child) {
                ?>
                <?php 
                $this->renderItem($child, $menu);
                ?>
                <?php 
            }
            ?>
            </ul>
        <?php 
        }
        ?>

        </li>
        <?php 
    }