From 46575d90c276bbf10d28d19900790c454dbe96ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20H=C3=A4usler?= Date: Mon, 8 Sep 2014 14:45:41 +0200 Subject: [PATCH] pulled complete menu to the top (go for mobile...) --- includes/pages/admin_news.php | 2 +- includes/pages/admin_user.php | 2 +- includes/pages/user_news.php | 6 ++--- includes/pages/user_shifts.php | 2 +- includes/sys_menu.php | 48 ++++++++++++++++++++++------------ includes/sys_template.php | 6 ++--- templates/layout.html | 3 +-- 7 files changed, 41 insertions(+), 28 deletions(-) diff --git a/includes/pages/admin_news.php b/includes/pages/admin_news.php index 39b37068..a83e0d70 100644 --- a/includes/pages/admin_news.php +++ b/includes/pages/admin_news.php @@ -5,7 +5,7 @@ function admin_news() { if (! isset($_GET["action"])) { redirect(page_link_to("news")); } else { - $html = '

' . _("Edit news entry") . '

'; + $html = '

' . _("Edit news entry") . '

'; if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) $id = $_REQUEST['id']; else diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 7df39d0d..8eb4d5bc 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -6,7 +6,7 @@ function admin_user_title() { function admin_user() { global $user, $privileges, $tshirt_sizes, $privileges; - $html = '
'; + $html = '
'; if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,}$/", $_REQUEST['id']) && sql_num_query("SELECT * FROM `User` WHERE `UID`=" . sql_escape($_REQUEST['id'])) > 0) { $id = $_REQUEST['id']; diff --git a/includes/pages/user_news.php b/includes/pages/user_news.php index c4d243f4..c049f70e 100644 --- a/includes/pages/user_news.php +++ b/includes/pages/user_news.php @@ -14,7 +14,7 @@ function meetings_title() { function user_meetings() { global $DISPLAY_NEWS, $privileges, $user; - $html = '

' . meetings_title() . '

' . msg(); + $html = '

' . meetings_title() . '

' . msg(); if (isset($_REQUEST['page']) && preg_match("/^[0-9]{1,}$/", $_REQUEST['page'])) $page = $_REQUEST['page']; @@ -72,7 +72,7 @@ function display_news($news) { function user_news_comments() { global $user; - $html = '

' . user_news_comments_title() . '

'; + $html = '

' . user_news_comments_title() . '

'; if (isset($_REQUEST["nid"]) && preg_match("/^[0-9]{1,}$/", $_REQUEST['nid']) && sql_num_query("SELECT * FROM `News` WHERE `ID`=" . sql_escape($_REQUEST['nid']) . " LIMIT 1") > 0) { $nid = $_REQUEST["nid"]; list($news) = sql_select("SELECT * FROM `News` WHERE `ID`=" . sql_escape($nid) . " LIMIT 1"); @@ -116,7 +116,7 @@ function user_news_comments() { function user_news() { global $DISPLAY_NEWS, $privileges, $user; - $html = '

' . news_title() . '

' . msg(); + $html = '

' . news_title() . '

' . msg(); if (isset($_POST["text"]) && isset($_POST["betreff"]) && in_array("admin_news", $privileges)) { if (! isset($_POST["treffen"]) || ! in_array("admin_news", $privileges)) diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index faf6f162..3b5c57e9 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -730,7 +730,7 @@ function view_user_shifts() { User_reset_api_key($user); return page(array( - '
', + '
', msg(), template_render('../templates/user_shifts.html', array( 'title' => shifts_title(), 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('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'); - if (in_array('logout', $privileges)) - $toolbar_items[] = toolbar_item_link(page_link_to('logout'), 'log-out', logout_title(), $p == 'logout'); + $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'); - return toolbar($toolbar_items); + if (in_array('user_settings', $privileges)) + $user_submenu[] = toolbar_item_link(page_link_to('user_settings'), 'list-alt', settings_title(), $p == 'user_settings'); + + if (in_array('logout', $privileges)) + $user_submenu[] = toolbar_item_link(page_link_to('logout'), 'log-out', logout_title(), $p == 'logout'); + + 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); - return ''; + if (count($admin_menu) > 0) + $menu[] = toolbar_dropdown('', _("Admin"), $admin_menu); + + return toolbar($menu); } function make_navigation_for($name, $pages) { diff --git a/includes/sys_template.php b/includes/sys_template.php index be463139..b18abe53 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -19,8 +19,8 @@ function div($class, $content = array(), $id = "") { * @param array $items * @return string */ -function toolbar($items = array()) { - return ''; +function toolbar($items = array(), $right = false) { + return ''; } /** @@ -233,7 +233,7 @@ function page($elements) { * Fügt dazu die übergebenen Elemente zusammen. */ function page_with_title($title, $elements) { - return '

    ' . $title . '

    ' . join($elements) . '
    '; + return '

    ' . $title . '

    ' . join($elements) . '
    '; } /** diff --git a/templates/layout.html b/templates/layout.html index 9b89f6a1..d720de49 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -24,12 +24,11 @@ ENGELSYSTEM
    - +
    -
    %menu%
    %content%