aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-06 19:35:28 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-06 19:35:28 +0000
commitf06582a79a42988934efb810ea26faee5b4c47f4 (patch)
treedc22fa52c1088a4b672d6c688c53ddc508daabb7
parentc2d82db47ccdbd388658433d1f703c560d7fb84b (diff)
downloadelgg-f06582a79a42988934efb810ea26faee5b4c47f4.tar.gz
elgg-f06582a79a42988934efb810ea26faee5b4c47f4.tar.bz2
forgot this file from a previous commit
git-svn-id: http://code.elgg.org/elgg/trunk@8045 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--views/default/icon/user/default.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/views/default/icon/user/default.php b/views/default/icon/user/default.php
new file mode 100644
index 000000000..c0bfc4676
--- /dev/null
+++ b/views/default/icon/user/default.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Elgg user icon
+ *
+ * Rounded avatar corners - CSS3 method
+ * uses avatar as background image so we can clip it with border-radius in supported browsers
+ *
+ * @uses $vars['entity'] The user entity. If none specified, the current user is assumed.
+ * @uses $vars['size'] The size - tiny, small, medium or large. (medium)
+ * @uses $vars['hover'] Display the hover menu? (true)
+ */
+
+$user = elgg_get_array_value('entity', $vars, get_loggedin_user());
+$size = elgg_get_array_value('size', $vars, 'medium');
+if (!in_array($size, array('topbar', 'tiny', 'small', 'medium', 'large', 'master'))) {
+ $size = 'medium';
+}
+
+if (!($user instanceof ElggUser)) {
+ return true;
+}
+
+$name = htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8');
+$username = $user->username;
+
+$icontime = $user->icontime;
+if (!$icontime) {
+ $icontime = "default";
+}
+
+$js = elgg_get_array_value('js', $vars, '');
+
+$hover = elgg_get_array_value('hover', $vars, true);
+
+$spacer_url = elgg_get_site_url() . '_graphics/spacer.gif';
+
+$icon_url = $user->getIconURL($size);
+$icon = "<img src=\"$spacer_url\" alt=\"$name\" title=\"$name\" $js style=\"background: url($icon_url) no-repeat;\" />";
+
+$show_menu = $hover && (isadminloggedin() || !$user->isBanned());
+
+?>
+<div class="elgg-avatar elgg-avatar-<?php echo $size; ?>">
+<?php
+
+if ($show_menu) {
+ $params = array(
+ 'entity' => $user,
+ 'username' => $username,
+ 'name' => $name,
+ );
+ echo "<span class=\"elgg-icon elgg-icon-hover-menu\"></span>";
+ echo elgg_view_menu('user_hover', $params);
+}
+
+echo elgg_view('output/url', array(
+ 'href' => $user->getURL(),
+ 'text' => $icon,
+));
+?>
+</div>