summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2014-09-08 14:45:41 +0200
committerPhilip Häusler <msquare@notrademark.de>2014-09-08 14:45:41 +0200
commit46575d90c276bbf10d28d19900790c454dbe96ff (patch)
treed39a3b33d611b8c165c24e8a245a535801ee50dd
parent8a0bd3d55cb0a012056a13ab8e4158a69ccb4764 (diff)
pulled complete menu to the top (go for mobile...)
-rw-r--r--includes/pages/admin_news.php2
-rw-r--r--includes/pages/admin_user.php2
-rw-r--r--includes/pages/user_news.php6
-rw-r--r--includes/pages/user_shifts.php2
-rw-r--r--includes/sys_menu.php42
-rw-r--r--includes/sys_template.php6
-rw-r--r--templates/layout.html3
7 files changed, 38 insertions, 25 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 = '<div class="col-md-10"><h1>' . _("Edit news entry") . '</h1>';
+ $html = '<div class="col-md-12"><h1>' . _("Edit news entry") . '</h1>';
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 = '<div class="col-md-10">';
+ $html = '<div class="col-md-12">';
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 = '<div class="col-md-10"><h1>' . meetings_title() . '</h1>' . msg();
+ $html = '<div class="col-md-12"><h1>' . meetings_title() . '</h1>' . 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 = '<div class="col-md-10"><h1>' . user_news_comments_title() . '</h1>';
+ $html = '<div class="col-md-12"><h1>' . user_news_comments_title() . '</h1>';
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 = '<div class="col-md-10"><h1>' . news_title() . '</h1>' . msg();
+ $html = '<div class="col-md-12"><h1>' . news_title() . '</h1>' . 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(
- '<div class="col-md-10">',
+ '<div class="col-md-12">',
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('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') . '&amp;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 .= '<li class="' . ($page == $p ? 'active' : '') . '"><a href="' . page_link_to($page) . '">' . $title . '</a></li>';
+ $admin_menu[] = toolbar_item_link(page_link_to($page), '', $title, $page == $p);
+
+ if (count($admin_menu) > 0)
+ $menu[] = toolbar_dropdown('', _("Admin"), $admin_menu);
- return '<ul class="nav nav-pills nav-stacked">' . $menu . '</ul>';
+ 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 '<ul class="nav navbar-nav navbar-right">' . join("\n", $items) . '</ul>';
+function toolbar($items = array(), $right = false) {
+ return '<ul class="nav navbar-nav' . ($right ? ' navbar-right' : '') . '">' . join("\n", $items) . '</ul>';
}
/**
@@ -233,7 +233,7 @@ function page($elements) {
* Fügt dazu die übergebenen Elemente zusammen.
*/
function page_with_title($title, $elements) {
- return '<div class="col-md-10"><h1>' . $title . '</h1>' . join($elements) . '</div>';
+ return '<div class="col-md-12"><h1>' . $title . '</h1>' . join($elements) . '</div>';
}
/**
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 @@
</button>
<a class="navbar-brand" href="?"><span class="icon-icon_angel"></span> <strong>ENGELSYSTEM</strong></a>
</div>
- <div class="collapse navbar-collapse" id="navbar-collapse-1">%header_toolbar%</div>
+ <div class="collapse navbar-collapse" id="navbar-collapse-1">%menu% %header_toolbar%</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
- <div class="col-md-2" style="margin-top: 28px;">%menu%</div>
%content%
</div>
<div class="row">