move language to submenu

This commit is contained in:
Philip Häusler 2014-09-24 15:11:50 +02:00
parent 094715e6ee
commit 07b6541204
3 changed files with 7 additions and 4 deletions

View File

@ -48,7 +48,7 @@ function make_langselect() {
$items = array(); $items = array();
foreach ($locales as $locale => $name) foreach ($locales as $locale => $name)
$items[] = toolbar_item_link(htmlspecialchars($URL) . $locale, '', '<img src="pic/flag/' . $locale . '.png" alt="' . $name . '" title="' . $name . '"> ' . $name); $items[] = toolbar_item_link(htmlspecialchars($URL) . $locale, '', '<img src="pic/flag/' . $locale . '.png" alt="' . $name . '" title="' . $name . '"> ' . $name);
return toolbar_dropdown('', '<img src="pic/flag/' . $_SESSION['locale'] . '.png" alt="' . $locales[$_SESSION['locale']] . '" title="' . $locales[$_SESSION['locale']] . '">', $items); return $items;
} }
?> ?>

View File

@ -21,15 +21,14 @@ function header_toolbar() {
if (isset($user)) if (isset($user))
$toolbar_items[] = toolbar_item_link('#', 'time', User_shift_state_render($user)); $toolbar_items[] = toolbar_item_link('#', 'time', User_shift_state_render($user));
$toolbar_items[] = make_langselect();
if (! isset($user) && in_array('register', $privileges)) if (! isset($user) && in_array('register', $privileges))
$toolbar_items[] = toolbar_item_link(page_link_to('register'), 'plus', register_title(), $p == 'register'); $toolbar_items[] = toolbar_item_link(page_link_to('register'), 'plus', register_title(), $p == 'register');
if (in_array('login', $privileges)) if (in_array('login', $privileges))
$toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $p == 'login'); $toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $p == 'login');
$user_submenu = array(); $user_submenu = make_langselect();
$user_submenu[] = toolbar_item_divider();
if (in_array('user_myshifts', $privileges)) if (in_array('user_myshifts', $privileges))
$toolbar_items[] = toolbar_item_link(page_link_to('users') . '&amp;action=view', ' icon-icon_angel', $user['Nick'], $p == 'users'); $toolbar_items[] = toolbar_item_link(page_link_to('users') . '&amp;action=view', ' icon-icon_angel', $user['Nick'], $p == 'users');

View File

@ -36,6 +36,10 @@ function toolbar_item_link($href, $glyphicon, $label, $selected = false) {
return '<li class="' . ($selected ? 'active' : '') . '"><a href="' . $href . '">' . ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '') . $label . '</a></li>'; return '<li class="' . ($selected ? 'active' : '') . '"><a href="' . $href . '">' . ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '') . $label . '</a></li>';
} }
function toolbar_item_divider() {
return '<li class="divider"></li>';
}
function toolbar_dropdown($glyphicon, $label, $submenu) { function toolbar_dropdown($glyphicon, $label, $submenu) {
return '<li class="dropdown"> return '<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '') . $label . ' <span class="caret"></span></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown">' . ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '') . $label . ' <span class="caret"></span></a>