aboutsummaryrefslogtreecommitdiff
path: root/mod/groups
diff options
context:
space:
mode:
Diffstat (limited to 'mod/groups')
-rw-r--r--mod/groups/icon.php2
-rw-r--r--mod/groups/start.php92
-rw-r--r--mod/groups/views/default/group/default.php7
-rw-r--r--mod/groups/views/default/groups/profile/profile_block.php7
4 files changed, 35 insertions, 73 deletions
diff --git a/mod/groups/icon.php b/mod/groups/icon.php
index c72b5f308..f4c0f8010 100644
--- a/mod/groups/icon.php
+++ b/mod/groups/icon.php
@@ -5,7 +5,7 @@
* @package ElggGroups
*/
-require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php");
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
$group_guid = get_input('group_guid');
$group = get_entity($group_guid);
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 58c47c305..5e318a5f1 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -27,8 +27,9 @@ function groups_init() {
// Register a page handler, so we can have nice URLs
register_page_handler('groups', 'groups_page_handler');
- // Register a URL handler for groups
+ // Register URL handlers for groups
register_entity_url_handler('groups_url', 'group', 'all');
+ elgg_register_plugin_hook_handler('entity:icon:url', 'group', 'groups_icon_url_override');
// Register an icon handler for groups
register_page_handler('groupicon', 'groups_icon_handler');
@@ -46,9 +47,6 @@ function groups_init() {
elgg_register_action("groups/invite", "$action_base/invite.php");
elgg_register_action("groups/featured", "$action_base/featured.php", 'admin');
- // Add a page owner handler
- //elgg_register_plugin_hook_handler('page_owner', 'system', 'groups_page_owner_handler');
-
// Add some widgets
elgg_register_widget_type('a_users_groups', elgg_echo('groups:widget:membership'), elgg_echo('groups:widgets:description'));
@@ -68,9 +66,6 @@ function groups_init() {
elgg_register_plugin_hook_handler('access:collections:write', 'all', 'groups_write_acl_plugin_hook');
//elgg_register_plugin_hook_handler('access:collections:read', 'all', 'groups_read_acl_plugin_hook');
- // Now override icons
- elgg_register_plugin_hook_handler('entity:icon:url', 'group', 'groups_groupicon_hook');
-
// Register profile menu hook
elgg_register_plugin_hook_handler('profile_menu', 'profile', 'forum_profile_menu');
elgg_register_plugin_hook_handler('profile_menu', 'profile', 'activity_profile_menu');
@@ -152,21 +147,6 @@ function groups_submenus() {
}
/**
- * Set a page owner handler.
- *
- */
-function groups_page_owner_handler() {
- $group_guid = get_input('group_guid');
- if ($group_guid) {
- $group = get_entity($group_guid);
- if ($group instanceof ElggGroup)
- return $group->owner_guid;
- }
-
- return false;
-}
-
-/**
* Groups page handler
*
* URLs take the form of
@@ -262,6 +242,24 @@ function groups_url($entity) {
}
/**
+ * Override the default entity icon for groups
+ *
+ * @return string Relative URL
+ */
+function groups_icon_url_override($hook, $type, $returnvalue, $params) {
+ $group = $params['entity'];
+ $size = $params['size'];
+
+ if (isset($group->icontime)) {
+ // return thumbnail
+ $icontime = $group->icontime;
+ return "pg/groupicon/$group->guid/$size/$icontime.jpg";
+ }
+
+ return "mod/groups/graphics/default{$size}.gif";
+}
+
+/**
* Add owner block link
*/
function groups_activity_owner_block_menu($hook, $type, $return, $params) {
@@ -392,41 +390,6 @@ function groups_user_leave_event_listener($event, $object_type, $object) {
}
/**
- * 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) {
-
- 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 = elgg_get_site_url() . "pg/groupicon/{$entity->guid}/$size/$icontime.jpg";
-
- return $url;
- }
- }
-}
-
-/**
* Grabs groups by invitations
* Have to override all access until there's a way override access to getter functions.
*
@@ -452,11 +415,18 @@ function groups_get_invited_groups($user_guid, $return_guids = FALSE) {
/**
* Function to use on groups for access. It will house private, loggedin, public,
- * and the group itself. This is when you don't want other groups or channels in the access options available
- * Returns an array
- * */
+ * and the group itself. This is when you don't want other groups or access lists
+ * in the access options available.
+ *
+ * @return array
+ */
function group_access_options($group) {
- $access_array = array(0 => 'private', 1 => 'logged in users', 2 => 'public', $group->group_acl => 'Group: ' . $group->name);
+ $access_array = array(
+ ACCESS_PRIVATE => 'private',
+ ACCESS_LOGGED_IN => 'logged in users',
+ ACCESS_PUBLIC => 'public',
+ $group->group_acl => 'Group: ' . $group->name,
+ );
return $access_array;
}
diff --git a/mod/groups/views/default/group/default.php b/mod/groups/views/default/group/default.php
index 568867da9..d025a894b 100644
--- a/mod/groups/views/default/group/default.php
+++ b/mod/groups/views/default/group/default.php
@@ -1,16 +1,13 @@
<?php
/**
- * Elgg groups profile display
+ * Group entity view
*
* @package ElggGroups
*/
$group = $vars['entity'];
-$icon = elgg_view("groups/icon", array(
- 'entity' => $group,
- 'size' => 'tiny',
-));
+$icon = elgg_view_entity_icon($group, 'tiny');
//get the membership type
$membership = $group->membership;
diff --git a/mod/groups/views/default/groups/profile/profile_block.php b/mod/groups/views/default/groups/profile/profile_block.php
index 98595ad07..a0d41ba14 100644
--- a/mod/groups/views/default/groups/profile/profile_block.php
+++ b/mod/groups/views/default/groups/profile/profile_block.php
@@ -21,12 +21,7 @@ $profile_fields = elgg_get_config('group');
<div class="group_profile clearfix">
<div class="group_profile_column icon">
<div class="group_profile_icon">
- <?php
- echo elgg_view('groups/icon', array(
- 'entity' => $group,
- 'size' => 'large',
- ));
- ?>
+ <?php echo elgg_view_entity_icon($group, 'large', array('href' => '')); ?>
</div>
<div class="group_stats">
<p>