aboutsummaryrefslogtreecommitdiff
path: root/views/default/navigation
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/navigation')
-rw-r--r--views/default/navigation/menu/elements/item.php10
-rw-r--r--views/default/navigation/menu/site.php25
-rw-r--r--views/default/navigation/site_nav.php83
3 files changed, 35 insertions, 83 deletions
diff --git a/views/default/navigation/menu/elements/item.php b/views/default/navigation/menu/elements/item.php
new file mode 100644
index 000000000..f6959b2f4
--- /dev/null
+++ b/views/default/navigation/menu/elements/item.php
@@ -0,0 +1,10 @@
+<?php
+
+$item = $vars['item'];
+
+$class = '';
+if ($item->getSelected()) {
+ $class = 'class="selected"';
+}
+
+echo "<li $class>{$item->getLink()}</li>";
diff --git a/views/default/navigation/menu/site.php b/views/default/navigation/menu/site.php
new file mode 100644
index 000000000..c2b00fd72
--- /dev/null
+++ b/views/default/navigation/menu/site.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Site navigation menu
+ *
+ * @uses $vars['menu']['default']
+ * @uses $vars['menu']['more']
+ */
+
+echo '<ul class="elgg-site-menu">';
+foreach ($vars['menu']['default'] as $menu_item) {
+ echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item));
+}
+
+if (isset($vars['menu']['more'])) {
+ $more = elgg_echo('more');
+ echo '<li class="elgg-more">';
+ echo "<a class='subnav' title=\"$more\"><span class=\"elgg-icon elgg-icon-arrow-s\"></span>$more</a>";
+ echo '<ul>';
+ foreach ($vars['menu']['more'] as $menu_item) {
+ echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item));
+ }
+ echo '</ul>';
+ echo '</li>';
+}
+echo '</ul>';
diff --git a/views/default/navigation/site_nav.php b/views/default/navigation/site_nav.php
deleted file mode 100644
index aaf596b93..000000000
--- a/views/default/navigation/site_nav.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-/**
- * Site-wide navigation
- *
- */
-
-$nav_items = elgg_get_nav_items();
-$featured = $nav_items['featured'];
-$more = $nav_items['more'];
-
-$nav_html = '';
-$more_nav_html = '';
-$context = elgg_get_context();
-
-// 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) {
- $selected = ($info->value->context == $context) ? 'class="selected"' : '';
- $title = htmlentities($info->name, ENT_QUOTES, 'UTF-8');
- $url = htmlentities($info->value->url, ENT_QUOTES, 'UTF-8');
-
- $nav_html .= "<li $selected><a href=\"$url\" title=\"$title\"><span>$title</span></a></li>";
- }
-} elseif ($more) {
- for ($i=0; $i<5; $i++) {
- if (!array_key_exists($i, $more)) {
- break;
- }
- $info = $more[$i];
-
- $selected = ($info->value->context == $context) ? 'class="selected"' : '';
- $title = htmlentities($info->name, ENT_QUOTES, 'UTF-8');
- $url = htmlentities($info->value->url, ENT_QUOTES, 'UTF-8');
-
- $nav_html .= "<li $selected><a href=\"$url\" title=\"$title\">$title</a></li>";
- $more[$i]->used = TRUE;
- $item_count++;
- }
-}
-
-// display the rest.
-foreach ($more as $info) {
- if ($info->used) {
- continue;
- }
- $selected = ($info->value->context == $context) ? 'class="selected"' : '';
- $title = htmlentities($info->name, ENT_QUOTES, 'UTF-8');
- $url = htmlentities($info->value->url, ENT_QUOTES, 'UTF-8');
-
- $more_nav_html .= "<li $selected><a href=\"$url\" title=\"$title\">$title</a></li>\n";
- $item_count++;
-}
-
-if ($more_nav_html) {
- $more = elgg_echo('more');
- $nav_html .= "<li class='elgg-more'><a class='subnav' title=\"$more\"><span class=\"elgg-icon elgg-icon-arrow-s\"></span>$more</a>
- <ul>
- $more_nav_html
- </ul>
- </li>";
-}
-
-// only display, if there are nav items to display
-if ($nav_html) {
- echo <<<___END
- <ul class="elgg-site-menu">
- $nav_html
- </ul>
-___END;
-}
-