예제 #1
0
 protected function setMenuItems(ViewMenuItems $ViewMenuItems, $structureParentId = 0)
 {
     $aStructures = $this->getStructuresByParentId($structureParentId);
     foreach ($aStructures as $oStructure) {
         if ($oStructure->active && !$oStructure->deleted && !$oStructure->anchor) {
             $ViewMenuItems->addItem($oStructure->path, $oStructure->name, null, null, $this->currentPath == $oStructure->path);
             $this->setMenuItems($ViewMenuItems->getItem($oStructure->path)->itemsList, $oStructure->id);
         }
     }
 }
예제 #2
0
    public function currentRender()
    {
        $classes = [];
        if ($this->active) {
            $classes[] = 'active';
        }
        if (count($this->itemsList->items) > 0) {
            $classes[] = 'dropdown';
        }
        $href = '#';
        if (!in_array('dropdown', $classes)) {
            $href = ($this->pathRoot == '' ? '/' : "/{$this->pathRoot}/") . ($this->path == '' ? '' : "{$this->path}/");
        }
        ?>
        <li <?php 
        echo empty($classes) ? '' : 'class="' . implode(' ', $classes) . '"';
        echo in_array('dropdown', $classes) ? ' role="presentation"' : '';
        ?>
>
            <a <?php 
        echo is_null($this->target) ? '' : "target=\"{$this->target}\"";
        ?>
 href="<?php 
        echo $href;
        ?>
"<?php 
        echo in_array('dropdown', $classes) ? ' class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"' : '';
        ?>
>
                <?php 
        echo $this->displayName;
        ?>
                <?php 
        if (count($this->itemsList->items) > 0) {
            ?>
                    <span class="caret"></span>
                <?php 
        }
        ?>
            </a>
            <?php 
        $this->itemsList->render();
        ?>
        </li>
        <?php 
    }