From 46575d90c276bbf10d28d19900790c454dbe96ff Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Mon, 8 Sep 2014 14:45:41 +0200 Subject: pulled complete menu to the top (go for mobile...) --- includes/sys_menu.php | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'includes/sys_menu.php') diff --git a/includes/sys_menu.php b/includes/sys_menu.php index 56b25a78..4841dd52 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -23,29 +23,32 @@ function header_toolbar() { $toolbar_items[] = make_langselect(); - if (in_array('register', $privileges)) + if (! isset($user) && in_array('register', $privileges)) $toolbar_items[] = toolbar_item_link(page_link_to('register'), 'plus', register_title(), $p == 'register'); + if (in_array('login', $privileges)) + $toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $p == 'login'); + + $user_submenu = array(); if (in_array('user_myshifts', $privileges)) $toolbar_items[] = toolbar_item_link(page_link_to('users') . '&action=view', ' icon-icon_angel', $user['Nick'], $p == 'users'); if (in_array('user_settings', $privileges)) - $toolbar_items[] = toolbar_item_link(page_link_to('user_settings'), 'list-alt', settings_title(), $p == 'user_settings'); - - if (in_array('login', $privileges)) - $toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $p == 'login'); + $user_submenu[] = toolbar_item_link(page_link_to('user_settings'), 'list-alt', settings_title(), $p == 'user_settings'); if (in_array('logout', $privileges)) - $toolbar_items[] = toolbar_item_link(page_link_to('logout'), 'log-out', logout_title(), $p == 'logout'); + $user_submenu[] = toolbar_item_link(page_link_to('logout'), 'log-out', logout_title(), $p == 'logout'); - return toolbar($toolbar_items); + if (count($user_submenu) > 0) + $toolbar_items[] = toolbar_dropdown('', '', $user_submenu); + + return toolbar($toolbar_items, true); } function make_navigation() { - global $p; - global $privileges; - $menu = ""; + global $p, $privileges; + $menu = array(); $pages = array( "news" => news_title(), "user_meetings" => meetings_title(), @@ -53,7 +56,15 @@ function make_navigation() { "user_shifts" => shifts_title(), "angeltypes" => angeltypes_title(), "user_messages" => messages_title() . ' ' . user_unread_messages(), - "user_questions" => questions_title(), + "user_questions" => questions_title() + ); + + foreach ($pages as $page => $title) + if (in_array($page, $privileges)) + $menu[] = toolbar_item_link(page_link_to($page), '', $title, $page == $p); + + $admin_menu = array(); + $admin_pages = array( "admin_arrive" => admin_arrive_title(), "admin_active" => admin_active_title(), "admin_user" => admin_user_title(), @@ -66,11 +77,14 @@ function make_navigation() { "admin_log" => admin_log_title() ); - foreach ($pages as $page => $title) + foreach ($admin_pages as $page => $title) if (in_array($page, $privileges)) - $menu .= '
  • ' . $title . '
  • '; + $admin_menu[] = toolbar_item_link(page_link_to($page), '', $title, $page == $p); + + if (count($admin_menu) > 0) + $menu[] = toolbar_dropdown('', _("Admin"), $admin_menu); - return ''; + return toolbar($menu); } function make_navigation_for($name, $pages) { -- cgit v1.2.3-70-g09d2