blob: bd7560bb8bce362766b579778e107d3dd7f1644f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<?php
/**
* Content header action buttons
*
* @uses $vars['entity']
*/
if (!elgg_is_logged_in()) {
return true;
}
$actions = array();
// group owners
if ($vars['entity']->canEdit()) {
// edit and invite
$url = elgg_get_site_url() . "pg/groups/edit/{$vars['entity']->getGUID()}";
$actions[$url] = elgg_echo('groups:edit');
$url = elgg_get_site_url() . "pg/groups/invite/{$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',
));
}
}
|