aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/views
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2012-12-27 15:36:18 -0500
committerBrett Profitt <brett.profitt@gmail.com>2012-12-27 15:36:18 -0500
commit757202e4cb2255f08040611189445aadfc8dbe42 (patch)
treeb6ea31fe3ae75a51e7c4ae86902d6f3b31087604 /mod/groups/views
parent2d8bef1f96c811dbed0f7636b5acc128d36ee53b (diff)
downloadelgg-757202e4cb2255f08040611189445aadfc8dbe42.tar.gz
elgg-757202e4cb2255f08040611189445aadfc8dbe42.tar.bz2
Fixes #1747. Added "My status" sidebar menu for groups.
Diffstat (limited to 'mod/groups/views')
-rw-r--r--mod/groups/views/default/groups/css.php21
-rw-r--r--mod/groups/views/default/groups/sidebar/my_status.php62
2 files changed, 83 insertions, 0 deletions
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);