Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(routing): Render groups pages with views
- Loading branch information
Showing
14 changed files
with
459 additions
and
519 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
$guid = get_input('guid'); | ||
elgg_entity_gatekeeper($guid, 'group'); | ||
|
||
elgg_set_page_owner_guid($guid); | ||
|
||
elgg_group_gatekeeper(); | ||
|
||
$group = get_entity($guid); | ||
|
||
$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 e1 ON e1.guid = rv.object_guid", | ||
"LEFT JOIN {$db_prefix}entities e2 ON e2.guid = rv.target_guid", | ||
), | ||
'wheres' => array( | ||
"(e1.container_guid = $group->guid OR e2.container_guid = $group->guid)", | ||
), | ||
'no_results' => elgg_echo('groups:activity:none'), | ||
)); | ||
|
||
$params = array( | ||
'content' => $content, | ||
'title' => $title, | ||
'filter' => '', | ||
); | ||
$body = elgg_view_layout('content', $params); | ||
|
||
echo elgg_view_page($title, $body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
elgg_gatekeeper(); | ||
|
||
elgg_require_js('elgg/groups/edit'); | ||
|
||
elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); | ||
$title = elgg_echo('groups:add'); | ||
elgg_push_breadcrumb($title); | ||
if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) { | ||
$content = elgg_view('groups/edit'); | ||
} else { | ||
$content = elgg_echo('groups:cantcreate'); | ||
} | ||
|
||
$params = array( | ||
'content' => $content, | ||
'title' => $title, | ||
'filter' => '', | ||
); | ||
$body = elgg_view_layout('content', $params); | ||
|
||
echo elgg_view_page($title, $body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
// all groups doesn't get link to self | ||
elgg_pop_breadcrumb(); | ||
elgg_push_breadcrumb(elgg_echo('groups')); | ||
|
||
if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) { | ||
elgg_register_title_button(); | ||
} | ||
|
||
$selected_tab = get_input('filter', 'newest'); | ||
|
||
switch ($selected_tab) { | ||
case 'popular': | ||
$content = elgg_list_entities_from_relationship_count(array( | ||
'type' => 'group', | ||
'relationship' => 'member', | ||
'inverse_relationship' => false, | ||
'full_view' => false, | ||
'no_results' => elgg_echo('groups:none'), | ||
)); | ||
break; | ||
case 'discussion': | ||
$content = elgg_list_entities(array( | ||
'type' => 'object', | ||
'subtype' => 'groupforumtopic', | ||
'order_by' => 'e.last_action desc', | ||
'limit' => 40, | ||
'full_view' => false, | ||
'no_results' => elgg_echo('discussion:none'), | ||
'distinct' => false, | ||
'preload_containers' => true, | ||
)); | ||
break; | ||
case 'featured': | ||
$content = elgg_list_entities_from_metadata(array( | ||
'type' => 'group', | ||
'metadata_name' => 'featured_group', | ||
'metadata_value' => 'yes', | ||
'full_view' => false, | ||
)); | ||
if (!$content) { | ||
$content = elgg_echo('groups:nofeatured'); | ||
} | ||
break; | ||
case 'newest': | ||
default: | ||
$content = elgg_list_entities(array( | ||
'type' => 'group', | ||
'full_view' => false, | ||
'no_results' => elgg_echo('groups:none'), | ||
'distinct' => 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
elgg_gatekeeper(); | ||
|
||
elgg_require_js('elgg/groups/edit'); | ||
|
||
$guid = get_input('guid'); | ||
$title = elgg_echo("groups:edit"); | ||
$group = get_entity($guid); | ||
|
||
if (elgg_instanceof($group, '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' => '', | ||
); | ||
$body = elgg_view_layout('content', $params); | ||
|
||
echo elgg_view_page($title, $body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
elgg_gatekeeper(); | ||
|
||
$username = get_input('username'); | ||
if ($username) { | ||
$user = get_user_by_username($username); | ||
elgg_set_page_owner_guid($user->guid); | ||
} else { | ||
$user = elgg_get_logged_in_user_entity(); | ||
elgg_set_page_owner_guid($user->guid); | ||
} | ||
|
||
if (!$user || !$user->canEdit()) { | ||
register_error(elgg_echo('noaccess')); | ||
forward(''); | ||
} | ||
|
||
$title = elgg_echo('groups:invitations'); | ||
elgg_push_breadcrumb($title); | ||
|
||
$content = elgg_view('groups/invitationrequests'); | ||
|
||
$params = array( | ||
'content' => $content, | ||
'title' => $title, | ||
'filter' => '', | ||
); | ||
$body = elgg_view_layout('content', $params); | ||
|
||
echo elgg_view_page($title, $body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
elgg_gatekeeper(); | ||
|
||
$guid = get_input('guid'); | ||
elgg_set_page_owner_guid($guid); | ||
|
||
$title = elgg_echo('groups:invite:title'); | ||
|
||
$group = get_entity($guid); | ||
if (!elgg_instanceof($group, 'group') || !$group->canEdit()) { | ||
register_error(elgg_echo('groups:noaccess')); | ||
forward(REFERER); | ||
} | ||
|
||
$content = elgg_view_form('groups/invite', array( | ||
'id' => 'invite_to_group', | ||
'class' => 'elgg-form-alt mtm', | ||
), array( | ||
'entity' => $group, | ||
)); | ||
|
||
elgg_push_breadcrumb($group->name, $group->getURL()); | ||
elgg_push_breadcrumb(elgg_echo('groups:invite')); | ||
|
||
$params = array( | ||
'content' => $content, | ||
'title' => $title, | ||
'filter' => '', | ||
); | ||
$body = elgg_view_layout('content', $params); | ||
|
||
echo elgg_view_page($title, $body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
$page_owner = elgg_get_page_owner_entity(); | ||
|
||
if ($page_owner->guid == elgg_get_logged_in_user_guid()) { | ||
$title = elgg_echo('groups:yours'); | ||
} else { | ||
$title = elgg_echo('groups:user', array($page_owner->name)); | ||
} | ||
elgg_push_breadcrumb($title); | ||
|
||
if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) { | ||
elgg_register_title_button(); | ||
} | ||
|
||
$dbprefix = elgg_get_config('dbprefix'); | ||
|
||
$content = elgg_list_entities_from_relationship(array( | ||
'type' => 'group', | ||
'relationship' => 'member', | ||
'relationship_guid' => elgg_get_page_owner_guid(), | ||
'inverse_relationship' => false, | ||
'full_view' => false, | ||
'joins' => array("JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"), | ||
'order_by' => 'ge.name ASC', | ||
'no_results' => elgg_echo('groups:none'), | ||
)); | ||
|
||
$params = array( | ||
'content' => $content, | ||
'title' => $title, | ||
'filter' => '', | ||
); | ||
$body = elgg_view_layout('content', $params); | ||
|
||
echo elgg_view_page($title, $body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
$guid = get_input('guid'); | ||
elgg_entity_gatekeeper($guid, 'group'); | ||
|
||
$group = get_entity($guid); | ||
|
||
elgg_set_page_owner_guid($guid); | ||
|
||
elgg_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')); | ||
|
||
$db_prefix = elgg_get_config('dbprefix'); | ||
$content = elgg_list_entities_from_relationship(array( | ||
'relationship' => 'member', | ||
'relationship_guid' => $group->guid, | ||
'inverse_relationship' => true, | ||
'type' => 'user', | ||
'limit' => (int)get_input('limit', max(20, elgg_get_config('default_limit')), false), | ||
'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"), | ||
'order_by' => 'u.name ASC', | ||
)); | ||
|
||
$params = array( | ||
'content' => $content, | ||
'title' => $title, | ||
'filter' => '', | ||
); | ||
$body = elgg_view_layout('content', $params); | ||
|
||
echo elgg_view_page($title, $body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
$page_owner = elgg_get_page_owner_entity(); | ||
|
||
if ($page_owner->guid == elgg_get_logged_in_user_guid()) { | ||
$title = elgg_echo('groups:owned'); | ||
} else { | ||
$title = elgg_echo('groups:owned:user', array($page_owner->name)); | ||
} | ||
elgg_push_breadcrumb($title); | ||
|
||
if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) { | ||
elgg_register_title_button(); | ||
} | ||
|
||
$dbprefix = elgg_get_config('dbprefix'); | ||
$content = elgg_list_entities(array( | ||
'type' => 'group', | ||
'owner_guid' => elgg_get_page_owner_guid(), | ||
'joins' => array("JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"), | ||
'order_by' => 'ge.name ASC', | ||
'full_view' => false, | ||
'no_results' => elgg_echo('groups:none'), | ||
'distinct' => false, | ||
)); | ||
|
||
$params = array( | ||
'content' => $content, | ||
'title' => $title, | ||
'filter' => '', | ||
); | ||
$body = elgg_view_layout('content', $params); | ||
|
||
echo elgg_view_page($title, $body); |
Oops, something went wrong.