Elgg  Version 2.3
default.php
Go to the documentation of this file.
1 <?php
19 $size = elgg_extract('size', $vars, 'medium');
20 
21 if (!($user instanceof ElggUser)) {
22  return;
23 }
24 
26 if (!array_key_exists($size, $icon_sizes)) {
27  $size = 'medium';
28 }
29 
30 $name = htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8', false);
31 $username = $user->username;
32 
33 $class = "elgg-avatar elgg-avatar-$size";
34 if (isset($vars['class'])) {
35  $class = "$class {$vars['class']}";
36 }
37 if ($user->isBanned()) {
38  $class .= ' elgg-state-banned';
39  $banned_text = elgg_echo('banned');
40  $name .= " ($banned_text)";
41 }
42 
43 $use_link = elgg_extract('use_link', $vars, true);
44 
45 $icontime = $user->icontime;
46 if (!$icontime) {
47  $icontime = "default";
48 }
49 
51 if (isset($vars['img_class'])) {
52  $img_class = $vars['img_class'];
53 }
54 
55 
56 $use_hover = elgg_extract('use_hover', $vars, true);
57 if (isset($vars['hover'])) {
58  // only 1.8.0 was released with 'hover' as the key
59  $use_hover = $vars['hover'];
60 }
61 
62 $icon = elgg_view('output/img', array(
63  'src' => $user->getIconURL($size),
64  'alt' => $name,
65  'title' => $name,
66  'class' => $img_class,
67 ));
68 
70 
71 ?>
72 <div class="<?php echo $class; ?>">
73 <?php
74 
75 if ($show_menu) {
76  $params = array(
77  'entity' => $user,
78  'username' => $username,
79  'name' => $name,
80  );
81  echo elgg_view_icon('hover-menu');
82  echo elgg_view('navigation/menu/user_hover/placeholder', array('entity' => $user));
83 }
84 
85 if ($use_link) {
86  $class = elgg_extract('link_class', $vars, '');
87  $url = elgg_extract('href', $vars, $user->getURL());
88  echo elgg_view('output/url', array(
89  'href' => $url,
90  'text' => $icon,
91  'is_trusted' => true,
92  'class' => $class,
93  ));
94 } else {
95  echo "<a>$icon</a>";
96 }
97 ?>
98 </div>
$icon_sizes
Definition: default.php:18
elgg_view_icon($name, $vars=array())
View one of the icons.
Definition: views.php:1582
elgg_is_admin_logged_in()
Returns whether or not the viewer is currently logged in and an admin user.
Definition: sessions.php:60
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_get_icon_sizes($entity_type=null, $entity_subtype=null, $type= 'icon')
Returns a configuration array of icon sizes.
if(isset($vars['img_class'])) $use_hover
Definition: default.php:56
$class
Definition: default.php:26
if(!$owner) $icon
Definition: default.php:16
$params
Definition: default.php:39
fieldset div
Definition: admin.css.php:485
elgg echo
Translates a string.
Definition: languages.js:48
$url
Definition: default.php:35
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:336
if(!array_key_exists($size, $icon_sizes)) $vars['size']
Definition: default.php:24
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1375
$icontime
Definition: default.php:45
$size
Definition: default.php:20
$show_menu
Definition: default.php:69
if(!$icontime) $img_class
Definition: default.php:50
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:31
if(!array_key_exists($size, $icon_sizes)) $name
Definition: default.php:30
$user
Elgg user icon.
Definition: default.php:18
if(isset($vars['class'])) if($user->isBanned()) $use_link
Definition: default.php:43