aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/start.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-08 14:30:58 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-08 14:30:58 +0000
commitb6ccae4fcde10809993a08dfe1af96738b3b2aea (patch)
tree565b6c1b3ae030fcbedb1b099bceea249cb0dd14 /mod/groups/start.php
parent6a8eb8ba9317546b9e89b2c68fb6322b8c3bc00d (diff)
downloadelgg-b6ccae4fcde10809993a08dfe1af96738b3b2aea.tar.gz
elgg-b6ccae4fcde10809993a08dfe1af96738b3b2aea.tar.bz2
Closes #417 & #418
git-svn-id: https://code.elgg.org/elgg/trunk@2223 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups/start.php')
-rw-r--r--mod/groups/start.php66
1 files changed, 64 insertions, 2 deletions
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 51fcf9fda..780e06d6f 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -36,7 +36,7 @@
register_entity_url_handler('groups_url','group','all');
// Register an icon handler for groups
- register_page_handler('icon','groups_icon_handler');
+ register_page_handler('groupicon','groups_icon_handler');
// Register some actions
register_action("groups/edit",false, $CONFIG->pluginspath . "groups/actions/edit.php");
@@ -78,7 +78,10 @@
'interests' => 'tags',
'website' => 'url',
- );
+ );
+
+ // Now override icons
+ register_plugin_hook('entity:icon:url', 'group', 'groups_groupicon_hook');
}
/**
@@ -194,6 +197,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");
+
}
/**
@@ -310,6 +334,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;
+ }
+ }
}
// Register a handler for create groups