From c5331c44fd5f0251e7ec572c3bfc50a9f52c86bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20H=C3=A4usler?= Date: Sat, 23 Aug 2014 02:16:12 +0200 Subject: [PATCH] move language select to the top --- includes/helper/internationalization_helper.php | 7 +++---- includes/sys_menu.php | 6 ++++-- includes/sys_template.php | 6 ++++++ includes/view/User_view.php | 11 ++++------- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/includes/helper/internationalization_helper.php b/includes/helper/internationalization_helper.php index db150fec..7598dc2f 100644 --- a/includes/helper/internationalization_helper.php +++ b/includes/helper/internationalization_helper.php @@ -45,11 +45,10 @@ function make_langselect() { global $locales; $URL = $_SERVER["REQUEST_URI"] . (strpos($_SERVER["REQUEST_URI"], "?") > 0 ? '&' : '?') . "set_locale="; - $html = '

'; + $items = array(); foreach ($locales as $locale => $name) - $html .= '' . $name . ''; - $html .= '

'; - return ''; + $items[] = toolbar_item_link(htmlspecialchars($URL) . $locale, '', '' . $name . ' ' . $name); + return toolbar_dropdown('', '' . $locales[$_SESSION['locale']] . ' ' . $locales[$_SESSION['locale']], $items); } ?> \ No newline at end of file diff --git a/includes/sys_menu.php b/includes/sys_menu.php index 407b784c..de7fc071 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -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(); } ?> diff --git a/includes/sys_template.php b/includes/sys_template.php index 9fc87ef3..24e6797b 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -36,6 +36,12 @@ function toolbar_item_link($href, $glyphicon, $label, $selected = false) { return '
  • ' . ($glyphicon != '' ? ' ' : '') . $label . '
  • '; } +function toolbar_dropdown($glyphicon, $label, $submenu) { + return ''; +} + /** * Rendert ein Zahlenfeld mit Buttons zum verstellen */ diff --git a/includes/view/User_view.php b/includes/view/User_view.php index f7011ffd..04a0fa3f 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -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'], ' ' . _("edit")) + button(page_link_to('admin_user') . '&id=' . $user_source['UID'], ' ' . _("edit")), + ! $user_source['Gekommen'] ? button(page_link_to('admin_arrive') . '&arrived=' . $user_source['UID'], _("arrived")) : '' )) : '', ($its_me || $admin_user_privilege) ? '

    ' . _("Shifts") . '

    ' : '', ($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 ' ' . htmlspecialchars($user_source['Nick']) . ''; - else - return htmlspecialchars($user_source['Nick']); + return ' ' . htmlspecialchars($user_source['Nick']) . ''; } ?> \ No newline at end of file