diff options
Diffstat (limited to 'mod/groups')
-rw-r--r-- | mod/groups/languages/en.php | 2 | ||||
-rw-r--r-- | mod/groups/start.php | 51 | ||||
-rw-r--r-- | mod/groups/views/default/groups/groupprofile.php | 64 |
3 files changed, 66 insertions, 51 deletions
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index d0f8f3239..f802cacea 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -83,7 +83,7 @@ */ 'groups:access:private' => 'Closed - Users must be invited', 'groups:access:public' => 'Open - Any user may join', - 'groups:closedgroup' => 'This group has a closed membership. To ask to be added, click the "request membership" menu link.', + 'groups:closedgroup' => 'This group has a closed membership. To ask to be added, click the "request membership" link.', 'groups:visibility' => 'Who can see this group?', /* diff --git a/mod/groups/start.php b/mod/groups/start.php index fdf3b9e45..7c6d39b9d 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -195,50 +195,27 @@ * */ function groups_submenus() { - global $CONFIG; // Get the page owner entity - $page_owner = page_owner_entity(); - - // Submenu items for all group pages - if ($page_owner instanceof ElggGroup && get_context() == 'groups') { - if (isloggedin()) { - if ($page_owner->canEdit()) { - add_submenu_item(elgg_echo('groups:invite'),$CONFIG->wwwroot . "mod/groups/invite.php?group_guid={$page_owner->getGUID()}", '1groupsactions'); - if (!$page_owner->isPublicMembership()) - add_submenu_item(elgg_echo('groups:membershiprequests'),$CONFIG->wwwroot . "mod/groups/membershipreq.php?group_guid={$page_owner->getGUID()}", '1groupsactions'); - } - if ($page_owner->isMember($_SESSION['user'])) { - if ($page_owner->getOwner() != $_SESSION['guid']) { - $url = elgg_add_action_tokens_to_url($CONFIG->wwwroot . "action/groups/leave?group_guid=" . $page_owner->getGUID()); - add_submenu_item(elgg_echo('groups:leave'), $url, '1groupsactions'); - } - } else { - if ($page_owner->isPublicMembership()) { - $url = elgg_add_action_tokens_to_url($CONFIG->wwwroot . "action/groups/join?group_guid={$page_owner->getGUID()}"); - add_submenu_item(elgg_echo('groups:join'), $url, '1groupsactions'); - } else { - $url = elgg_add_action_tokens_to_url($CONFIG->wwwroot . "action/groups/joinrequest?group_guid={$page_owner->getGUID()}"); - add_submenu_item(elgg_echo('groups:joinrequest'), $url, '1groupsactions'); - } - } - } - } + $page_owner = page_owner_entity(); - // Add submenu options - if (get_context() == 'groups' && !($page_owner instanceof ElggGroup)) { - if (isloggedin()) { - add_submenu_item(elgg_echo('groups:owned'), $CONFIG->wwwroot . "pg/groups/owned/" . $_SESSION['user']->username, '1groupslinks'); - add_submenu_item(elgg_echo('groups:yours'), $CONFIG->wwwroot . "pg/groups/member/" . $_SESSION['user']->username, '1groupslinks'); + if (get_context() == 'groups') { + if ($page_owner instanceof ElggGroup) { + if (isloggedin() && $page_owner->canEdit() && !$page_owner->isPublicMembership()) { + $url = "{$CONFIG->wwwroot}mod/groups/membershipreq.php?group_guid={$page_owner->getGUID()}"; + add_submenu_item(elgg_echo('groups:membershiprequests'), $url, '1groupsactions'); } - add_submenu_item(elgg_echo('groups:all'), $CONFIG->wwwroot . "pg/groups/world/", '1groupslinks'); - - if (isloggedin()) { - add_submenu_item(elgg_echo('groups:invitations'), $CONFIG->wwwroot . "pg/groups/invitations/" . $_SESSION['user']->username, '1groupslinks'); + } else { + add_submenu_item(elgg_echo('groups:all'), "{$CONFIG->wwwroot}pg/groups/world/", '1groupslinks'); + + if ($user = get_loggedin_user()) { + add_submenu_item(elgg_echo('groups:owned'), "{$CONFIG->wwwroot}pg/groups/owned/$user->username", '1groupslinks'); + add_submenu_item(elgg_echo('groups:yours'), "{$CONFIG->wwwroot}pg/groups/member/$user->username", '1groupslinks'); + add_submenu_item(elgg_echo('groups:invitations'), "{$CONFIG->wwwroot}pg/groups/invitations/$user->username", '1groupslinks'); } } - + } } /** diff --git a/mod/groups/views/default/groups/groupprofile.php b/mod/groups/views/default/groups/groupprofile.php index f1ca92e4e..ab1990370 100644 --- a/mod/groups/views/default/groups/groupprofile.php +++ b/mod/groups/views/default/groups/groupprofile.php @@ -8,22 +8,62 @@ * @copyright Curverider Ltd 2008-2010 * @link http://elgg.com/ */ -?> + + +$user = get_loggedin_user(); +elgg_push_breadcrumb(elgg_echo('groups:all'), "{$vars['url']}pg/groups/world"); + +// create user actions +$actions = array(); +if ($vars['entity']->canEdit()) { + // breadcrumb trail + elgg_push_breadcrumb(elgg_echo('groups:yours'), "{$vars['url']}pg/groups/member/{$user->username}"); + + // edit and invite + $actions["mod/groups/edit.php?group_guid={$vars['entity']->getGUID()}"] = elgg_echo('groups:edit'); + $actions["mod/groups/invite.php?group_guid={$vars['entity']->getGUID()}"] = elgg_echo('groups:invite'); +} elseif ($vars['entity']->isMember($user)) { + // breadcrumb trail + elgg_push_breadcrumb(elgg_echo('groups:yours'), "{$vars['url']}pg/groups/member/{$user->username}"); + + // leave + $url = elgg_add_action_tokens_to_url("action/groups/leave?group_guid={$vars['entity']->getGUID()}"); + $actions[$url] = elgg_echo('groups:leave'); +} elseif ($vars['entity']->isPublicMembership()) { + // join + $url = elgg_add_action_tokens_to_url("action/groups/join?group_guid={$vars['entity']->getGUID()}"); + $actions[$url] = elgg_echo('groups:join'); +} else { + // request membership + $url = elgg_add_action_tokens_to_url("action/groups/joinrequest?group_guid={$vars['entity']->getGUID()}"); + $actions[$url] = elgg_echo('groups:joinrequest'); +} + +// build aciton buttons +$action_buttons = ''; +if (!empty($actions)) { + $action_buttons = '<div class="content_header_options">'; + foreach ($actions as $url => $action) { + $action_buttons .= "<a class=\"action_button\" href=\"{$vars['url']}$url\">$action</a>"; + } + $action_buttons .= '</div>'; +} + +// display breadcrumb +elgg_push_breadcrumb($vars['entity']->name); +echo elgg_view('navigation/breadcrumbs'); + +// build and display header +echo <<<__HTML <div id="content_header" class="clearfloat"> <div class="content_header_title"> - <h2><?php echo $vars['entity']->name; ?></h2> + <h2>{$vars['entity']->name}</h2> </div> - <?php - if ($vars['entity']->canEdit()) { - ?> - <div class="content_header_options"> - <a class="action_button" href="<?php echo $vars['url']; ?>mod/groups/edit.php?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("groups:edit"); ?></a> - </div> - <?php - } - ?> + $action_buttons </div> +__HTML; +?> <div class="group_profile clearfloat"> <div class="group_profile_column icon"> <div class="group_profile_icon"> @@ -94,5 +134,3 @@ ?> </div> </div> - - |