aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/groups/start.php35
-rw-r--r--mod/groups/views/default/groups/side_menu.php13
2 files changed, 25 insertions, 23 deletions
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 4eaaa5a7b..b7047144b 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -85,7 +85,7 @@ function groups_init() {
elgg_register_event_handler('join', 'group', 'groups_user_join_event_listener');
elgg_register_event_handler('leave', 'group', 'groups_user_leave_event_listener');
- elgg_register_event_handler('pagesetup', 'system', 'groups_submenus');
+ elgg_register_event_handler('pagesetup', 'system', 'groups_setup_sidebar_menus');
elgg_register_event_handler('annotate', 'all', 'group_object_notifications');
elgg_register_plugin_hook_handler('access:collections:add_user', 'collection', 'groups_access_collection_override');
@@ -127,10 +127,10 @@ function groups_fields_setup() {
}
/**
- * Sets up submenus for the groups system. Triggered on pagesetup.
+ * Configure the groups sidebar menu. Triggered on page setup
*
*/
-function groups_submenus() {
+function groups_setup_sidebar_menus() {
// Get the page owner entity
$page_owner = elgg_get_page_owner_entity();
@@ -139,15 +139,30 @@ function groups_submenus() {
if ($page_owner instanceof ElggGroup) {
if (elgg_is_logged_in() && $page_owner->canEdit() && !$page_owner->isPublicMembership()) {
$url = elgg_get_site_url() . "groups/requests/{$page_owner->getGUID()}";
- add_submenu_item(elgg_echo('groups:membershiprequests'), $url, 'groupsactions1');
+ elgg_register_menu_item('page', array(
+ 'name' => 'membership_requests',
+ 'text' => elgg_echo('groups:membershiprequests'),
+ 'href' => $url,
+ ));
}
} else {
- add_submenu_item(elgg_echo('groups:all'), "groups/all", 'groupslinks1');
-
- if ($user = elgg_get_logged_in_user_entity()) {
- add_submenu_item(elgg_echo('groups:owned'), "groups/owner/$user->username", 'groupslinks1');
- add_submenu_item(elgg_echo('groups:yours'), "groups/member/$user->username", 'groupslinks1');
- add_submenu_item(elgg_echo('groups:invitations'), "groups/invitations/$user->username", 'groupslinks1');
+ elgg_register_menu_item('page', array(
+ 'name' => 'groups:all',
+ 'text' => elgg_echo('groups:all'),
+ 'href' => 'groups/all',
+ ));
+
+ $user = elgg_get_logged_in_user_entity();
+ if ($user) {
+ $url = "groups/owner/$user->username";
+ $item = new ElggMenuItem('groups:owned', elgg_echo('groups:owned'), $url);
+ elgg_register_menu_item('page', $item);
+ $url = "groups/member/$user->username";
+ $item = new ElggMenuItem('groups:member', elgg_echo('groups:yours'), $url);
+ elgg_register_menu_item('page', $item);
+ $url = "groups/invitations/$user->username";
+ $item = new ElggMenuItem('groups:user:invites', elgg_echo('groups:invitations'), $url);
+ elgg_register_menu_item('page', $item);
}
}
}
diff --git a/mod/groups/views/default/groups/side_menu.php b/mod/groups/views/default/groups/side_menu.php
deleted file mode 100644
index 88a56830b..000000000
--- a/mod/groups/views/default/groups/side_menu.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-/**
- * @todo move into start.php using register menu item function
- */
-?>
-<ul class="submenu page_navigation">
-<?php
- if(elgg_is_logged_in()){
- echo "<li><a href=\"".elgg_get_site_url()."groups/member/{elgg_get_logged_in_user_entity()->username}\">". elgg_echo('groups:yours') ."</a></li>";
- echo "<li><a href=\"".elgg_get_site_url()."groups/invitations/{elgg_get_logged_in_user_entity()->username}\">". elgg_echo('groups:invitations') ."</a></li>";
- }
-?>
-</ul> \ No newline at end of file