summaryrefslogtreecommitdiff
path: root/includes/sys_menu.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-11-14 19:10:29 +0100
committermsquare <msquare@notrademark.de>2016-11-14 19:10:29 +0100
commit16ed2ae68381362cbfe66d10226b9dedbfaacba5 (patch)
tree68f55a284f363f07ae00f9a0ea474cb8bdfd0a0b /includes/sys_menu.php
parentd3e942f7425b4df8e3893faaadbae7d48fca019a (diff)
fixed settings validation
Diffstat (limited to 'includes/sys_menu.php')
-rw-r--r--includes/sys_menu.php54
1 files changed, 31 insertions, 23 deletions
diff --git a/includes/sys_menu.php b/includes/sys_menu.php
index 9d70cf10..d8a81324 100644
--- a/includes/sys_menu.php
+++ b/includes/sys_menu.php
@@ -12,29 +12,9 @@ function page_link_to_absolute($page) {
}
/**
- * Renders the header toolbar containing search, login/logout, user and settings links.
+ * Render the user hints
*/
-function header_toolbar() {
- global $page, $privileges, $user, $enable_tshirt_size, $max_freeloadable_shifts;
-
- $toolbar_items = [];
-
- if (isset($user)) {
- $toolbar_items[] = toolbar_item_link(page_link_to('shifts') . '&amp;action=next', 'time', User_shift_state_render($user));
- }
-
- if (! isset($user) && in_array('register', $privileges)) {
- $toolbar_items[] = toolbar_item_link(page_link_to('register'), 'plus', register_title(), $page == 'register');
- }
-
- if (in_array('login', $privileges)) {
- $toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $page == 'login');
- }
-
- if (isset($user) && in_array('user_messages', $privileges)) {
- $toolbar_items[] = toolbar_item_link(page_link_to('user_messages'), 'envelope', user_unread_messages());
- }
-
+function header_render_hints($user, $page, $enable_tshirt_size) {
$hints = [];
if (isset($user)) {
$hint_class = 'info';
@@ -87,9 +67,37 @@ function header_toolbar() {
}
}
if (count($hints) > 0) {
- $toolbar_items[] = toolbar_popover($glyphicon . ' text-' . $hint_class, '', $hints, 'bg-' . $hint_class);
+ return toolbar_popover($glyphicon . ' text-' . $hint_class, '', $hints, 'bg-' . $hint_class);
+ }
+ return '';
+}
+
+/**
+ * Renders the header toolbar containing search, login/logout, user and settings links.
+ */
+function header_toolbar() {
+ global $page, $privileges, $user, $enable_tshirt_size, $max_freeloadable_shifts;
+
+ $toolbar_items = [];
+
+ if (isset($user)) {
+ $toolbar_items[] = toolbar_item_link(page_link_to('shifts') . '&amp;action=next', 'time', User_shift_state_render($user));
+ }
+
+ if (! isset($user) && in_array('register', $privileges)) {
+ $toolbar_items[] = toolbar_item_link(page_link_to('register'), 'plus', register_title(), $page == 'register');
+ }
+
+ if (in_array('login', $privileges)) {
+ $toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $page == 'login');
+ }
+
+ if (isset($user) && in_array('user_messages', $privileges)) {
+ $toolbar_items[] = toolbar_item_link(page_link_to('user_messages'), 'envelope', user_unread_messages());
}
+ $toolbar_items[] = header_render_hints($user, $page, $enable_tshirt_size);
+
$user_submenu = make_langselect();
$user_submenu[] = toolbar_item_divider();
if (in_array('user_myshifts', $privileges)) {