aboutsummaryrefslogtreecommitdiff
path: root/views/default/navigation/site_nav.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-20 20:21:44 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-20 20:21:44 +0000
commitad745e050da855d326d1b6bc3df8032c05574392 (patch)
treeb6387add3efde9340aac120ab16c727b5f30f278 /views/default/navigation/site_nav.php
parent6f8da12756183dc29227b3b4c07650ef293144d0 (diff)
downloadelgg-ad745e050da855d326d1b6bc3df8032c05574392.tar.gz
elgg-ad745e050da855d326d1b6bc3df8032c05574392.tar.bz2
Moved toolbar dropdown menu to main nav.
Added CSS for main nav dropdown. Emptied navigation/topbar_tools view. git-svn-id: http://code.elgg.org/elgg/trunk@5455 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/navigation/site_nav.php')
-rw-r--r--views/default/navigation/site_nav.php71
1 files changed, 62 insertions, 9 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;
+?>