'group', 'relationship' => 'member', 'inverse_relationship' => false, 'full_view' => false, )); break; case 'active': $content = elgg_list_entities(array( 'type' => 'object', 'subtype' => 'groupforumtopic', 'order_by' => 'e.last_action desc', 'limit' => 40, 'full_view' => false, )); break; case 'newest': default: $content = elgg_list_entities(array( 'type' => 'group', 'full_view' => false, )); break; } $filter = elgg_view('groups/group_sort_menu', array('selected' => $selected_tab)); $sidebar = elgg_view('groups/sidebar/find'); $sidebar .= elgg_view('groups/sidebar/featured'); $params = array( 'content' => $content, 'sidebar' => $sidebar, 'filter' => $filter, ); $body = elgg_view_layout('content', $params); echo elgg_view_page(elgg_echo('groups:all'), $body); } function groups_search_page() { elgg_push_breadcrumb(elgg_echo('search')); $tag = get_input("tag"); $title = elgg_echo('groups:search:title', array($tag)); // groups plugin saves tags as "interests" - see groups_fields_setup() in start.php $params = array( 'metadata_name' => 'interests', 'metadata_value' => $tag, 'types' => 'group', 'full_view' => FALSE, ); $content = elgg_list_entities_from_metadata($params); if (!$content) { $content = elgg_echo('groups:search:none'); } $sidebar = elgg_view('groups/sidebar/find'); $sidebar .= elgg_view('groups/sidebar/featured'); $params = array( 'content' => $content, 'sidebar' => $sidebar, 'filter' => false, 'buttons' => false, 'title' => $title, ); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); } /** * List owned groups */ function groups_handle_owned_page() { $page_owner = elgg_get_page_owner_entity(); $title = elgg_echo('groups:owned'); elgg_push_breadcrumb($title); $content = elgg_list_entities(array( 'type' => 'group', 'owner_guid' => elgg_get_page_owner_guid(), 'full_view' => false, )); $params = array( 'content' => $content, 'title' => $title, 'filter' => '', ); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); } /** * List groups the user is memober of */ function groups_handle_mine_page() { $page_owner = elgg_get_page_owner_entity(); $title = elgg_echo('groups:yours'); elgg_push_breadcrumb($title); $content = elgg_list_entities_from_relationship_count(array( 'type' => 'group', 'relationship' => 'member', 'relationship_guid' => elgg_get_page_owner_guid(), 'inverse_relationship' => false, 'full_view' => false, )); $params = array( 'content' => $content, 'title' => $title, 'filter' => '', ); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); } /** * Create or edit a group * * @param string $page * @param int $guid */ function groups_handle_edit_page($page, $guid = 0) { gatekeeper(); if ($page == 'add') { elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); $title = elgg_echo('groups:add'); elgg_push_breadcrumb($title); $content = elgg_view('groups/edit'); } else { $title = elgg_echo("groups:edit"); $group = get_entity($guid); if ($group && $group->canEdit()) { elgg_set_page_owner_guid($group->getGUID()); elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb($title); $content = elgg_view("groups/edit", array('entity' => $group)); } else { $content = elgg_echo('groups:noaccess'); } } $params = array( 'content' => $content, 'title' => $title, 'filter' => '', 'buttons' => '', ); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); } /** * Group invitations for a user */ function groups_handle_invitations_page() { gatekeeper(); $user = elgg_get_page_owner_entity(); $title = elgg_echo('groups:invitations'); elgg_push_breadcrumb($title); // @todo temporary workaround for exts #287. $invitations = groups_get_invited_groups($user->getGUID()); $content = elgg_view('groups/invitationrequests', array('invitations' => $invitations)); $params = array( 'content' => $content, 'title' => $title, 'filter' => '', 'buttons' => '', ); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); } /** * Group profile page * * @param int $guid Group entity GUID */ function groups_handle_profile_page($guid) { elgg_set_page_owner_guid($guid); // turn this into a core function global $autofeed; $autofeed = true; $group = get_entity($guid); if (!$group) { forward('groups/all'); } elgg_push_breadcrumb($group->name); $content = elgg_view('groups/profile/layout', array('entity' => $group)); if (group_gatekeeper(false)) { $sidebar = elgg_view('groups/sidebar/members', array('entity' => $group)); } else { $sidebar = ''; } $params = array( 'content' => $content, 'sidebar' => $sidebar, 'title' => $group->name, 'buttons' => elgg_view('groups/profile/buttons', array('entity' => $group)), 'filter' => '', ); $body = elgg_view_layout('content', $params); echo elgg_view_page($group->name, $body); } /** * Group activity page * * @param int $guid Group entity GUID */ function groups_handle_activity_page($guid) { elgg_set_page_owner_guid($guid); $group = get_entity($guid); if (!$group || !elgg_instanceof($group, 'group')) { forward(); } group_gatekeeper(); $title = elgg_echo('groups:activity'); elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb($title); $db_prefix = elgg_get_config('dbprefix'); $content = elgg_list_river(array( 'joins' => array("JOIN {$db_prefix}entities e ON e.guid = rv.object_guid"), 'wheres' => array("e.container_guid = $guid") )); if (!$content) { $content = '
' . elgg_echo('groups:activity:none') . '
'; } $params = array( 'content' => $content, 'title' => $title, 'buttons' => '', 'filter' => '', ); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); } /** * Group members page * * @param int $guid Group entity GUID */ function groups_handle_members_page($guid) { elgg_set_page_owner_guid($guid); $group = get_entity($guid); if (!$group || !elgg_instanceof($group, 'group')) { forward(); } group_gatekeeper(); $title = elgg_echo('groups:members:title', array($group->name)); elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb(elgg_echo('groups:members:')); $content = elgg_list_entities_from_relationship(array( 'relationship' => 'member', 'relationship_guid' => $group->guid, 'inverse_relationship' => true, 'types' => 'user', 'limit' => 20, )); $params = array( 'content' => $content, 'title' => $title, 'buttons' => '', 'filter' => '', ); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); } /** * Invite users to a group * * @param int $guid Group entity GUID */ function groups_handle_invite_page($guid) { gatekeeper(); elgg_set_page_owner_guid($guid); $group = get_entity($guid); $title = elgg_echo('groups:invite:title'); elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb(elgg_echo('groups:invite')); if ($group && $group->canEdit()) { $content = elgg_view_form('groups/invite', array( 'id' => 'invite_to_group', 'class' => 'mtm', ), array( 'entity' => $group, )); } else { $content .= elgg_echo('groups:noaccess'); } $params = array( 'content' => $content, 'title' => $title, 'buttons' => '', 'filter' => '', ); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); } /** * Manage requests to join a group * * @param int $guid Group entity GUID */ function groups_handle_requests_page($guid) { gatekeeper(); elgg_set_page_owner_guid($guid); $group = get_entity($guid); $title = elgg_echo('groups:membershiprequests'); if ($group && $group->canEdit()) { elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb($title); $requests = elgg_get_entities_from_relationship(array( 'relationship' => 'membership_request', 'relationship_guid' => $guid, 'inverse_relationship' => true, )); $content = elgg_view('groups/membershiprequests', array( 'requests' => $requests, 'entity' => $group, )); } else { $content = elgg_echo("groups:noaccess"); } $params = array( 'content' => $content, 'title' => $title, 'buttons' => '', 'filter' => '', ); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); }