1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php
/**
* User hover menu
*
* Register for the 'register', 'menu:user_hover' plugin hook to add to the user
* hover menu. There are three sections: action, default, and admin.
*
* @uses $vars['menu'] Menu array provided by elgg_view_menu()
*/
$user = $vars['entity'];
$actions = elgg_get_array_value('action', $vars['menu'], null);
$main = elgg_get_array_value('default', $vars['menu'], null);
$admin = elgg_get_array_value('admin', $vars['menu'], null);
echo '<ul class="elgg-menu elgg-menu-hover">';
// name and username
$name_link = elgg_view('output/url', array(
'href' => $user->getURL(),
'text' => "<h3>$user->name</h3>@$user->username",
));
echo "<li>$name_link</li>";
// actions
if (isloggedin() && $actions) {
echo '<li><ul>';
foreach ($actions as $menu_item) {
echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item));
}
echo '</ul></li>';
}
// main
if ($main) {
echo '<li><ul>';
foreach ($main as $menu_item) {
echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item));
}
echo '</ul></li>';
}
// admin
if (isadminloggedin() && $admin) {
echo '<li><ul class="elgg-hover-admin">';
foreach ($admin as $menu_item) {
echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item));
}
echo '</ul></li>';
}
echo '</ul>';
|