aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/views/default/groups/profile/buttons.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-07 02:50:45 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-07 02:50:45 +0000
commit1d527097e116d130fdeb58871f040e6a30449ef2 (patch)
tree4a2430c1a225671972719e9ab0cea720b32e2385 /mod/groups/views/default/groups/profile/buttons.php
parent3a917aa158c1ef0945c8b4892eaa8f87e5fa1a1e (diff)
downloadelgg-1d527097e116d130fdeb58871f040e6a30449ef2.tar.gz
elgg-1d527097e116d130fdeb58871f040e6a30449ef2.tar.bz2
cleaned up the group profile
git-svn-id: http://code.elgg.org/elgg/trunk@7853 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups/views/default/groups/profile/buttons.php')
-rw-r--r--mod/groups/views/default/groups/profile/buttons.php53
1 files changed, 53 insertions, 0 deletions
diff --git a/mod/groups/views/default/groups/profile/buttons.php b/mod/groups/views/default/groups/profile/buttons.php
new file mode 100644
index 000000000..68cd2591a
--- /dev/null
+++ b/mod/groups/views/default/groups/profile/buttons.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Content header action buttons
+ *
+ * @uses $vars['entity']
+ */
+
+if (!isloggedin()) {
+ return true;
+}
+
+
+$actions = array();
+
+// group owners
+if ($vars['entity']->canEdit()) {
+ // edit and invite
+ $url = elgg_get_site_url() . "mod/groups/edit.php?group_guid={$vars['entity']->getGUID()}";
+ $actions[$url] = elgg_echo('groups:edit');
+ $url = elgg_get_site_url() . "mod/groups/invite.php?group_guid={$vars['entity']->getGUID()}";
+ $actions[$url] = elgg_echo('groups:invite');
+}
+
+// group members
+if ($vars['entity']->isMember($user)) {
+ // leave
+ $url = elgg_get_site_url() . "action/groups/leave?group_guid={$vars['entity']->getGUID()}";
+ $url = elgg_add_action_tokens_to_url($url);
+ $actions[$url] = elgg_echo('groups:leave');
+} else {
+ // join - admins can always join.
+ if ($vars['entity']->isPublicMembership() || $vars['entity']->canEdit()) {
+ $url = elgg_get_site_url() . "action/groups/join?group_guid={$vars['entity']->getGUID()}";
+ $url = elgg_add_action_tokens_to_url($url);
+ $actions[$url] = elgg_echo('groups:join');
+ } else {
+ // request membership
+ $url = elgg_get_site_url() . "action/groups/joinrequest?group_guid={$vars['entity']->getGUID()}";
+ $url = elgg_add_action_tokens_to_url($url);
+ $actions[$url] = elgg_echo('groups:joinrequest');
+ }
+}
+
+// display action buttons
+if ($actions) {
+ foreach ($actions as $url => $action) {
+ echo elgg_view('output/url', array(
+ 'text' => $action,
+ 'href' => $url,
+ 'class' => 'elgg-action-button',
+ ));
+ }
+}