Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
user_hover.php
Go to the documentation of this file.
1 <?php
11 $user = $vars['entity'];
12 $actions = elgg_extract('action', $vars['menu'], null);
13 $main = elgg_extract('default', $vars['menu'], null);
14 $admin = elgg_extract('admin', $vars['menu'], null);
15 
16 echo '<ul class="elgg-menu elgg-menu-hover">';
17 
18 // name and username
19 $name_link = elgg_view('output/url', array(
20  'href' => $user->getURL(),
21  'text' => "<span class=\"elgg-heading-basic\">$user->name</span>&#64;$user->username",
22  'is_trusted' => true,
23 ));
24 echo "<li>$name_link</li>";
25 
26 // actions
27 if (elgg_is_logged_in() && $actions) {
28  echo '<li>';
29  echo elgg_view('navigation/menu/elements/section', array(
30  'class' => "elgg-menu elgg-menu-hover-actions",
31  'items' => $actions,
32  ));
33  echo '</li>';
34 }
35 
36 // main
37 if ($main) {
38  echo '<li>';
39 
40  echo elgg_view('navigation/menu/elements/section', array(
41  'class' => 'elgg-menu elgg-menu-hover-default',
42  'items' => $main,
43  ));
44 
45  echo '</li>';
46 }
47 
48 // admin
50  echo '<li>';
51 
52  echo elgg_view('navigation/menu/elements/section', array(
53  'class' => 'elgg-menu elgg-menu-hover-admin',
54  'items' => $admin,
55  ));
56 
57  echo '</li>';
58 }
59 
60 echo '</ul>';
elgg_is_logged_in()
Returns whether or not the user is currently logged in.
Definition: sessions.php:51
$name_link
Definition: user_hover.php:19
$admin
Definition: user_hover.php:14
elgg_is_admin_logged_in()
Returns whether or not the viewer is currently logged in and an admin user.
Definition: sessions.php:60
$main
Definition: user_hover.php:13
$vars['entity']
$actions
Definition: user_hover.php:12
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:342
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:1310
$user
User hover menu.
Definition: user_hover.php:11