aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/groups/views/default/groups/group_sort_menu.php44
1 files changed, 28 insertions, 16 deletions
diff --git a/mod/groups/views/default/groups/group_sort_menu.php b/mod/groups/views/default/groups/group_sort_menu.php
index 863515a85..c53b49c8e 100644
--- a/mod/groups/views/default/groups/group_sort_menu.php
+++ b/mod/groups/views/default/groups/group_sort_menu.php
@@ -2,23 +2,35 @@
/**
* All groups listing page navigation
*
- * @todo should use navigation tab view
*/
-$group_count = (int)elgg_get_entities(array('types' => 'group', 'count' => true));
+$tabs = array(
+ 'newest' => array(
+ 'text' => elgg_echo('groups:newest'),
+ 'href' => 'groups/all?filter=newest',
+ 'priority' => 200,
+ ),
+ 'popular' => array(
+ 'text' => elgg_echo('groups:popular'),
+ 'href' => 'groups/all?filter=popular',
+ 'priority' => 300,
+ ),
+ 'discussion' => array(
+ 'text' => elgg_echo('groups:latestdiscussion'),
+ 'href' => 'groups/all?filter=discussion',
+ 'priority' => 400,
+ ),
+);
-$selected = elgg_extract('selected', $vars);
-
-$url = elgg_get_site_url() . "groups/all";
+// sets default selected item
+if (strpos(full_url(), 'filter') === false) {
+ $tabs['newest']['selected'] = true;
+}
-?>
-<div class="elgg-tabs mtm">
- <div class="right">
- <?php echo $group_count . " " . elgg_echo("groups:count"); ?>
- </div>
-<ul>
- <li <?php if($selected == "newest") echo "class='selected'"; ?>><a href="<?php echo $url; ?>?filter=newest"><?php echo elgg_echo('groups:newest'); ?></a></li>
- <li <?php if($selected == "pop") echo "class='selected'"; ?>><a href="<?php echo $url; ?>?filter=pop"><?php echo elgg_echo('groups:popular'); ?></a></li>
- <li <?php if($selected == "active") echo "class='selected'"; ?>><a href="<?php echo $url; ?>?filter=active"><?php echo elgg_echo('groups:latestdiscussion'); ?></a></li>
-</ul>
-</div>
+foreach ($tabs as $name => $tab) {
+ $tab['name'] = $name;
+
+ elgg_register_menu_item('filter', $tab);
+}
+
+echo elgg_view_menu('filter', array('sort_by' => 'priority', 'class' => 'elgg-menu-hz'));