aboutsummaryrefslogtreecommitdiff
path: root/views/default/page_elements/elgg_topbar.php
blob: 6348099bcaa2ba23f70e2ecbf27c9ef7c29e3307 (plain)
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
<?php
/**
 * Elgg top toolbar
 * The standard elgg top toolbar
 */

$user = get_loggedin_user();
if (($user instanceof ElggUser) && ($user->guid > 0)) {
	echo '<div id="elgg_topbar" class="clearfloat">';
	echo '<div id="elgg_topbar_contents">';
	
	// Elgg logo
	echo '<a href="http://www.elgg.org">';
	echo "<img class=\"site_logo\" src=\"{$vars['url']}_graphics/elgg_toolbar_logo.gif\" alt=\"Elgg logo\" />";
	echo '</a>';
	
	// avatar
	$user_link = $user->getURL();
	$user_image = $user->getIcon('topbar');
	echo "<a href=\"$user_link\"><img class=\"user_mini_avatar\" src=\"$user_image\" alt=\"User avatar\" /></a>";

	// logout link
	echo '<div class="log_out">';
	echo elgg_view('output/url', array(
		'href' => "{$vars['url']}action/logout",
		'text' => elgg_echo('logout'),
		'is_action' => TRUE
	));
	echo '</div>';
	
	// user settings
	$settings = elgg_echo('settings');
	echo "<a href=\"{$vars['url']}pg/settings\" class=\"settings\">$settings</a>";

	// The administration link is for admin or site admin users only
	if ($user->isAdmin()) {
		$admin = elgg_echo("admin");
		echo "<a href=\"{$vars['url']}pg/admin\" class=\"admin\">$admin</a>";
	}
	
	// elgg tools menu
	// need to echo this empty view for backward compatibility.
	echo elgg_view("navigation/topbar_tools");
	
	// enable elgg topbar extending
	echo elgg_view('elgg_topbar/extend', $vars);

	echo '</div>';
	echo '</div>';
}