aboutsummaryrefslogtreecommitdiff
path: root/mod/groups
diff options
context:
space:
mode:
Diffstat (limited to 'mod/groups')
-rw-r--r--mod/groups/edit.php3
-rw-r--r--mod/groups/index.php5
-rw-r--r--mod/groups/invite.php8
-rw-r--r--mod/groups/languages/en.php2
-rw-r--r--mod/groups/start.php37
-rw-r--r--mod/groups/views/default/groups/grouplinks.php29
-rw-r--r--mod/groups/views/default/groups/groupprofile.php3
-rw-r--r--mod/groups/views/default/groups/menu/actions.php35
-rw-r--r--mod/groups/views/default/groups/menu/adminlinks.php3
-rw-r--r--mod/groups/views/default/groups/menu/links.php3
-rw-r--r--mod/groups/views/default/groups/menu/ownerlinks.php20
11 files changed, 39 insertions, 109 deletions
diff --git a/mod/groups/edit.php b/mod/groups/edit.php
index 04cfdc35d..49ab302ab 100644
--- a/mod/groups/edit.php
+++ b/mod/groups/edit.php
@@ -14,7 +14,8 @@
$group_guid = get_input('group_guid');
$group = get_entity($group_guid);
-
+ set_page_owner($group_guid);
+
$title = elgg_echo("groups:new");
$body = elgg_view_title($title);
diff --git a/mod/groups/index.php b/mod/groups/index.php
index c0464dfdf..319de038a 100644
--- a/mod/groups/index.php
+++ b/mod/groups/index.php
@@ -17,13 +17,12 @@
$title = sprintf(elgg_echo("groups:yours"),page_owner_entity()->name);
// Get objects
- $context = get_context();
+ $area2 = elgg_view_title($title);
set_context('search');
$objects = list_entities("group", "", page_owner(), $limit, false);
- set_context($context);
+ set_context('groups');
- $area2 = elgg_view_title($title);
$area2 .= $objects;
$body = elgg_view_layout('two_column_left_sidebar',$area1, $area2);
diff --git a/mod/groups/invite.php b/mod/groups/invite.php
index ee6c028ad..adab0f408 100644
--- a/mod/groups/invite.php
+++ b/mod/groups/invite.php
@@ -10,10 +10,12 @@
*/
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- gatekeeper();
+ gatekeeper();
+
+ $group_guid = (int) get_input('group_guid');
+ $group = get_entity($group_guid);
+ set_page_owner($group_guid);
- $group_guid = get_input('group_guid');
- $group = get_entity($group_guid);
$title = elgg_echo("groups:invite");
$area2 = elgg_view_title($title);
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index 4337af5ae..de738573f 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -20,7 +20,7 @@
'groups:user' => "%s's groups",
'groups:all' => "All groups",
'groups:new' => "Create a new group",
- 'groups:edit' => "Edit a group",
+ 'groups:edit' => "Edit group",
'groups:icon' => 'Group icon (leave blank to leave unchanged)',
'groups:name' => 'Group name',
diff --git a/mod/groups/start.php b/mod/groups/start.php
index d5dfc76f8..57773378a 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -87,11 +87,34 @@
global $CONFIG;
+ // Get the page owner entity
+ $page_owner = page_owner_entity();
+
+ // Submenu items for all group pages
+ if ($page_owner instanceof ElggGroup) {
+ if ($page_owner->canEdit()) {
+ add_submenu_item(elgg_echo('groups:edit'),$CONFIG->wwwroot . "mod/groups/edit.php?group_guid=" . $page_owner->getGUID());
+ add_submenu_item(elgg_echo('groups:invite'),$CONFIG->wwwroot . "mod/groups/invite.php?group_guid={$page_owner->getGUID()}");
+ }
+ if ($page_owner->isMember($_SESSION['user'])) {
+ add_submenu_item(elgg_echo('groups:leave'), $CONFIG->wwwroot . "action/groups/leave?groups_guid=" . $page_owner->getGUID());
+ } else {
+ if ($vars['entity']->isPublicMembership())
+ {
+ add_submenu_item(elgg_echo('groups:join'),$CONFIG->wwwroot . "action/groups/join?group_guid={$page_owner->getGUID()}");
+ }
+ else
+ {
+ add_submenu_item(elgg_echo('groups:joinrequest'),$CONFIG->wwwroot . "action/groups/joinrequest?group_guid={$page_owner->getGUID()}");
+ }
+ }
+ }
+
// Add submenu options
if (get_context() == "groups") {
if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) {
- add_submenu_item(sprintf(elgg_echo('groups:new'), $CONFIG->wwwroot."pg/groups/new/"));
- add_submenu_item(sprintf(elgg_echo('groups:yours'), $CONFIG->wwwroot . "pg/groups/owned/" . $_SESSION['user']->username));
+ add_submenu_item(elgg_echo('groups:new'), $CONFIG->wwwroot."pg/groups/new/");
+ add_submenu_item(elgg_echo('groups:yours'), $CONFIG->wwwroot . "pg/groups/owned/" . $_SESSION['user']->username);
add_submenu_item(elgg_echo('groups:all'), $CONFIG->wwwroot . "pg/groups/world/");
} else if (page_owner()) {
$page_owner = page_owner_entity();
@@ -219,15 +242,13 @@
*/
function groups_write_acl_plugin_hook($hook, $entity_type, $returnvalue, $params)
{
- $group_guid = get_input('group_guid');
+ $page_owner = page_owner_entity();
- if ($group_guid)
+ if ($page_owner instanceof ElggGroup)
{
- $group = get_entity($group_guid);
-
- if (($group) && ($group->can_write_to_container($_SESSION['user']->guid)))
+ if (can_write_to_container())
{
- $returnvalue[$group->group_acl] = elgg_echo('groups:group') . ": " . $group->name;
+ $returnvalue[$page_owner->group_acl] = elgg_echo('groups:group') . ": " . $page_owner->name;
return $returnvalue;
}
diff --git a/mod/groups/views/default/groups/grouplinks.php b/mod/groups/views/default/groups/grouplinks.php
deleted file mode 100644
index f5f071eb0..000000000
--- a/mod/groups/views/default/groups/grouplinks.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
- /**
- * Group links
- *
- * @package ElggGroups
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- //check to see if the user is looking at their own profile
- if($_SESSION['user']->guid == $vars['entity']->owner_guid){
-
- echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div
- echo elgg_view("groups/menu/actions",$vars);
- echo elgg_view("groups/menu/links",$vars);
- echo "</div>"; //close wrapper div
-
- } else {
-
- echo "<div id=\"profile_menu_wrapper\">"; //start the wrapper div
- echo elgg_view("groups/menu/actions",$vars); //grab action links such as make friend
- echo elgg_view("groups/menu/links",$vars); //passive links to items such as user blog etc
- echo "</div>"; //close wrapper div
-
- }
-
-?> \ No newline at end of file
diff --git a/mod/groups/views/default/groups/groupprofile.php b/mod/groups/views/default/groups/groupprofile.php
index c8e48ebed..772f644a2 100644
--- a/mod/groups/views/default/groups/groupprofile.php
+++ b/mod/groups/views/default/groups/groupprofile.php
@@ -32,9 +32,6 @@
'size' => $iconsize,
)
);
-
- // display relevant links
- echo elgg_view("groups/grouplinks", array("entity" => $vars['entity']));
?>
</div>
diff --git a/mod/groups/views/default/groups/menu/actions.php b/mod/groups/views/default/groups/menu/actions.php
deleted file mode 100644
index 4c27fea9b..000000000
--- a/mod/groups/views/default/groups/menu/actions.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
- /**
- * Elgg group actions
- *
- * @package ElggGroups
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- if (isloggedin()) {
-
- if ($vars['entity']->isMember($_SESSION['user']))
- {
- ?><p><a href="<?php echo $vars['url']; ?>action/groups/leave?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("groups:leave"); ?></a></p><?php
- }
- else
- {
- if ($vars['entity']->isPublicMembership())
- {
- ?><p><a href="<?php echo $vars['url']; ?>action/groups/join?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("groups:join"); ?></a></p><?php
- }
- else
- {
- ?><p><a href="<?php echo $vars['url']; ?>action/groups/joinrequest?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("groups:joinrequest"); ?></a></p><?php
- }
- }
-
- if ($vars['entity']->canEdit())
- {
- ?><p><a href="<?php echo $vars['url']; ?>mod/groups/invite.php?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("groups:invite"); ?></a></p><?php
- }
- }
-?> \ No newline at end of file
diff --git a/mod/groups/views/default/groups/menu/adminlinks.php b/mod/groups/views/default/groups/menu/adminlinks.php
deleted file mode 100644
index 15c5adc7f..000000000
--- a/mod/groups/views/default/groups/menu/adminlinks.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-
-?> \ No newline at end of file
diff --git a/mod/groups/views/default/groups/menu/links.php b/mod/groups/views/default/groups/menu/links.php
deleted file mode 100644
index 15c5adc7f..000000000
--- a/mod/groups/views/default/groups/menu/links.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-
-?> \ No newline at end of file
diff --git a/mod/groups/views/default/groups/menu/ownerlinks.php b/mod/groups/views/default/groups/menu/ownerlinks.php
deleted file mode 100644
index aaa575bec..000000000
--- a/mod/groups/views/default/groups/menu/ownerlinks.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
- /**
- * Owner links
- *
- * @package ElggGroups
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
-
- // edit
- if (($_SESSION['user']->getGUID() == $vars['entity']->owner_guid) && ($vars['full']))
- {
- ?>
- <p><a href="<?php echo $vars['url']; ?>mod/groups/edit.php?group_guid=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("edit"); ?></a></p>
- <?php
- }
-?> \ No newline at end of file