diff options
-rw-r--r-- | includes/helper/internationalization_helper.php | 7 | ||||
-rw-r--r-- | includes/sys_menu.php | 6 | ||||
-rw-r--r-- | includes/sys_template.php | 6 | ||||
-rw-r--r-- | 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 = '<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); } ?>
\ 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 '<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 */ 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'], '<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') . '&action=view&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') . '&action=view&user_id=' . $user_source['UID'] . '"><span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . '</a>'; } ?>
\ No newline at end of file |