aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/entities.php14
-rw-r--r--mod/groups/graphics/defaultlarge.jpgbin10840 -> 0 bytes
-rw-r--r--mod/groups/graphics/defaultmedium.jpgbin2517 -> 0 bytes
-rw-r--r--mod/groups/graphics/defaultsmall.jpgbin1117 -> 0 bytes
-rw-r--r--mod/groups/graphics/defaulttiny.jpgbin965 -> 0 bytes
-rw-r--r--mod/groups/start.php66
-rw-r--r--mod/groups/views/default/groups/icon.php2
7 files changed, 71 insertions, 11 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 3a6e3c035..aca26ddd5 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -1869,8 +1869,6 @@
// Step one, see if anyone knows how to render this in the current view
$url = trigger_plugin_hook('entity:icon:url', $entity->getType(), array('entity' => $entity, 'viewtype' => $viewtype, 'size' => $size), $url);
- if(!@getimagesize($url))
- $url = false; // If not exist then don't use the url
// Fail, so use default
if (!$url)
@@ -1966,15 +1964,15 @@
$viewtype = $params['viewtype'];
$size = $params['size'];
- $url = $CONFIG->url . "views/$viewtype/graphics/icons/$type/$subtype/$size.png";
+ $url = "views/$viewtype/graphics/icons/$type/$subtype/$size.png";
- if(!@getimagesize($url))
- $url = $CONFIG->url . "views/$viewtype/graphics/icons/$type/default/$size.png";
+ if (!@getimagesize($CONFIG->path . $url))
+ $url = "views/$viewtype/graphics/icons/$type/default/$size.png";
- if(!@getimagesize($url))
- $url = $CONFIG->url . "views/$viewtype/graphics/icons/default/$size.png";
+ if(!@getimagesize($CONFIG->path . $url))
+ $url = "views/$viewtype/graphics/icons/default/$size.png";
- return $url;
+ return $CONFIG->url . $url;
}
}
diff --git a/mod/groups/graphics/defaultlarge.jpg b/mod/groups/graphics/defaultlarge.jpg
deleted file mode 100644
index 8b7576c47..000000000
--- a/mod/groups/graphics/defaultlarge.jpg
+++ /dev/null
Binary files differ
diff --git a/mod/groups/graphics/defaultmedium.jpg b/mod/groups/graphics/defaultmedium.jpg
deleted file mode 100644
index 996efac47..000000000
--- a/mod/groups/graphics/defaultmedium.jpg
+++ /dev/null
Binary files differ
diff --git a/mod/groups/graphics/defaultsmall.jpg b/mod/groups/graphics/defaultsmall.jpg
deleted file mode 100644
index 3bda4a3c7..000000000
--- a/mod/groups/graphics/defaultsmall.jpg
+++ /dev/null
Binary files differ
diff --git a/mod/groups/graphics/defaulttiny.jpg b/mod/groups/graphics/defaulttiny.jpg
deleted file mode 100644
index a83495ee6..000000000
--- a/mod/groups/graphics/defaulttiny.jpg
+++ /dev/null
Binary files differ
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
diff --git a/mod/groups/views/default/groups/icon.php b/mod/groups/views/default/groups/icon.php
index a7535b256..ebfa862a6 100644
--- a/mod/groups/views/default/groups/icon.php
+++ b/mod/groups/views/default/groups/icon.php
@@ -38,7 +38,7 @@
?>
<div class="groupicon">
-<a href="<?php echo $vars['entity']->getURL(); ?>" class="icon" ><img src="<?php echo $vars['url']; ?>mod/groups/graphics/icon.php?group_guid=<?php echo $group->getGUID(); ?>&size=<?php echo $vars['size']; ?>" border="0" <?php echo $align; ?> title="<?php echo $name; ?>" <?php echo $vars['js']; ?> /></a>
+<a href="<?php echo $vars['entity']->getURL(); ?>" class="icon" ><img src="<?php echo $vars['entity']->getIcon($vars['size']); ?>" border="0" <?php echo $align; ?> title="<?php echo $name; ?>" <?php echo $vars['js']; ?> /></a>
</div>
<?php