move language select to the top

This commit is contained in:
Philip Häusler 2014-08-23 02:16:12 +02:00
parent f5a094fd8b
commit c5331c44fd
4 changed files with 17 additions and 13 deletions

View File

@ -45,11 +45,10 @@ function make_langselect() {
global $locales;
$URL = $_SERVER["REQUEST_URI"] . (strpos($_SERVER["REQUEST_URI"], "?") > 0 ? '&' : '?') . "set_locale=";
$html = '<p class="content">';
$items = array();
foreach ($locales as $locale => $name)
$html .= '<a class="sprache" href="' . htmlspecialchars($URL) . $locale . '"><img src="pic/flag/' . $locale . '.png" alt="' . $name . '" title="' . $name . '"></a>';
$html .= '</p>';
return '<nav class="container"><h4>' . _("Language") . '</h4>' . $html . '</nav>';
$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']] . '"> ' . $locales[$_SESSION['locale']], $items);
}
?>

View File

@ -16,7 +16,9 @@ function page_link_to_absolute($page) {
function header_toolbar() {
global $p, $privileges, $user;
$toolbar_items = array();
$toolbar_items = array(
make_langselect()
);
if (in_array('register', $privileges))
$toolbar_items[] = toolbar_item_link(page_link_to('register'), 'plus', register_title(), $p == 'register');
@ -83,7 +85,7 @@ function make_navigation_for($name, $pages) {
}
function make_menu() {
return make_navigation() . make_langselect();
return make_navigation();
}
?>

View File

@ -36,6 +36,12 @@ 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>';
}
function toolbar_dropdown($glyphicon, $label, $submenu) {
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>
<ul class="dropdown-menu" role="menu">' . join("\n", $submenu) . '</ul></li>';
}
/**
* Rendert ein Zahlenfeld mit Buttons zum verstellen
*/

View File

@ -57,7 +57,7 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_shift
if ($its_me || in_array('user_shifts_admin', $privileges))
$myshift['actions'] .= img_button(page_link_to('user_myshifts') . '&edit=' . $shift['id'] . '&id=' . $user_source['UID'], 'pencil', _("edit"));
if (($shift['start'] > time() + $LETZTES_AUSTRAGEN * 3600) || in_array('user_shifts_admin', $privileges))
$myshift['actions'] .= img_button(page_link_to('user_myshifts') . ((! $its_me) ? '&id=' . $id : '') . '&cancel=' . $shift['id'], 'cross', _("sign off"));
$myshift['actions'] .= img_button(page_link_to('user_myshifts') . ((! $its_me) ? '&id=' . $user_source['UID'] : '') . '&cancel=' . $shift['id'], 'cross', _("sign off"));
if ($shift['freeloaded'])
$timesum += - 2 * ($shift['end'] - $shift['start']);
@ -102,7 +102,8 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_shift
))
)),
$admin_user_privilege ? buttons(array(
button(page_link_to('admin_user') . '&id=' . $user_source['UID'], '<span class="glyphicon glyphicon-edit"></span> ' . _("edit"))
button(page_link_to('admin_user') . '&id=' . $user_source['UID'], '<span class="glyphicon glyphicon-edit"></span> ' . _("edit")),
! $user_source['Gekommen'] ? button(page_link_to('admin_arrive') . '&arrived=' . $user_source['UID'], _("arrived")) : ''
)) : '',
($its_me || $admin_user_privilege) ? '<h2>' . _("Shifts") . '</h2>' : '',
($its_me || $admin_user_privilege) ? table(array(
@ -212,11 +213,7 @@ function User_Avatar_render($user) {
* @return string
*/
function User_Nick_render($user_source) {
global $user, $privileges;
if ($user['UID'] == $user_source['UID'] || in_array('user_shifts_admin', $privileges))
return '<a href="' . page_link_to('users') . '&amp;action=view&amp;user_id=' . $user_source['UID'] . '"><span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . '</a>';
else
return htmlspecialchars($user_source['Nick']);
return '<a href="' . page_link_to('users') . '&amp;action=view&amp;user_id=' . $user_source['UID'] . '"><span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . '</a>';
}
?>