aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/groups/languages/en.php6
-rw-r--r--mod/groups/lib/groups.php27
-rw-r--r--mod/groups/views/default/groups/css.php21
-rw-r--r--mod/groups/views/default/groups/sidebar/my_status.php62
4 files changed, 112 insertions, 4 deletions
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index a817210c6..9e0799b3a 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -32,6 +32,12 @@ $english = array(
'groups:interests' => 'Tags',
'groups:website' => 'Website',
'groups:members' => 'Group members',
+ 'groups:my_status' => 'My status',
+ 'groups:my_status:group_owner' => 'You own this group',
+ 'groups:my_status:group_member' => 'You are in this group',
+ 'groups:subscribed' => 'Group notifications on',
+ 'groups:unsubscribed' => 'Group notifications off',
+
'groups:members:title' => 'Members of %s',
'groups:members:more' => "View all members",
'groups:membership' => "Group membership permissions",
diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php
index 505cacd01..ea7308d39 100644
--- a/mod/groups/lib/groups.php
+++ b/mod/groups/lib/groups.php
@@ -264,14 +264,33 @@ function groups_handle_profile_page($guid) {
groups_register_profile_buttons($group);
$content = elgg_view('groups/profile/layout', array('entity' => $group));
- if (group_gatekeeper(false)) {
- $sidebar = '';
+ $sidebar = '';
+
+ if (group_gatekeeper(false)) {
if (elgg_is_active_plugin('search')) {
$sidebar .= elgg_view('groups/sidebar/search', array('entity' => $group));
}
$sidebar .= elgg_view('groups/sidebar/members', array('entity' => $group));
- } else {
- $sidebar = '';
+
+ $subscribed = false;
+ if (elgg_is_active_plugin('notifications')) {
+ global $NOTIFICATION_HANDLERS;
+
+ foreach ($NOTIFICATION_HANDLERS as $method => $foo) {
+ $relationship = check_entity_relationship(elgg_get_logged_in_user_guid(),
+ 'notify' . $method, $guid);
+
+ if ($relationship) {
+ $subscribed = true;
+ break;
+ }
+ }
+ }
+
+ $sidebar .= elgg_view('groups/sidebar/my_status', array(
+ 'entity' => $group,
+ 'subscribed' => $subscribed
+ ));
}
$params = array(
diff --git a/mod/groups/views/default/groups/css.php b/mod/groups/views/default/groups/css.php
index 9c65d1602..20cd947f8 100644
--- a/mod/groups/views/default/groups/css.php
+++ b/mod/groups/views/default/groups/css.php
@@ -54,3 +54,24 @@
.groups-latest-reply {
float: right;
}
+
+.elgg-menu-groups-my-status li a {
+ display: block;
+
+ -webkit-border-radius: 8px;
+ -moz-border-radius: 8px;
+ border-radius: 8px;
+
+ background-color: white;
+ margin: 3px 0 5px 0;
+ padding: 2px 4px 2px 8px;
+}
+.elgg-menu-groups-my-status li a:hover {
+ background-color: #0054A7;
+ color: white;
+ text-decoration: none;
+}
+.elgg-menu-groups-my-status li.elgg-state-selected > a {
+ background-color: #4690D6;
+ color: white;
+} \ No newline at end of file
diff --git a/mod/groups/views/default/groups/sidebar/my_status.php b/mod/groups/views/default/groups/sidebar/my_status.php
new file mode 100644
index 000000000..4c36c0213
--- /dev/null
+++ b/mod/groups/views/default/groups/sidebar/my_status.php
@@ -0,0 +1,62 @@
+<?php
+/**
+ * Group status for logged in user
+ *
+ * @package ElggGroups
+ *
+ * @uses $vars['entity'] Group entity
+ */
+
+$group = elgg_extract('entity', $vars);
+$user = elgg_get_logged_in_user_entity();
+$subscribed = elgg_extract('subscribed', $vars);
+
+if (!elgg_is_logged_in()) {
+ return true;
+}
+$t = new ElggMenuItem();
+// membership status
+$is_member = $group->isMember($user);
+$is_owner = $group->getOwnerEntity() == $user;
+
+if ($is_owner) {
+ elgg_register_menu_item('groups:my_status', array(
+ 'name' => 'membership_status',
+ 'text' => '<a>' . elgg_echo('groups:my_status:group_owner') . '</a>',
+ 'href' => false
+ ));
+} elseif ($is_member) {
+ elgg_register_menu_item('groups:my_status', array(
+ 'name' => 'membership_status',
+ 'text' => '<a>' . elgg_echo('groups:my_status:group_member') . '</a>',
+ 'href' => false
+ ));
+} else {
+ elgg_register_menu_item('groups:my_status', array(
+ 'name' => 'membership_status',
+ 'text' => elgg_echo('groups:join'),
+ 'href' => "/action/groups/join?group_guid={$group->getGUID()}",
+ 'is_action' => true
+ ));
+}
+
+// notification info
+if (elgg_is_active_plugin('notifications')) {
+ if ($subscribed) {
+ elgg_register_menu_item('groups:my_status', array(
+ 'name' => 'subscription_status',
+ 'text' => elgg_echo('groups:subscribed'),
+ 'href' => "notifications/group/$user->username",
+ 'is_action' => true
+ ));
+ } else {
+ elgg_register_menu_item('groups:my_status', array(
+ 'name' => 'subscription_status',
+ 'text' => elgg_echo('groups:unsubscribed'),
+ 'href' => "notifications/group/$user->username"
+ ));
+ }
+}
+
+$body = elgg_view_menu('groups:my_status');
+echo elgg_view_module('aside', elgg_echo('groups:my_status'), $body);