move language select to the top

main
Philip Häusler 10 years ago
parent f5a094fd8b
commit c5331c44fd

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

@ -16,7 +16,9 @@ function page_link_to_absolute($page) {
function header_toolbar() { function header_toolbar() {
global $p, $privileges, $user; global $p, $privileges, $user;
$toolbar_items = array(); $toolbar_items = array(
make_langselect()
);
if (in_array('register', $privileges)) if (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');
@ -83,7 +85,7 @@ function make_navigation_for($name, $pages) {
} }
function make_menu() { function make_menu() {
return make_navigation() . make_langselect(); return make_navigation();
} }
?> ?>

@ -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>'; 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 * Rendert ein Zahlenfeld mit Buttons zum verstellen
*/ */

@ -57,7 +57,7 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_shift
if ($its_me || in_array('user_shifts_admin', $privileges)) 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")); $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)) 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']) if ($shift['freeloaded'])
$timesum += - 2 * ($shift['end'] - $shift['start']); $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( $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) ? '<h2>' . _("Shifts") . '</h2>' : '',
($its_me || $admin_user_privilege) ? table(array( ($its_me || $admin_user_privilege) ? table(array(
@ -212,11 +213,7 @@ function User_Avatar_render($user) {
* @return string * @return string
*/ */
function User_Nick_render($user_source) { function User_Nick_render($user_source) {
global $user, $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>';
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']);
} }
?> ?>
Loading…
Cancel
Save