Elgg  Version 1.11
default.php
Go to the documentation of this file.
1 <?php
19 $size = elgg_extract('size', $vars, 'medium');
20 $icon_sizes = elgg_get_config('icon_sizes');
21 if (!array_key_exists($size, $icon_sizes)) {
22  $size = 'medium';
23 }
24 
25 if (!($user instanceof ElggUser)) {
26  return;
27 }
28 
29 $name = htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8', false);
30 $username = $user->username;
31 
32 $class = "elgg-avatar elgg-avatar-$size";
33 if (isset($vars['class'])) {
34  $class = "$class {$vars['class']}";
35 }
36 if ($user->isBanned()) {
37  $class .= ' elgg-state-banned';
38  $banned_text = elgg_echo('banned');
39  $name .= " ($banned_text)";
40 }
41 
42 $use_link = elgg_extract('use_link', $vars, true);
43 
44 $icontime = $user->icontime;
45 if (!$icontime) {
46  $icontime = "default";
47 }
48 
49 $js = elgg_extract('js', $vars, '');
50 if ($js) {
51  elgg_deprecated_notice("Passing 'js' to icon views is deprecated.", 1.8, 5);
52 }
53 
55 if (isset($vars['img_class'])) {
56  $img_class = $vars['img_class'];
57 }
58 
59 
60 $use_hover = elgg_extract('use_hover', $vars, true);
61 if (isset($vars['override'])) {
62  elgg_deprecated_notice("Use 'use_hover' rather than 'override' with user avatars", 1.8, 5);
63  $use_hover = false;
64 }
65 if (isset($vars['hover'])) {
66  // only 1.8.0 was released with 'hover' as the key
67  $use_hover = $vars['hover'];
68 }
69 
70 $icon = elgg_view('output/img', array(
71  'src' => $user->getIconURL($size),
72  'alt' => $name,
73  'title' => $name,
74  'class' => $img_class,
75 ));
76 
78 
79 ?>
80 <div class="<?php echo $class; ?>">
81 <?php
82 
83 if ($show_menu) {
84  $params = array(
85  'entity' => $user,
86  'username' => $username,
87  'name' => $name,
88  );
89  echo elgg_view_icon('hover-menu');
90  echo elgg_view('navigation/menu/user_hover/placeholder', array('entity' => $user));
91 }
92 
93 if ($use_link) {
94  $class = elgg_extract('link_class', $vars, '');
95  $url = elgg_extract('href', $vars, $user->getURL());
96  echo elgg_view('output/url', array(
97  'href' => $url,
98  'text' => $icon,
99  'is_trusted' => true,
100  'class' => $class,
101  ));
102 } else {
103  echo "<a>$icon</a>";
104 }
105 ?>
106 </div>
$icon_sizes
Definition: default.php:17
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
elgg_is_admin_logged_in()
Returns whether or not the viewer is currently logged in and an admin user.
Definition: sessions.php:60
elgg_view_icon($name, $vars=array())
View one of the elgg sprite icons.
Definition: views.php:1403
if(isset($vars['img_class'])) $use_hover
Definition: default.php:60
if($js) $img_class
Definition: default.php:54
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1246
fieldset div
Definition: admin.php:470
if(!$icontime) $js
Definition: default.php:49
$class
Definition: default.php:25
if(!$owner) $icon
Definition: default.php:16
if(!array_key_exists($size, $icon_sizes)) if(!($user instanceof ElggUser)) $name
Definition: default.php:29
$params
Definition: default.php:39
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg echo
Translates a string.
Definition: languages.js:43
$url
Definition: default.php:34
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
Definition: elgglib.php:1006
if(!array_key_exists($size, $icon_sizes)) $vars['size']
Definition: default.php:23
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
$icontime
Definition: default.php:44
$size
Definition: default.php:19
$show_menu
Definition: default.php:77
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:32
$username
Definition: default.php:30
$user
Elgg user icon.
Definition: default.php:18
if(isset($vars['class'])) if($user->isBanned()) $use_link
Definition: default.php:42