aboutsummaryrefslogtreecommitdiff
path: root/mod/groups
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-10 13:18:17 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-10 13:18:17 +0000
commit4378b158aa61d49ce0a7c38245b34bbff1100734 (patch)
tree25b928f4facbe846d7c2cdda68d838cb78cbe454 /mod/groups
parente378f5961943faf16995acda327b81a2d5a0bd05 (diff)
downloadelgg-4378b158aa61d49ce0a7c38245b34bbff1100734.tar.gz
elgg-4378b158aa61d49ce0a7c38245b34bbff1100734.tar.bz2
finished moving the group pages to library - forum pages next
git-svn-id: http://code.elgg.org/elgg/trunk@7868 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups')
-rw-r--r--mod/groups/invite.php30
-rw-r--r--mod/groups/lib/groups.php75
-rw-r--r--mod/groups/membershipreq.php32
-rw-r--r--mod/groups/start.php10
-rw-r--r--mod/groups/views/default/groups/profile/buttons.php2
5 files changed, 85 insertions, 64 deletions
diff --git a/mod/groups/invite.php b/mod/groups/invite.php
deleted file mode 100644
index acc54b15d..000000000
--- a/mod/groups/invite.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
- /**
- * Invite users to groups
- *
- * @package ElggGroups
- */
-
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- gatekeeper();
-
- $group_guid = (int) get_input('group_guid');
- $group = get_entity($group_guid);
- set_page_owner($group_guid);
-
- $title = elgg_echo("groups:invite");
-
- $area2 = elgg_view_title($title);
-
- if (($group) && ($group->canEdit()))
- {
- $area2 .= elgg_view("forms/groups/invite", array('entity' => $group));
-
- } else {
- $area2 .= elgg_echo("groups:noaccess");
- }
-
- $body = elgg_view_layout('one_column_with_sidebar', array('content' => $area1 . $area2));
-
- echo elgg_view_page($title, $body);
-?> \ No newline at end of file
diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php
index faedca18e..426d67c86 100644
--- a/mod/groups/lib/groups.php
+++ b/mod/groups/lib/groups.php
@@ -246,3 +246,78 @@ function groups_handle_activity_page($guid) {
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');
+
+ if ($group && $group->canEdit()) {
+ $content = elgg_view('forms/groups/invite', 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);
+}
diff --git a/mod/groups/membershipreq.php b/mod/groups/membershipreq.php
deleted file mode 100644
index 4ce2a6b7d..000000000
--- a/mod/groups/membershipreq.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
- /**
- * Manage group invite requests.
- *
- * @package ElggGroups
- */
-
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- gatekeeper();
-
- $group_guid = (int) get_input('group_guid');
- $group = get_entity($group_guid);
- set_page_owner($group_guid);
-
- $title = elgg_echo('groups:membershiprequests');
-
- $area2 = elgg_view_title($title);
-
- if (($group) && ($group->canEdit()))
- {
-
- $requests = elgg_get_entities_from_relationship(array('relationship' => 'membership_request', 'relationship_guid' => $group_guid, 'inverse_relationship' => TRUE, 'limit' => 9999));
- $area2 .= elgg_view('groups/membershiprequests',array('requests' => $requests, 'entity' => $group));
-
- } else {
- $area2 .= elgg_echo("groups:noaccess");
- }
-
- $body = elgg_view_layout('one_column_with_sidebar', array('content' => $area1 . $area2));
-
- echo elgg_view_page($title, $body);
-?> \ No newline at end of file
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 23936fed7..0b76cc43c 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -200,7 +200,7 @@ function groups_submenus() {
if (elgg_get_context() == 'groups') {
if ($page_owner instanceof ElggGroup) {
if (isloggedin() && $page_owner->canEdit() && !$page_owner->isPublicMembership()) {
- $url = elgg_get_site_url() . "mod/groups/membershipreq.php?group_guid={$page_owner->getGUID()}";
+ $url = elgg_get_site_url() . "pg/groups/requests/{$page_owner->getGUID()}";
add_submenu_item(elgg_echo('groups:membershiprequests'), $url, 'groupsactions1');
}
} else {
@@ -240,6 +240,8 @@ function groups_page_owner_handler() {
* New group: pg/groups/add/<guid>
* Edit group: pg/groups/edit/<guid>
* Group invitations: pg/groups/invitations/<username>
+ * Invite to group: pg/groups/invite/<guid>
+ * Membership requests: pg/groups/requests/<guid>
* Group activity: pg/groups/activity/<guid>
*
* @param array $page Array of url segments for routing
@@ -280,6 +282,12 @@ function groups_page_handler($page) {
case 'activity':
groups_handle_activity_page($page[1]);
break;
+ case 'invite':
+ groups_handle_invite_page($page[1]);
+ break;
+ case 'requests':
+ groups_handle_requests_page($page[1]);
+ break;
}
// old page handler
diff --git a/mod/groups/views/default/groups/profile/buttons.php b/mod/groups/views/default/groups/profile/buttons.php
index cd4ee49dd..b88c93ad1 100644
--- a/mod/groups/views/default/groups/profile/buttons.php
+++ b/mod/groups/views/default/groups/profile/buttons.php
@@ -17,7 +17,7 @@ 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() . "mod/groups/invite.php?group_guid={$vars['entity']->getGUID()}";
+ $url = elgg_get_site_url() . "pg/groups/invite/{$vars['entity']->getGUID()}";
$actions[$url] = elgg_echo('groups:invite');
}