コード例 #1
0
ファイル: layout.php プロジェクト: alpual/sweekswatercolors
    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 
    }
コード例 #2
0
ファイル: layout.php プロジェクト: rotoballer/emily
    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 
    }
コード例 #3
0
ファイル: layout.php プロジェクト: alpual/sweekswatercolors
    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 
    }
コード例 #4
0
ファイル: layout.php プロジェクト: rotoballer/emily
    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 
    }