Exemple #1
0
    protected function renderItem(RokMenuNode &$item, &$menu)
    {
        global $gantry;
        //check if splitmenu is set as main menu
        if (isset($this->args['style']) && $this->args['style'] == 'mainmenu') {
            $splitmenu_mainmenu = true;
        } else {
            $splitmenu_mainmenu = false;
        }
        //not so elegant solution to add subtext
        $item_subtext = $item->getAttribute('item_subtext');
        if ($item_subtext == '') {
            $item_subtext = false;
        } else {
            $item->addLinkClass('subtext');
        }
        //get custom image
        $custom_image = $item->getAttribute('customimage');
        //get the custom icon
        $custom_icon = $item->getAttribute('customicon');
        //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 ($item->getLink() == '#') {
            $item->setLink('javascript:void(0);');
        }
        ?>
		<li <?php 
        if ($item->hasListItemClasses()) {
            ?>
class="<?php 
            echo $item->getListItemClasses();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->getCssId()) {
            ?>
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->getTarget()) {
            ?>
target="<?php 
            echo $item->getTarget();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->hasLinkAttribs()) {
            ?>
 <?php 
            echo $item->getLinkAttribs();
        }
        ?>
>

				<?php 
        if ($custom_image && $custom_image != -1 && $splitmenu_mainmenu) {
            ?>
					<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 && $splitmenu_mainmenu) {
            echo '<i class="' . $custom_icon . '"></i> ' . $item->getTitle();
        } else {
            echo $item->getTitle();
        }
        if (!empty($item_subtext) && $splitmenu_mainmenu) {
            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 
                echo $this->renderItem($child, $menu);
                ?>
				<?php 
            }
            ?>
			</ul>
			<?php 
        }
        ?>
		</li>
		<?php 
    }
Exemple #2
0
    protected function renderItem(RokMenuNode &$item, &$menu)
    {
        global $gantry;
        $wrapper_css = '';
        $ul_css = '';
        $group_css = '';
        //get columns count for children
        $columns = $item->getAttribute('columns');
        //get custom image
        $custom_image = $item->getAttribute('customimage');
        //get the custom icon
        $custom_icon = $item->getAttribute('customicon');
        //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');
        }
        $dropdown_width = intval(trim($item->getAttribute('dropdown_width')));
        $column_widths = explode(",", $item->getAttribute('column_widths'));
        if (trim($columns) == '') {
            $columns = 1;
        }
        if (trim($dropdown_width) == 0) {
            $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(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;"';
            }
        }
        // Menu Item Grouping
        $grouping = $item->getAttribute('children_group');
        if ($grouping == 1) {
            $item->addListItemClass('grouped');
        }
        $child_type = 'menuitems';
        $distribution = $item->getAttribute('distribution');
        $manual_distribution = explode(",", $item->getAttribute('manual_distribution'));
        //not so elegant solution to add subtext
        $item_subtext = $item->getAttribute('item_subtext');
        if ($item_subtext == '') {
            $item_subtext = false;
        } else {
            $item->addLinkClass('subtext');
        }
        if ($item->getLink() == '#') {
            $item->setLink('javascript:void(0);');
        }
        ?>
		
		<li <?php 
        if ($item->hasListItemClasses()) {
            ?>
class="<?php 
            echo $item->getListItemClasses();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->getCssId()) {
            ?>
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->getTarget()) {
            ?>
target="<?php 
            echo $item->getTarget();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->hasLinkAttribs()) {
            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 . '"></i> ' . $item->getTitle();
        } 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) {
                    ?>
						<ul class="column col<?php 
                    echo intval($col_counter) + 1;
                    ?>
"<?php 
                    echo $ul_css[$col_counter++];
                    ?>
>
							<?php 
                    foreach ($col as $child) {
                        ?>
								<?php 
                        echo $this->renderItem($child, $menu);
                        ?>
							<?php 
                    }
                    ?>
						</ul>
						<?php 
                }
                ?>
					</div>

				<?php 
            } else {
                ?>

					<ol class="<?php 
                echo $group_css;
                ?>
">
						<?php 
                foreach ($item->getChildren() as $child) {
                    ?>
							<?php 
                    echo $this->renderItem($child, $menu);
                    ?>
						<?php 
                }
                ?>
					</ol>

				<?php 
            }
            ?>
			<?php 
        }
        ?>
		</li>
		<?php 
    }
Exemple #3
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 
    }
Exemple #4
0
    protected function renderItem(RokMenuNode &$item, &$menu)
    {
        global $gantry;
        //get custom image
        if ($item->getAttribute('icon')) {
            $item->addLinkClass('image');
        } else {
            $item->addLinkClass('bullet');
        }
        if ($item->getAttribute('subtext')) {
            $item->addLinkClass('subtext');
        }
        ?>
        <li <?php 
        if ($item->hasListItemClasses()) {
            ?>
class="<?php 
            echo $item->getListItemClasses();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->getCssId()) {
            ?>
id="<?php 
            echo $item->getCssId();
            ?>
"<?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 
        $icon = $item->getAttribute('icon');
        ?>
             <?php 
        if (!empty($icon)) {
            ?>
                 <img src="<?php 
            echo $gantry->templateUrl . '/images/icons/' . $icon;
            ?>
"
                      alt=""/>
             <?php 
        }
        ?>
             <?php 
        echo $item->getTitle();
        ?>
             <?php 
        $subtext = $item->getAttribute('subtext');
        if (is_array($subtext)) {
            $subtext = implode("\n", $subtext);
        }
        ?>
             <?php 
        if (!empty($subtext)) {
            ?>
<em><?php 
            echo stripslashes($subtext);
            ?>
</em><?php 
        }
        ?>
            </span>
            </a>
	        <?php 
        $columns = $item->getAttribute('submenu_cols');
        ?>
	        <?php 
        if ($item->hasChildren()) {
            ?>
        	<div class="fusion-submenu-wrapper level<?php 
            echo intval($item->getLevel()) + 2;
            if ($columns > 1) {
                echo ' columns' . $columns;
            }
            ?>
">
	            <ul class="level<?php 
            echo intval($item->getLevel()) + 2;
            if ($columns > 1) {
                echo ' columns' . $columns;
            }
            ?>
">
		            <?php 
            foreach ($item->getChildren() as $child) {
                ?>
			            <?php 
                echo $this->renderItem($child, $menu);
                ?>
		            <?php 
            }
            ?>
	            </ul>
	        </div>
	        <?php 
        }
        ?>
        </li>
        <?php 
    }
 function getMenuItems()
 {
     $nav_menu_name = $this->args['nav_menu'];
     if (wp_get_nav_menu_object($nav_menu_name) == false) {
         return array();
     }
     $menu_items = wp_get_nav_menu_items($nav_menu_name);
     $outputNodes = array();
     foreach ($menu_items as $menu_item) {
         //Create the new Node
         $node = new RokMenuNode();
         $node->setId($menu_item->ID);
         $node->setParent($menu_item->menu_item_parent);
         $node->setTitle($menu_item->title);
         $node->setLink($menu_item->url);
         $node->setTarget($menu_item->target);
         if (!empty($menu_item->description)) {
             $node->addAttribute('description', $menu_item->description);
         }
         if (!empty($menu_item->xfn)) {
             $node->addLinkAttrib('rel', $menu_item->xfn);
         }
         if (!empty($menu_item->attr_title)) {
             $node->addLinkAttrib('title', $menu_item->attr_title);
         }
         foreach ($menu_item->classes as $miclass) {
             $node->addListItemClass($miclass);
         }
         $menu_item_vars = get_object_vars($menu_item);
         foreach ($menu_item_vars as $menu_item_var => $menu_item_value) {
             if (preg_match('/^' . self::PREFIX . '(\\w+)$/', $menu_item_var, $matches)) {
                 $node->addAttribute($matches[1], $menu_item_value);
             }
         }
         $node->addListItemClass("item" . $node->getId());
         $node->addSpanClass('menuitem');
         if ($node->getLink() == $this->current_url && $this->current_node == 0) {
             $this->current_node = $node->getId();
         }
         $outputNodes[$node->getId()] = $node;
     }
     $this->populateActiveBranch($outputNodes);
     return $outputNodes;
 }
Exemple #6
0
    protected function renderItem(RokMenuNode &$item, &$menu)
    {
        global $gantry;
        if ($item->getAttribute('subtext')) {
            $item->addLinkClass('subtext');
        }
        ?>
        <li <?php 
        if ($item->hasListItemClasses()) {
            ?>
class="<?php 
            echo $item->getListItemClasses();
            ?>
"<?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 
        echo $item->getTitle();
        ?>
             <?php 
        $subtext = $item->getAttribute('subtext');
        if (is_array($subtext)) {
            $subtext = implode("\n", $subtext);
        }
        ?>
             <?php 
        if (!empty($subtext)) {
            ?>
<em><?php 
            echo stripslashes($subtext);
            ?>
</em><?php 
        }
        ?>
            </span>
            </a>
	        <?php 
        if ($item->hasChildren()) {
            ?>
            <ul class="level<?php 
            echo intval($item->getLevel()) + 2;
            ?>
">
	            <?php 
            foreach ($item->getChildren() as $child) {
                ?>
		            <?php 
                echo $this->renderItem($child, $menu);
                ?>
	            <?php 
            }
            ?>
            </ul>
	        <?php 
        }
        ?>
        </li>
        <?php 
    }