diff options
Diffstat (limited to 'mod/groups')
-rw-r--r-- | mod/groups/actions/edit.php | 5 | ||||
-rw-r--r-- | mod/groups/languages/en.php | 9 | ||||
-rw-r--r-- | mod/groups/start.php | 178 | ||||
-rw-r--r-- | mod/groups/views/default/forms/groups/edit.php | 47 | ||||
-rw-r--r-- | mod/groups/views/default/groups/forum_latest.php | 14 |
5 files changed, 164 insertions, 89 deletions
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 @@ <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $vars['entity']->access_id )); ?> </label> </p> + <p> + <label> + <?php echo elgg_echo('groups:enablepages'); ?><br /> + <?php + echo elgg_view("input/radio",array( + "internalname" => "pages_enable", + "value" => $vars['entity']->pages_enable, + 'options' => array( + elgg_echo('groups:yes') => 'yes', + elgg_echo('groups:no') => 'no', + ), + )); + ?> + </label> + </p> + <p> + <label> + <?php echo elgg_echo('groups:enableforum'); ?><br /> + <?php + + echo elgg_view("input/radio",array( + "internalname" => "forum_enable", + "value" => $vars['entity']->forum_enable, + 'options' => array( + elgg_echo('groups:yes') => 'yes', + elgg_echo('groups:no') => 'no', + ), + )); + ?> + </label> + </p> + <p> + <label> + <?php echo elgg_echo('groups:enablefiles'); ?><br /> + <?php + + echo elgg_view("input/radio",array( + "internalname" => "files_enable", + "value" => $vars['entity']->files_enable, + 'options' => array( + elgg_echo('groups:yes') => 'yes', + elgg_echo('groups:no') => 'no', + ), + )); + ?> + </label> + </p> <p> <?php if ($vars['entity']) diff --git a/mod/groups/views/default/groups/forum_latest.php b/mod/groups/views/default/groups/forum_latest.php index a903b7fd4..a6d80252a 100644 --- a/mod/groups/views/default/groups/forum_latest.php +++ b/mod/groups/views/default/groups/forum_latest.php @@ -1,3 +1,12 @@ +<?php
+
+ // Latest forum discussion for the group home page
+
+ //check to make sure this group forum has been activated
+ if($vars['entity']->forum_enable == 'yes'){
+
+?>
+
<div id="latest_discussion_widget">
<h2><?php echo elgg_echo('groups:latestdiscussion'); ?></h2>
<?php
@@ -22,4 +31,7 @@ }
?>
<br class="clearfloat" />
-</div>
\ No newline at end of file +</div>
+<?php
+ }//end of forum active check
+?>
\ No newline at end of file |