From e2ef6b4a49fdf4a8696dc9b2c4c6bff76df59fef Mon Sep 17 00:00:00 2001
From: dave
Date: Thu, 1 Jan 2009 12:58:47 +0000
Subject: groups owners can choose if they want pages/files/forum enabled or
not. Still a little more to do, this is just the beginning code.
git-svn-id: https://code.elgg.org/elgg/trunk@2526 36083f99-b078-4883-b0ff-0f9b5a30f544
---
mod/groups/actions/edit.php | 5 +
mod/groups/languages/en.php | 9 ++
mod/groups/start.php | 178 ++++++++++++-----------
mod/groups/views/default/forms/groups/edit.php | 47 ++++++
mod/groups/views/default/groups/forum_latest.php | 14 +-
5 files changed, 164 insertions(+), 89 deletions(-)
(limited to 'mod')
diff --git a/mod/groups/actions/edit.php b/mod/groups/actions/edit.php
index 8a99e98e6..0973bc1ca 100644
--- a/mod/groups/actions/edit.php
+++ b/mod/groups/actions/edit.php
@@ -66,6 +66,11 @@
// Get access
$group->access_id = get_input('access_id', 0);
+ // Set group tool options
+ $group->files_enable = get_input('files_enable', 'yes');
+ $group->pages_enable = get_input('pages_enable', 'yes');
+ $group->forum_enable = get_input('forum_enable', 'yes');
+
$group->save();
if (!$group->isMember($user))
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php
index f072ed8c6..c9cbde959 100644
--- a/mod/groups/languages/en.php
+++ b/mod/groups/languages/en.php
@@ -51,6 +51,15 @@
'groups:group' => "Group",
'item:object:groupforumtopic' => "Forum topics",
+
+ /*
+ Group tools
+ */
+ 'groups:enablepages' => 'Enable group pages',
+ 'groups:enableforum' => 'Enable group forum',
+ 'groups:enablefiles' => 'Enable group files',
+ 'groups:yes' => 'yes',
+ 'groups:no' => 'no',
/*
Group forum strings
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 7bd6aca24..d8215ae2d 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -78,34 +78,34 @@
'interests' => 'tags',
'website' => 'url',
- );*/
-
- // Now override icons
+ );*/
+
+ // Now override icons
register_plugin_hook('entity:icon:url', 'group', 'groups_groupicon_hook');
- }
-
- /**
- * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit
- * add and delete fields.
- *
- * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all
- * other plugins have initialised.
- */
- function groups_fields_setup()
- {
- global $CONFIG;
-
- $profile_defaults = array(
-
- 'name' => 'text',
- 'description' => 'longtext',
- 'briefdescription' => 'text',
- 'interests' => 'tags',
- 'website' => 'url',
-
- );
-
- $CONFIG->group = trigger_plugin_hook('profile:fields', 'group', NULL, $profile_defaults);
+ }
+
+ /**
+ * This function loads a set of default fields into the profile, then triggers a hook letting other plugins to edit
+ * add and delete fields.
+ *
+ * Note: This is a secondary system:init call and is run at a super low priority to guarantee that it is called after all
+ * other plugins have initialised.
+ */
+ function groups_fields_setup()
+ {
+ global $CONFIG;
+
+ $profile_defaults = array(
+
+ 'name' => 'text',
+ 'description' => 'longtext',
+ 'briefdescription' => 'text',
+ 'interests' => 'tags',
+ 'website' => 'url',
+
+ );
+
+ $CONFIG->group = trigger_plugin_hook('profile:fields', 'group', NULL, $profile_defaults);
}
/**
@@ -141,7 +141,9 @@
}
}
- add_submenu_item(elgg_echo('groups:forum'),$CONFIG->wwwroot . "pg/groups/forum/{$page_owner->getGUID()}/", '1groupslinks');
+ if($page_owner->forum_enable == "yes"){
+ add_submenu_item(elgg_echo('groups:forum'),$CONFIG->wwwroot . "pg/groups/forum/{$page_owner->getGUID()}/", '1groupslinks');
+ }
}
@@ -222,27 +224,27 @@
}
}
- }
-
- /**
- * Handle group icons.
- *
- * @param unknown_type $page
- */
- function groups_icon_handler($page) {
-
- global $CONFIG;
-
- // The username should be the file we're getting
- if (isset($page[0])) {
- set_input('group_guid',$page[0]);
- }
- if (isset($page[1])) {
- set_input('size',$page[1]);
- }
- // Include the standard profile index
- include($CONFIG->pluginspath . "groups/graphics/icon.php");
-
+ }
+
+ /**
+ * Handle group icons.
+ *
+ * @param unknown_type $page
+ */
+ function groups_icon_handler($page) {
+
+ global $CONFIG;
+
+ // The username should be the file we're getting
+ if (isset($page[0])) {
+ set_input('group_guid',$page[0]);
+ }
+ if (isset($page[1])) {
+ set_input('size',$page[1]);
+ }
+ // Include the standard profile index
+ include($CONFIG->pluginspath . "groups/graphics/icon.php");
+
}
/**
@@ -359,44 +361,44 @@
return true;
- }
-
- /**
- * This hooks into the getIcon API and provides nice user icons for users where possible.
- *
- * @param unknown_type $hook
- * @param unknown_type $entity_type
- * @param unknown_type $returnvalue
- * @param unknown_type $params
- * @return unknown
- */
- function groups_groupicon_hook($hook, $entity_type, $returnvalue, $params)
- {
- global $CONFIG;
-
- if ((!$returnvalue) && ($hook == 'entity:icon:url') && ($params['entity'] instanceof ElggGroup))
- {
- $entity = $params['entity'];
- $type = $entity->type;
- $viewtype = $params['viewtype'];
- $size = $params['size'];
-
- if ($icontime = $entity->icontime) {
- $icontime = "{$icontime}";
- } else {
- $icontime = "default";
- }
-
- $filehandler = new ElggFile();
- $filehandler->owner_guid = $entity->owner_guid;
- $filehandler->setFilename("groups/" . $entity->guid . $size . ".jpg");
-
- if ($filehandler->exists()) {
- $url = $CONFIG->url . "pg/groupicon/{$entity->guid}/$size/$icontime.jpg";
-
- return $url;
- }
- }
+ }
+
+ /**
+ * This hooks into the getIcon API and provides nice user icons for users where possible.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ * @return unknown
+ */
+ function groups_groupicon_hook($hook, $entity_type, $returnvalue, $params)
+ {
+ global $CONFIG;
+
+ if ((!$returnvalue) && ($hook == 'entity:icon:url') && ($params['entity'] instanceof ElggGroup))
+ {
+ $entity = $params['entity'];
+ $type = $entity->type;
+ $viewtype = $params['viewtype'];
+ $size = $params['size'];
+
+ if ($icontime = $entity->icontime) {
+ $icontime = "{$icontime}";
+ } else {
+ $icontime = "default";
+ }
+
+ $filehandler = new ElggFile();
+ $filehandler->owner_guid = $entity->owner_guid;
+ $filehandler->setFilename("groups/" . $entity->guid . $size . ".jpg");
+
+ if ($filehandler->exists()) {
+ $url = $CONFIG->url . "pg/groupicon/{$entity->guid}/$size/$icontime.jpg";
+
+ return $url;
+ }
+ }
}
// Register a handler for create groups
@@ -406,7 +408,7 @@
register_elgg_event_handler('delete', 'group', 'groups_delete_event_listener');
// Make sure the groups initialisation function is called on initialisation
- register_elgg_event_handler('init','system','groups_init');
+ register_elgg_event_handler('init','system','groups_init');
register_elgg_event_handler('init','system','groups_fields_setup', 10000); // Ensure this runs after other plugins
register_elgg_event_handler('join','group','groups_user_join_event_listener');
register_elgg_event_handler('leave','group','groups_user_leave_event_listener');
diff --git a/mod/groups/views/default/forms/groups/edit.php b/mod/groups/views/default/forms/groups/edit.php
index 35eb065c6..267e9bb5b 100644
--- a/mod/groups/views/default/forms/groups/edit.php
+++ b/mod/groups/views/default/forms/groups/edit.php
@@ -57,7 +57,54 @@
'access_id','value' => $vars['entity']->access_id )); ?>
+
+
+
+
+
+
+
+
+
forum_enable == 'yes'){
+
+?>
+
-
\ No newline at end of file
+
+
\ No newline at end of file
--
cgit v1.2.3