/**
  * @param JoomlaRokMenuNode $node
  * @return bool if the node is accessable
  */
 protected function isAccessable(JoomlaRokMenuNode $node)
 {
     $user =& JFactory::getUser();
     $aid = (array_key_exists('check_access_level',$this->args)) ? (int)$this->args['check_access_level'] : (int)$user->get('aid', 0);
     if (null == $node->getAccess()) {
         return null;
     }
     else if ($aid >= $node->getAccess()) {
         return true;
     }
     else {
         return false;
     }
 }
Example #2
0
    protected function renderItem(JoomlaRokMenuNode &$item, RokMenuNodeTree &$menu)
    {
        ?>
        <li <?php 
        if ($item->hasListItemClasses()) {
            ?>
class="<?php 
            echo $item->getListItemClasses();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->hasCssId() && $this->args['roknavmenu_fusion_enable_current_id']) {
            ?>
id="<?php 
            echo $item->css_id;
            ?>
"<?php 
        }
        ?>
>
        <?php 
        if ($item->getType() == 'menuitem') {
            ?>
        <a <?php 
            if ($item->hasLinkClasses()) {
                ?>
class="<?php 
                echo $item->getLinkClasses();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasLink()) {
                ?>
href="<?php 
                echo $item->getLink();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasTarget()) {
                ?>
target="<?php 
                echo $item->getTarget();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasAttribute('onclick')) {
                ?>
onclick="<?php 
                echo $item->getAttribute('onclick');
                ?>
"<?php 
            }
            if ($item->hasLinkAttribs()) {
                ?>
 <?php 
                echo $item->getLinkAttribs();
            }
            ?>
>
    <?php 
            if ($item->hasImage()) {
                ?>
            <img alt="<?php 
                echo $item->getAlias;
                ?>
" src="<?php 
                echo $item->getImage();
                ?>
"/><?php 
            }
            ?>
        <span><?php 
            echo $item->getTitle();
            ?>
</span>
            </a>
    <?php 
        } elseif ($item->getType() == 'separator') {
            ?>
        <span <?php 
            if ($item->hasLinkClasses()) {
                ?>
class="<?php 
                echo $item->getLinkClasses();
                ?>
 nolink"<?php 
            }
            ?>
>
                <span><?php 
            echo $item->getTitle();
            ?>
</span>
            </span>
    <?php 
        }
        ?>
        <?php 
        if ($item->hasChildren()) {
            ?>
        <ul class="level<?php 
            echo intval($item->getLevel()) + 2;
            ?>
">
            <?php 
            foreach ($item->getChildren() as $child) {
                ?>
    <?php 
                $this->renderItem($child, $menu);
                ?>
    <?php 
            }
            ?>
            </ul>
    <?php 
        }
        ?>
        </li>
        <?php 
    }
Example #3
0
    protected function renderItem(JoomlaRokMenuNode &$item, RokMenuNodeTree &$menu)
    {
        global $gantry;
        $wrapper_css = '';
        $ul_css = '';
        $group_css = '';
        $item_params = new JParameter($item->getParams());
        //get columns count for children
        $columns = $item_params->get('fusion_columns', 1);
        //get custom image
        $custom_image = $item_params->get('fusion_customimage');
        $custom_class = $item_params->get('fusion_customclass');
        if ($custom_image && $custom_image != -1) {
            $item->addLinkClass('image');
        } else {
            $item->addLinkClass('bullet');
        }
        if ($custom_class != '') {
            $item->addListItemClass($custom_class);
        }
        $dropdown_width = $item_params->get('fusion_dropdown_width');
        $column_widths = explode(",", $item_params->get('fusion_column_widths'));
        if (trim($columns) == '') {
            $columns = 1;
        }
        if (trim($dropdown_width) == '') {
            $dropdown_width = 180;
        }
        $wrapper_css = ' style="width:' . trim($dropdown_width) . 'px;"';
        $col_total = 0;
        $cols_left = $columns;
        if (trim($column_widths[0] != '')) {
            for ($i = 0; $i < $columns; $i++) {
                if (isset($column_widths[$i])) {
                    $ul_css[] = ' style="width:' . trim($column_widths[$i]) . 'px;"';
                    $col_total += $column_widths[$i];
                    $cols_left--;
                } else {
                    $col_width = floor(intval((intval($dropdown_width) - $col_total) / $cols_left));
                    $ul_css[] = ' style="width:' . $col_width . 'px;"';
                }
            }
        } else {
            for ($i = 0; $i < $columns; $i++) {
                $col_width = floor(intval($dropdown_width) / $columns);
                $ul_css[] = ' style="width:' . $col_width . 'px;"';
            }
        }
        $grouping = $item_params->get('fusion_children_group');
        if ($grouping == 1) {
            $item->addListItemClass('grouped-parent');
        }
        $child_type = $item_params->get('fusion_children_type');
        $child_type = $child_type == '' ? 'menuitems' : $child_type;
        $distribution = $item_params->get('fusion_distribution');
        $manual_distribution = explode(",", $item_params->get('fusion_manual_distribution'));
        $modules = array();
        if ($child_type == 'modules') {
            $modules_id = $item_params->get('fusion_modules');
            $ids = is_array($modules_id) ? $modules_id : array($modules_id);
            foreach ($ids as $id) {
                if ($module = $this->getModule($id)) {
                    $modules[] = $module;
                }
            }
            $group_css = ' type-module';
        } elseif ($child_type == 'modulepos') {
            $modules_pos = $item_params->get('fusion_module_positions');
            $positions = is_array($modules_pos) ? $modules_pos : array($modules_pos);
            foreach ($positions as $pos) {
                $mod = $this->getModules($pos);
                $modules = array_merge($modules, $mod);
            }
            $group_css = ' type-module';
        }
        //not so elegant solution to add subtext
        $item_subtext = $item_params->get('fusion_item_subtext', '');
        if ($item_subtext == '') {
            $item_subtext = false;
        } else {
            $item->addLinkClass('subtext');
        }
        //sort out module children:
        if ($child_type != "menuitems") {
            $document =& JFactory::getDocument();
            $renderer = $document->loadRenderer('module');
            $params = array('style' => 'fusion');
            $mod_contents = array();
            foreach ($modules as $mod) {
                $mod_contents[] = $renderer->render($mod, $params);
            }
            $item->setChildren($mod_contents);
            $link_classes = explode(' ', $item->getLinkClasses());
            //replace orphan with daddy if needed
            if ($item->hasChildren() && in_array('orphan', $link_classes)) {
                $link_classes[array_search('orphan', $link_classes)] = 'daddy';
            }
            $item->setLinkClasses($link_classes);
        }
        ?>
        <li <?php 
        if ($item->hasListItemClasses()) {
            ?>
class="<?php 
            echo $item->getListItemClasses();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->hasCssId() && $this->activeid) {
            ?>
id="<?php 
            echo $item->getCssId();
            ?>
"<?php 
        }
        ?>
>
            <?php 
        if ($item->getType() == 'menuitem') {
            ?>
            	<?php 
            $urlCheck = JRoute::_($this->curPageURL($item->getLink()), true);
            if ($urlCheck) {
                $activeToTop = ' active-to-top';
            } else {
                $activeToTop = '';
            }
            ?>
                <a <?php 
            if ($item->hasLinkClasses()) {
                ?>
class="<?php 
                echo $item->getLinkClasses() . $activeToTop;
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasLink()) {
                ?>
href="<?php 
                echo $item->getLink();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasTarget()) {
                ?>
target="<?php 
                echo $item->getTarget();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasAttribute('onclick')) {
                ?>
onclick="<?php 
                echo $item->getAttribute('onclick');
                ?>
"<?php 
            }
            if ($item->hasLinkAttribs()) {
                ?>
 <?php 
                echo $item->getLinkAttribs();
            }
            ?>
>
                    <span>
                    <?php 
            if ($custom_image && $custom_image != -1) {
                ?>
                        <img src="<?php 
                echo $gantry->templateUrl . "/images/icons/" . $custom_image;
                ?>
" alt="<?php 
                echo $custom_image;
                ?>
" />
                    <?php 
            }
            ?>
                    <?php 
            echo $item->getTitle();
            ?>
                    <?php 
            if (!empty($item_subtext)) {
                ?>
                    <em><?php 
                echo $item_subtext;
                ?>
</em>
                    <?php 
            }
            ?>
                    <?php 
            if ($item->getParent() == RokNavMenu::TOP_LEVEL_PARENT_ID && $item->hasChildren()) {
                ?>
                    <span class="daddyicon"></span>
                    <?php 
            }
            ?>
                    </span>
                </a>
            <?php 
        } elseif ($item->getType() == 'separator') {
            ?>
                <span <?php 
            if ($item->hasLinkClasses()) {
                ?>
class="<?php 
                echo $item->getLinkClasses();
                ?>
 nolink"<?php 
            }
            ?>
>
                    <span>
                        <?php 
            if ($custom_image && $custom_image != -1) {
                ?>
                            <img src="<?php 
                echo $gantry->templateUrl . "/images/icons/" . $custom_image;
                ?>
" alt="<?php 
                echo $custom_image;
                ?>
" />
                        <?php 
            }
            ?>
                    <?php 
            echo $item->getTitle();
            ?>
                    <?php 
            if (!empty($item_subtext)) {
                ?>
                    <em><?php 
                echo $item_subtext;
                ?>
</em>
                    <?php 
            }
            ?>
                    <?php 
            if ($item->getParent() == RokNavMenu::TOP_LEVEL_PARENT_ID && $item->hasChildren()) {
                ?>
                    <span class="daddyicon"></span>
                    <?php 
            }
            ?>
                    </span>
                </span>
            <?php 
        }
        ?>

            <?php 
        if ($item->hasChildren()) {
            ?>
                <?php 
            if ($grouping == 0 or $item->getLevel() == 0) {
                if ($distribution == 'inorder') {
                    $count = sizeof($item->getChildren());
                    $items_per_col = intval(ceil($count / $columns));
                    $children_cols = array_chunk($item->getChildren(), $items_per_col);
                } elseif ($distribution == 'manual') {
                    $children_cols = $this->array_fill($item->getChildren(), $columns, $manual_distribution);
                } else {
                    $children_cols = $this->array_chunkd($item->getChildren(), $columns);
                }
                $col_counter = 0;
                ?>
                    <div class="fusion-submenu-wrapper level<?php 
                echo intval($item->getLevel()) + 2;
                ?>
 primary-overlay-<?php 
                global $gantry;
                echo $gantry->get('primary-overlay');
                if ($columns > 1) {
                    echo ' columns' . $columns;
                }
                ?>
"<?php 
                echo $wrapper_css;
                ?>
>
                        <?php 
                foreach ($children_cols as $col) {
                    ?>

                        <ul class="level<?php 
                    echo intval($item->getLevel()) + 2;
                    ?>
"<?php 
                    echo $ul_css[$col_counter++];
                    ?>
>
                            <?php 
                    foreach ($col as $child) {
                        ?>
                                <?php 
                        if ($child_type == 'menuitems') {
                            ?>
                                    <?php 
                            $this->renderItem($child, $menu);
                            ?>
                                <?php 
                        } else {
                            ?>
                                    <li>
                                        <div class="fusion-modules item">
                                        <?php 
                            echo $child;
                            ?>
                                        </div>
                                    </li>
                                <?php 
                        }
                        ?>
                            <?php 
                    }
                    ?>
                        </ul>

                        <?php 
                }
                ?>
                        <div class="drop-bot"></div>
                    </div>
                <?php 
            } else {
                ?>
                    <div class="fusion-grouped<?php 
                echo $group_css;
                ?>
">
                        <ol>
                            <?php 
                foreach ($item->getChildren() as $child) {
                    ?>
                                <?php 
                    if ($child_type == 'menuitems') {
                        ?>
                                    <?php 
                        $this->renderItem($child, $menu);
                        ?>
                                <?php 
                    } else {
                        ?>
                                    <li>
                                        <div class="fusion-modules item">
                                        <?php 
                        echo $child;
                        ?>
                                        </div>
                                    </li>
                                <?php 
                    }
                    ?>
                            <?php 
                }
                ?>
                        </ol>
                    </div>

                <?php 
            }
            ?>
            <?php 
        }
        ?>
        </li>
        <?php 
    }
Example #4
0
        protected function renderItem(JoomlaRokMenuNode &$item, &$menu)
        {
            ?>
            <li <?php 
            if ($item->hasListItemClasses()) {
                ?>
class="<?php 
                echo $item->getListItemClasses();
                ?>
"<?php 
            }
            ?>
 <?php 
            if (null != $item->getCssId()) {
                ?>
id="<?php 
                echo $item->getCssId();
                ?>
"<?php 
            }
            ?>
>
            <?php 
            if ($item->getType() == 'menuitem') {
                ?>
            <a <?php 
                if ($item->hasLinkClasses()) {
                    ?>
class="<?php 
                    echo $item->getLinkClasses();
                    ?>
"<?php 
                }
                ?>
 <?php 
                if ($item->hasLink()) {
                    ?>
href="<?php 
                    echo $item->getLink();
                    ?>
"<?php 
                }
                ?>
 <?php 
                if (null != $item->getTarget()) {
                    ?>
target="<?php 
                    echo $item->getTarget();
                    ?>
"<?php 
                }
                ?>
 <?php 
                if ($item->hasLinkAttribs()) {
                    ?>
 <?php 
                    echo $item->getLinkAttribs();
                }
                ?>
>
        <?php 
                if (null != $item->getImage()) {
                    ?>
                    <img alt="<?php 
                    echo $item->getAlias();
                    ?>
" src="<?php 
                    echo $item->getImage();
                    ?>
"/><?php 
                }
                ?>
            <span <?php 
                if ($item->hasSpanClasses()) {
                    ?>
class="<?php 
                    echo $item->getSpanClasses();
                    ?>
"<?php 
                }
                ?>
><?php 
                echo $item->getTitle();
                ?>
</span>
                </a>
        <?php 
            } elseif ($item->getType() == 'separator') {
                ?>
            <span <?php 
                if ($item->hasSpanClasses()) {
                    ?>
class="<?php 
                    echo $item->getSpanClasses();
                    ?>
"<?php 
                }
                ?>
><?php 
                echo $item->getTitle();
                ?>
</span>
        <?php 
            }
            ?>
            <?php 
            if ($item->hasChildren()) {
                ?>
            <ul>
                    <?php 
                foreach ($item->getChildren() as $child) {
                    ?>
        <?php 
                    $this->renderItem($child, $menu);
                    ?>
        <?php 
                }
                ?>
            </ul>
        <?php 
            }
            ?>
            </li>
            <?php 
        }
Example #5
0
 protected function renderItem(JoomlaRokMenuNode &$item, RokMenuNodeTree &$menu)
 {
     $item_params = new JParameter($item->getParams());
     //not so elegant solution to add subtext
     $item_subtext = $item_params->get('splitmenu_item_subtext','');
     ?>
     <li id="<?php echo $item->getCssId();?>">
         <?php if ($item->getType() == 'menuitem') : ?>
             <a <?php if($item->hasLinkClasses()):?>class="<?php echo $item->getLinkClasses();?>"<?php endif;?> <?php if($item->hasLink()):?>href="<?php echo $item->getLink();?>"<?php endif;?> <?php if($item->hasTarget()):?>target="<?php echo $item->getTarget();?>"<?php endif;?> <?php if ($item->hasAttribute('onclick')): ?>onclick="<?php echo $item->getAttribute('onclick'); ?>"<?php endif; ?><?php if ($item->hasLinkAttribs()): ?> <?php echo $item->getLinkAttribs(); ?><?php endif; ?>>
                 <span>
                 <?php echo $item->getTitle();?>
                 <?php if (!empty($item_subtext)) :?>
                 <em><?php echo $item_subtext; ?></em>
                 <?php endif; ?>
                 </span>
             </a>
         <?php elseif($item->getType() == 'separator') : ?>
             <a href="#" <?php if($item->hasLinkClasses()):?>class="<?php echo $item->getLinkClasses();?> nolink"<?php endif;?>><span <?php if($item->hasLinkClasses()):?>class="<?php echo $item->getLinkClasses();?> nolink"<?php endif;?>>
                 <span>
                 <?php echo $item->getTitle();?>
                 <?php if (!empty($item_subtext)) :?>
                 <em><?php echo $item_subtext; ?></em>
                 <?php endif; ?>
                 </span>
             </span></a>
         <?php endif; ?>
         <?php if ($item->hasChildren()): ?>
                 <ul class="level<?php echo intval($item->getLevel())+2; ?>">
                     <?php foreach ($item->getChildren() as $child) : ?>
                         <?php $this->renderItem($child, $menu); ?>
                     <?php endforeach; ?>
                 </ul>
         <?php endif; ?>
     </li>
     <?php
 }
        public function getFullMenuItems($args){
            $menu = JSite::getMenu();
            // Get Menu Items
            $rows = $menu->getItems('menutype', $args['menutype']);

            $outputNodes = array();
            foreach ($rows as $item) {
                //Create the new Node
                $node = new JoomlaRokMenuNode();

                $node->setId($item->id);
                $node->setParent($item->parent);
                $node->setTitle(addslashes(htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8')));
                $node->setParams($item->params);
                $node->setLink($item->link);

                // Menu Link is a special type that is a link to another item
                if ($item->type == 'menulink' && $newItem = $menu->getItem($item->query['Itemid'])) {
                    $node->setAlias(true);
                    $node->setLink($newItem->link);
                }

                // Get the icon image associated with the item
                $iParams = new JParameter($item->params);
                if ($args['menu_images'] && $iParams->get('menu_image') && $iParams->get('menu_image') != -1) {
                    $node->setImage(JURI::base(true) . '/images/stories/' . $iParams->get('menu_image'));
                    if ($args['menu_images_link']) {
                        $node->setLink(null);
                    }
                }

                switch ($item->type)
                {
                    case 'separator':
                        $node->setType('separator');
                        break;
                    case 'url':
                        if ((strpos($node->getLink(), 'index.php?') === 0) && (strpos($node->getLink(), 'Itemid=') === false)) {
                            $node->setLink($node->getLink() . '&amp;Itemid=' . $node->getId());
                        }
                        $node->setType('menuitem');
                        break;
                    default :
                        $router = JSite::getRouter();
                        if ($node->isAlias() && $newItem){
                            $menu_id = $item->query['Itemid'];
                        }
                        else {
                            $menu_id = $node->getId();
                        }
                        $link = ($router->getMode() == JROUTER_MODE_SEF)? 'index.php?Itemid=' . $menu_id : $node->getLink() . '&Itemid=' . $menu_id;
                        $node->setLink($link);
                        $node->setType('menuitem');
                        break;
                }


                if ($node->getLink() != null) {
                    // set the target based on menu item options
                    switch ($item->browserNav)
                    {
                        case 1:
                            $node->setTarget('new');
                            break;
                        case 2:
                            $node->setLink(str_replace('index.php', 'index2.php', $node->getLink()));
                            $node->setTarget('newnotool');
                            break;
                        default:
                            //$node->setTarget('current');
                            break;
                    }


                    // Get the final URL
                    if ($item->home == 1) { // Set Home Links to the Base
                        $node->setLink(JURI::base());
                    }

                    if ($item->type != 'separator' && $item->type != 'url') {
                        $iSecure = $iParams->get('secure', 0);
                        if (array_key_exists('url_type',$args) && $args['url_type'] == 'full') {
                            $url = JRoute::_($node->getLink(), true, $iSecure);
                            $base = (!preg_match("/^http/", $node->getLink())) ? preg_replace("#/$#", "", JURI::base(false)) : '';
                            $routed = $base . $url;
                            $secure = RokNavMenuTree::_getSecureUrl($routed, $iSecure);
                            $node->setLink($secure);
                        } else {
                            $node->setLink(JRoute::_($node->getLink(), true, $iSecure));
                        }
                    }
                    else if ($item->type == 'url') {
                        $node->setLink(str_replace('&', '&amp;', $node->getLink()));
                    }
                }

                $node->addListItemClass("item" . $node->getId());
                $node->setAccess($item->access);
                $node->addSpanClass($node->getType());

                $user =& JFactory::getUser();


                if ($node->getAccess() <=  $user->get('aid', 0)){
                    // Add node to output list
                    $outputNodes[$node->getId()] = $node;
                }
            }
            return $outputNodes;
        }
 public function getFullMenuItems($args)
 {
     $app = JFactory::getApplication();
     $menu = $app->getMenu();
     // Get Menu Items
     $rows = $menu->getItems('menutype', $args['menutype']);
     $outputNodes = array();
     if (is_array($rows) && count($rows) > 0) {
         foreach ($rows as $item) {
             //Create the new Node
             $node = new JoomlaRokMenuNode();
             $node->setId($item->id);
             $node->setParent($item->parent_id);
             $node->setTitle(addslashes(htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8')));
             $node->setParams($item->params);
             $node->setLink($item->link);
             // Menu Link is a special type that is a link to another item
             if ($item->type == 'alias' && ($newItem = $menu->getItem($item->params->get('aliasoptions')))) {
                 $node->setAlias(true);
                 $node->setLink($newItem->link);
             }
             // Get the icon image associated with the item
             $iParams = is_object($item->params) ? $item->params : new JRegisry($item->params);
             if ($args['menu_images'] && $iParams->get('menu_image') && $iParams->get('menu_image') != -1) {
                 $node->setImage(JURI::base(true) . '/images/stories/' . $iParams->get('menu_image'));
                 if ($args['menu_images_link']) {
                     $node->setLink(null);
                 }
             }
             switch ($item->type) {
                 case 'separator':
                     $node->setType('separator');
                     break;
                 case 'url':
                     if (strpos($node->getLink(), 'index.php?') === 0 && strpos($node->getLink(), 'Itemid=') === false) {
                         $node->setLink($node->getLink() . '&amp;Itemid=' . $node->getId());
                     } elseif (!empty($item->link) && $item->link != null) {
                         $node->setLink($item->link);
                     }
                     $node->setType('menuitem');
                     break;
                 default:
                     $router = JSite::getRouter();
                     if ($node->isAlias() && $newItem) {
                         $menu_id = $item->params->get('aliasoptions');
                         $node->setMenuId($menu_id);
                         //for aliased items formatter.php doesn't cover
                         if ($node->getMenuId() == $this->current_node) {
                             //taken back out because it caused all the aliased menu items on RT demos to highlight
                             //$node->addListItemClass('active');
                             //$node->setCssId('current');
                         }
                     } else {
                         $menu_id = $node->getId();
                         $node->setMenuId($menu_id);
                     }
                     $link = $router->getMode() == JROUTER_MODE_SEF ? 'index.php?Itemid=' . $menu_id : $node->getLink() . '&Itemid=' . $menu_id;
                     $node->setLink($link);
                     $node->setType('menuitem');
                     break;
             }
             if ($node->getLink() != null) {
                 // set the target based on menu item options
                 switch ($item->browserNav) {
                     case 1:
                         $node->setTarget('_blank');
                         break;
                     case 2:
                         //$node->setLink(str_replace('index.php', 'index2.php', $node->getLink()));
                         //$node->setTarget('newnotool');
                         $value = addslashes(htmlspecialchars("window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes');return false;", ENT_QUOTES, 'UTF-8'));
                         $node->addLinkAttrib('onclick', $value);
                         break;
                     default:
                         //$node->setTarget('current');
                         break;
                 }
                 // Get the final URL
                 if ($item->home == 1) {
                     // Set Home Links to the Base
                     //removed because it breaks SEF extensions
                     //$node->setLink(JRoute::_(JURI::base()));
                 }
                 if ($item->type != 'separator' && $item->type != 'url') {
                     $iSecure = $iParams->get('secure', 0);
                     if (array_key_exists('url_type', $args) && $args['url_type'] == 'full') {
                         $url = JRoute::_($node->getLink(), true, $iSecure);
                         $base = !preg_match("/^http/", $node->getLink()) ? rtrim(JURI::base(false) . '/') : '';
                         $routed = $base . $url;
                         $secure = RokNavMenuTree::_getSecureUrl($routed, $iSecure);
                         $node->setLink($secure);
                     } else {
                         $node->setLink(JRoute::_($node->getLink(), true, $iSecure));
                     }
                 } else {
                     if ($item->type == 'url') {
                         $node->setLink(str_replace('&', '&amp;', $node->getLink()));
                     }
                 }
             }
             $node->addListItemClass("item" . $node->getId());
             $node->setAccess($item->access);
             $node->addSpanClass($node->getType());
             $outputNodes[$node->getId()] = $node;
         }
     }
     return $outputNodes;
 }
Example #8
0
    protected function renderItem(JoomlaRokMenuNode &$item, RokMenuNodeTree &$menu)
    {
        $item_params = $item->getParams();
        //not so elegant solution to add subtext
        $item_subtext = $item_params->get('splitmenu_item_subtext', '');
        if ($item_subtext == '') {
            $item_subtext = false;
        } else {
            $item->addLinkClass('subtext');
        }
        ?>
        <li <?php 
        if ($item->hasListItemClasses()) {
            ?>
class="<?php 
            echo $item->getListItemClasses();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->hasCssId() && $this->activeid) {
            ?>
id="<?php 
            echo $item->getCssId();
            ?>
"<?php 
        }
        ?>
>
            <?php 
        if ($item->getType() == 'menuitem') {
            ?>
            	<?php 
            $urlCheck = JRoute::_($this->curPageURL($item->getLink()), true);
            if ($urlCheck) {
                $activeToTop = ' active-to-top';
            } else {
                $activeToTop = '';
            }
            ?>
                <a <?php 
            if ($item->hasLinkClasses()) {
                ?>
class="<?php 
                echo $item->getLinkClasses() . $activeToTop;
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasLink()) {
                ?>
href="<?php 
                echo $item->getLink();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasTarget()) {
                ?>
target="<?php 
                echo $item->getTarget();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasAttribute('onclick')) {
                ?>
onclick="<?php 
                echo $item->getAttribute('onclick');
                ?>
"<?php 
            }
            if ($item->hasLinkAttribs()) {
                ?>
 <?php 
                echo $item->getLinkAttribs();
            }
            ?>
>
                    <span>
                    <?php 
            echo $item->getTitle();
            ?>
                    <?php 
            if (!empty($item_subtext)) {
                ?>
                    <em><?php 
                echo $item_subtext;
                ?>
</em>
                    <?php 
            }
            ?>
                    <?php 
            if ($item->getParent() == 0 && $item->hasChildren()) {
                ?>
                    <span class="daddyicon"></span>
                    <?php 
            }
            ?>
					<?php 
            if ($item->getCssId()) {
                ?>
					<span class="arrow-indicator"></span>
					<?php 
            }
            ?>
                    </span>
                </a>
            <?php 
        } elseif ($item->getType() == 'separator') {
            ?>
                <span <?php 
            if ($item->hasLinkClasses()) {
                ?>
class="<?php 
                echo $item->getLinkClasses();
                ?>
 nolink"<?php 
            }
            ?>
>
                    <span>
                    <?php 
            echo $item->getTitle();
            ?>
                    <?php 
            if (!empty($item_subtext)) {
                ?>
                    <em><?php 
                echo $item_subtext;
                ?>
</em>
                    <?php 
            }
            ?>
                    <?php 
            if ($item->getParent() == 0 && $item->hasChildren()) {
                ?>
                    <span class="daddyicon"></span>
                    <?php 
            }
            ?>
                    </span>
                </span>
            <?php 
        }
        ?>
            <?php 
        if ($item->hasChildren()) {
            ?>
            <ul class="level<?php 
            echo intval($item->getLevel()) + 2;
            ?>
">
                <?php 
            foreach ($item->getChildren() as $child) {
                ?>
                    <?php 
                $this->renderItem($child, $menu);
                ?>
                <?php 
            }
            ?>
            </ul>
            <?php 
        }
        ?>
        </li>
        <?php 
    }
Example #9
0
    protected function renderItem(JoomlaRokMenuNode &$item, RokMenuNodeTree &$menu)
    {
        /** @var $gantry Gantry */
        global $gantry;
        $wrapper_css = '';
        $ul_css = '';
        $group_css = '';
        $item_params = $item->getParams();
        //get columns count for children
        $columns = $item_params->get('dropdown_columns', 1);
        //get custom image
        $custom_image = $item_params->get('dropdown_customimage');
        //get the custom icon
        $custom_icon = $item_params->get('dropdown_customicon');
        //get the custom class
        $custom_class = $item_params->get('dropdown_customclass');
        //add default link class
        $item->addLinkClass('item');
        if ($custom_image && $custom_image != -1) {
            $item->addLinkClass('image');
        }
        if ($custom_icon && $custom_icon != -1) {
            $item->addLinkClass('icon');
        }
        if ($custom_class != '') {
            $item->addListItemClass($custom_class);
        }
        $dropdown_width = intval(trim($item_params->get('dropdown_dropdown_width')));
        $column_widths = explode(",", $item_params->get('dropdown_column_widths'));
        if (trim($columns) == '') {
            $columns = 1;
        }
        if ($dropdown_width == 0) {
            $dropdown_width = 180;
        }
        $wrapper_css = ' style="width:' . $dropdown_width . 'px;"';
        $col_total = 0;
        $cols_left = $columns;
        if (trim($column_widths[0] != '')) {
            for ($i = 0; $i < $columns; $i++) {
                if (isset($column_widths[$i])) {
                    $ul_css[] = ' style="width:' . trim(intval($column_widths[$i])) . 'px;"';
                    $col_total += intval($column_widths[$i]);
                    $cols_left--;
                } else {
                    $col_width = floor(intval((intval($dropdown_width) - $col_total) / $cols_left));
                    $ul_css[] = ' style="width:' . $col_width . 'px;"';
                }
            }
        } else {
            for ($i = 0; $i < $columns; $i++) {
                $col_width = floor(intval($dropdown_width) / $columns);
                $ul_css[] = ' style="width:' . $col_width . 'px;"';
            }
        }
        $grouping = $item_params->get('dropdown_children_group');
        if ($grouping == 1) {
            $item->addListItemClass('grouped');
        }
        $child_type = $item_params->get('dropdown_children_type');
        $child_type = $child_type == '' ? 'menuitems' : $child_type;
        $distribution = $item_params->get('dropdown_distribution');
        $manual_distribution = explode(",", $item_params->get('dropdown_manual_distribution'));
        $modules = array();
        if ($child_type == 'modules') {
            $modules_id = $item_params->get('dropdown_modules');
            $ids = is_array($modules_id) ? $modules_id : array($modules_id);
            foreach ($ids as $id) {
                if ($module = $this->getModule($id)) {
                    $modules[] = $module;
                }
            }
            $group_css = ' type-module';
        } elseif ($child_type == 'modulepos') {
            $modules_pos = $item_params->get('dropdown_module_positions');
            $positions = is_array($modules_pos) ? $modules_pos : array($modules_pos);
            foreach ($positions as $pos) {
                $mod = $this->getModules($pos);
                $modules = array_merge($modules, $mod);
            }
            $group_css = ' type-module';
        }
        //not so elegant solution to add subtext
        $item_subtext = $item_params->get('dropdown_item_subtext', '');
        if ($item_subtext == '') {
            $item_subtext = false;
        } else {
            $item->addLinkClass('subtext');
        }
        //sort out module children:
        if ($child_type != "menuitems") {
            $document = JFactory::getDocument();
            $renderer = $document->loadRenderer('module');
            $params = array('style' => 'dropdown');
            $mod_contents = array();
            foreach ($modules as $mod) {
                $mod_contents[] = $renderer->render($mod, $params);
            }
            $item->setChildren($mod_contents);
            $link_classes = explode(' ', $item->getLinkClasses());
            $item->setLinkClasses($link_classes);
        }
        if ($item->getType() != 'menuitem') {
            $item->setLink('javascript:void(0);');
        }
        ?>
        <li <?php 
        if ($item->hasListItemClasses()) {
            ?>
class="<?php 
            echo $item->getListItemClasses();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->hasCssId() && $this->activeid) {
            ?>
id="<?php 
            echo $item->getCssId();
            ?>
"<?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->hasTarget()) {
            ?>
target="<?php 
            echo $item->getTarget();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->hasAttribute('onclick')) {
            ?>
onclick="<?php 
            echo $item->getAttribute('onclick');
            ?>
"<?php 
        }
        if ($item->hasLinkAttribs()) {
            ?>
 <?php 
            echo $item->getLinkAttribs();
        }
        ?>
>

                <?php 
        if ($custom_image && $custom_image != -1) {
            ?>
                    <img class="menu-image" src="<?php 
            echo $gantry->templateUrl . "/images/icons/" . $custom_image;
            ?>
" alt="<?php 
            echo $custom_image;
            ?>
" />
                <?php 
        }
        ?>
                <?php 
        if ($custom_icon && $custom_icon != -1) {
            echo '<i class="' . $custom_icon . '">' . $item->getTitle() . '</i>';
        } else {
            echo $item->getTitle();
        }
        if (!empty($item_subtext)) {
            echo '<em>' . $item_subtext . '</em>';
        }
        ?>
                <?php 
        // Comment this out if you don't need a 1px bottom border fix
        if ($item->hasChildren()) {
            ?>
                <span class="border-fixer"></span>
                <?php 
        }
        ?>
            </a>


            <?php 
        if ($item->hasChildren()) {
            ?>

                <?php 
            if ($grouping == 0 or $item->getLevel() == 0) {
                if ($distribution == 'inorder') {
                    $count = sizeof($item->getChildren());
                    $items_per_col = intval(ceil($count / $columns));
                    $children_cols = array_chunk($item->getChildren(), $items_per_col);
                } elseif ($distribution == 'manual') {
                    $children_cols = $this->array_fill($item->getChildren(), $columns, $manual_distribution);
                } else {
                    $children_cols = $this->array_chunkd($item->getChildren(), $columns);
                }
                $col_counter = 0;
                ?>
                    <div class="dropdown <?php 
                if ($item->getLevel() > 0) {
                    echo 'flyout ';
                }
                echo 'columns-' . $columns . ' ';
                ?>
"<?php 
                echo $wrapper_css;
                ?>
>
                        <?php 
                foreach ($children_cols as $col) {
                    ?>
                        <div class="column col<?php 
                    echo intval($col_counter) + 1;
                    ?>
" <?php 
                    echo $ul_css[$col_counter++];
                    ?>
>
                            <ul class="l<?php 
                    echo $item->getLevel() + 2;
                    ?>
">
                                <?php 
                    foreach ($col as $child) {
                        ?>
                                    <?php 
                        if ($child_type == 'menuitems') {
                            ?>
                                        <?php 
                            $this->renderItem($child, $menu);
                            ?>
                                    <?php 
                        } else {
                            ?>
                                        <li class="modules">
                                            <div class="module-content">
                                                <?php 
                            echo $child;
                            ?>
                                            </div>
                                        </li>
                                    <?php 
                        }
                        ?>
                                <?php 
                    }
                    ?>
                            </ul>
                        </div>
                        <?php 
                }
                ?>
                    </div>

                <?php 
            } else {
                ?>

                    <ol class="<?php 
                echo $group_css;
                ?>
">
                        <?php 
                foreach ($item->getChildren() as $child) {
                    ?>
                            <?php 
                    if ($child_type == 'menuitems') {
                        ?>
                                <?php 
                        $this->renderItem($child, $menu);
                        ?>
                            <?php 
                    } else {
                        ?>
                                <li class="modules">
                                    <div class="module-content">
                                        <?php 
                        echo $child;
                        ?>
                                    </div>
                                </li>
                            <?php 
                    }
                    ?>
                        <?php 
                }
                ?>
                    </ol>

                <?php 
            }
            ?>
            <?php 
        }
        ?>
        </li>
        <?php 
    }
    protected function renderItem(JoomlaRokMenuNode &$item, RokMenuNodeTree &$menu)
    {
        global $gantry;
        $wrapper_css = '';
        $item_params = $item->getParams();
        //add default link class
        $item->addLinkClass('item');
        $dropdown_width = intval(trim($item_params->get('dropdown_dropdown_width')));
        if ($dropdown_width == 0) {
            $dropdown_width = 180;
        }
        $wrapper_css = ' style="width:' . $dropdown_width . 'px;"';
        if ($item->getType() != 'menuitem') {
            $item->setLink('javascript:void(0);');
        }
        ?>
        <li <?php 
        if ($item->hasListItemClasses()) {
            ?>
class="<?php 
            echo $item->getListItemClasses();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->hasCssId() && $this->activeid) {
            ?>
id="<?php 
            echo $item->getCssId();
            ?>
"<?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->hasTarget()) {
            ?>
target="<?php 
            echo $item->getTarget();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->hasAttribute('onclick')) {
            ?>
onclick="<?php 
            echo $item->getAttribute('onclick');
            ?>
"<?php 
        }
        if ($item->hasLinkAttribs()) {
            ?>
 <?php 
            echo $item->getLinkAttribs();
        }
        ?>
>
                <?php 
        echo $item->getTitle();
        ?>
            </a>

            <?php 
        if ($item->hasChildren()) {
            ?>
			<div class="dropdown <?php 
            if ($item->getLevel() > 0) {
                echo 'flyout ';
            }
            ?>
" <?php 
            echo $wrapper_css;
            ?>
>
				<div class="column">
					<ul class="level<?php 
            echo intval($item->getLevel()) + 2;
            ?>
">
					<?php 
            foreach ($item->getChildren() as $child) {
                ?>
						<?php 
                $this->renderItem($child, $menu);
                ?>
					<?php 
            }
            ?>
					</ul>
				</div>
			</div>
            <?php 
        }
        ?>
 
        </li>
        <?php 
    }
Example #11
0
    protected function renderItem(JoomlaRokMenuNode &$item, RokMenuNodeTree &$menu)
    {
        global $gantry;
        $item_params = $item->getParams();
        //not so elegant solution to add subtext
        $item_subtext = $item_params->get('splitmenu_item_subtext', '');
        if ($item_subtext == '') {
            $item_subtext = false;
        } else {
            $item->addLinkClass('subtext');
        }
        //get custom image
        $custom_image = $item_params->get('splitmenu_customimage');
        //get the custom icon
        $custom_icon = $item_params->get('splitmenu_customicon');
        //get the custom class
        $custom_class = $item_params->get('splitmenu_customclass');
        //add default link class
        $item->addLinkClass('item');
        if ($custom_image && $custom_image != -1) {
            $item->addLinkClass('image');
        }
        if ($custom_icon && $custom_icon != -1) {
            $item->addLinkClass('icon');
        }
        if ($custom_class != '') {
            $item->addListItemClass($custom_class);
        }
        if ($item_params->get('splitmenu_menu_entry_type', 'normal') == 'normal') {
            if ($item->getType() != 'menuitem') {
                $item->setLink('javascript:void(0);');
            }
            ?>
        <li <?php 
            if ($item->hasListItemClasses()) {
                ?>
class="<?php 
                echo $item->getListItemClasses();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasCssId() && $this->activeid) {
                ?>
id="<?php 
                echo $item->getCssId();
                ?>
"<?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->hasTarget()) {
                ?>
target="<?php 
                echo $item->getTarget();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasAttribute('onclick')) {
                ?>
onclick="<?php 
                echo $item->getAttribute('onclick');
                ?>
"<?php 
            }
            if ($item->hasLinkAttribs()) {
                ?>
 <?php 
                echo $item->getLinkAttribs();
            }
            ?>
>

                <?php 
            if ($custom_image && $custom_image != -1) {
                ?>
                    <img class="menu-image" src="<?php 
                echo $gantry->templateUrl . "/images/icons/" . $custom_image;
                ?>
" alt="<?php 
                echo $custom_image;
                ?>
" />
                    <?php 
            }
            ?>
                <?php 
            if ($custom_icon && $custom_icon != -1) {
                echo '<i class="' . $custom_icon . '">' . $item->getTitle() . '</i>';
            } else {
                echo $item->getTitle();
            }
            if (!empty($item_subtext)) {
                echo '<em>' . $item_subtext . '</em>';
            }
            ?>
                </a>

            <?php 
            if ($item->hasChildren()) {
                ?>
            <ul class="level<?php 
                echo intval($item->getLevel()) + 2;
                ?>
">
                <?php 
                foreach ($item->getChildren() as $child) {
                    ?>
                    <?php 
                    $this->renderItem($child, $menu);
                    ?>
                <?php 
                }
                ?>
            </ul>
            <?php 
            }
            ?>
        </li>
		<?php 
        } else {
            $item->addListItemClass('menu-module');
            $module_id = $item_params->get('splitmenu_menu_module');
            $menu_module = $this->getModule($module_id);
            $document = JFactory::getDocument();
            $renderer = $document->loadRenderer('module');
            $params = array('style' => 'splitmenu');
            $module_content = $renderer->render($menu_module, $params);
            ?>
		<li <?php 
            if ($item->hasListItemClasses()) {
                ?>
class="<?php 
                echo $item->getListItemClasses();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasCssId() && $this->activeid) {
                ?>
id="<?php 
                echo $item->getCssId();
                ?>
"<?php 
            }
            ?>
>
			<?php 
            echo $module_content;
            ?>
		</li>
        <?php 
        }
    }