diff options
Diffstat (limited to 'views/default/navigation')
-rw-r--r-- | views/default/navigation/site_nav.php | 71 | ||||
-rw-r--r-- | views/default/navigation/topbar_tools.php | 34 |
2 files changed, 63 insertions, 42 deletions
diff --git a/views/default/navigation/site_nav.php b/views/default/navigation/site_nav.php index 965eb7e63..15b35a118 100644 --- a/views/default/navigation/site_nav.php +++ b/views/default/navigation/site_nav.php @@ -1,22 +1,75 @@ <?php /** * Main site-wide navigation + * **/ -$featured = $vars['config']->menu_items['featured_urls']; -$current_context = get_context(); +$nav_items = elgg_get_nav_items(); +$featured = $nav_items['featured']; +$more = $nav_items['more']; -echo '<div id="elgg_main_nav" class="clearfloat"> - <ul class="navigation">'; +$nav_html = ''; +$more_nav_html = ''; -foreach ($featured as $info) { - $selected = ($info->value->context == $current_context) ? 'class="selected"' : ''; +// sort more links alphabetically +$more_sorted = array(); +foreach ($more as $info) { + $more_sorted[] = $info->name; +} + +// required because array multisort is case sensitive +$more_sorted_lower = array_map('elgg_strtolower', $more_sorted); +array_multisort($more_sorted_lower, $more); + +$item_count = 0; + +// if there are no featured items, display the standard tools in alphabetical order +if ($featured) { + foreach ($featured as $info) { + $title = htmlentities($info->name, ENT_QUOTES, 'UTF-8'); + $url = htmlentities($info->value->url, ENT_QUOTES, 'UTF-8'); + + $nav_html .= "<li><a href=\"$url\" title=\"$title\"><span>$title</span></a></li>"; + } +} elseif ($more) { + for ($i=0; $i<6; $i++) { + $info = $more[$i]; + + $title = htmlentities($info->name, ENT_QUOTES, 'UTF-8'); + $url = htmlentities($info->value->url, ENT_QUOTES, 'UTF-8'); + + $nav_html .= "<li><a href=\"$url\" title=\"$title\"><span>$title</span></a></li>"; + $more[$i]->used = TRUE; + $item_count++; + } +} + +// display the rest. +foreach ($more as $info) { + if ($info->used) { + continue; + } $title = htmlentities($info->name, ENT_QUOTES, 'UTF-8'); $url = htmlentities($info->value->url, ENT_QUOTES, 'UTF-8'); - echo "<li $selected><a href=\"$url\" title=\"$title\"><span>$title</span></a></li>"; + $more_nav_html .= "<li><a href=\"$url\" title=\"$title\"><span>$title</span></a></li>\n"; + $item_count++; +} + +if ($more_nav_html) { + $more = elgg_echo('more'); + $nav_html .= "<li class=\"navigation_more\"><a title=\"$more\"><span>$more</span></a> + <ul> + $more_nav_html + </ul> + </li>"; } -echo ' +echo <<<___END +<div id="elgg_main_nav" class="clearfloat"> + <ul class="navigation"> + $nav_html </ul> -</div>';
\ No newline at end of file +</div> +___END; +?> diff --git a/views/default/navigation/topbar_tools.php b/views/default/navigation/topbar_tools.php index 2e48a4a85..044dc6608 100644 --- a/views/default/navigation/topbar_tools.php +++ b/views/default/navigation/topbar_tools.php @@ -1,7 +1,6 @@ <?php /** - * Elgg standard tools drop down - * This will be populated depending on the plugins active - only plugin navigation will appear here + * Empty view for backward compatibility. * * @package Elgg * @subpackage Core @@ -9,34 +8,3 @@ * @link http://elgg.org/ * */ -$menu = $vars['config']->menu_items['toolbar']; - -if (is_array($menu) && sizeof($menu) > 0) { - $alphamenu = array(); - foreach($menu as $item) { - $alphamenu[$item->name] = $item; - } - ksort($alphamenu); - -?> - -<ul class="tools_menu"> - <li class="menu"><a href="#" class="tools"><?php echo(elgg_echo('tools')); ?></a> - <ul> - <?php - foreach($alphamenu as $item) { - echo "<li><a href=\"{$item->value->url}\">" . $item->name . "</a></li>"; - } - ?> - </ul> - </li> -</ul> - -<script type="text/javascript"> -$(function() { - $('ul.tools_menu').elgg_dropdownmenu(); -}); -</script> - -<?php -}
\ No newline at end of file |