pulled complete menu to the top (go for mobile...)

This commit is contained in:
Philip Häusler 2014-09-08 14:45:41 +02:00
parent 8a0bd3d55c
commit 46575d90c2
7 changed files with 41 additions and 28 deletions

View File

@ -5,7 +5,7 @@ function admin_news() {
if (! isset($_GET["action"])) { if (! isset($_GET["action"])) {
redirect(page_link_to("news")); redirect(page_link_to("news"));
} else { } 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'])) if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id']))
$id = $_REQUEST['id']; $id = $_REQUEST['id'];
else else

View File

@ -6,7 +6,7 @@ function admin_user_title() {
function admin_user() { function admin_user() {
global $user, $privileges, $tshirt_sizes, $privileges; 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) { 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']; $id = $_REQUEST['id'];

View File

@ -14,7 +14,7 @@ function meetings_title() {
function user_meetings() { function user_meetings() {
global $DISPLAY_NEWS, $privileges, $user; 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'])) if (isset($_REQUEST['page']) && preg_match("/^[0-9]{1,}$/", $_REQUEST['page']))
$page = $_REQUEST['page']; $page = $_REQUEST['page'];
@ -72,7 +72,7 @@ function display_news($news) {
function user_news_comments() { function user_news_comments() {
global $user; 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) { 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"]; $nid = $_REQUEST["nid"];
list($news) = sql_select("SELECT * FROM `News` WHERE `ID`=" . sql_escape($nid) . " LIMIT 1"); 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() { function user_news() {
global $DISPLAY_NEWS, $privileges, $user; 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["text"]) && isset($_POST["betreff"]) && in_array("admin_news", $privileges)) {
if (! isset($_POST["treffen"]) || ! in_array("admin_news", $privileges)) if (! isset($_POST["treffen"]) || ! in_array("admin_news", $privileges))

View File

@ -730,7 +730,7 @@ function view_user_shifts() {
User_reset_api_key($user); User_reset_api_key($user);
return page(array( return page(array(
'<div class="col-md-10">', '<div class="col-md-12">',
msg(), msg(),
template_render('../templates/user_shifts.html', array( template_render('../templates/user_shifts.html', array(
'title' => shifts_title(), 'title' => shifts_title(),

View File

@ -23,29 +23,32 @@ function header_toolbar() {
$toolbar_items[] = make_langselect(); $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'); $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') . '&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)) if (in_array('login', $privileges))
$toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $p == 'login'); $toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $p == 'login');
if (in_array('logout', $privileges)) $user_submenu = array();
$toolbar_items[] = toolbar_item_link(page_link_to('logout'), 'log-out', logout_title(), $p == 'logout'); 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');
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() { function make_navigation() {
global $p; global $p, $privileges;
global $privileges;
$menu = "";
$menu = array();
$pages = array( $pages = array(
"news" => news_title(), "news" => news_title(),
"user_meetings" => meetings_title(), "user_meetings" => meetings_title(),
@ -53,7 +56,15 @@ function make_navigation() {
"user_shifts" => shifts_title(), "user_shifts" => shifts_title(),
"angeltypes" => angeltypes_title(), "angeltypes" => angeltypes_title(),
"user_messages" => messages_title() . ' ' . user_unread_messages(), "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_arrive" => admin_arrive_title(),
"admin_active" => admin_active_title(), "admin_active" => admin_active_title(),
"admin_user" => admin_user_title(), "admin_user" => admin_user_title(),
@ -66,11 +77,14 @@ function make_navigation() {
"admin_log" => admin_log_title() "admin_log" => admin_log_title()
); );
foreach ($pages as $page => $title) foreach ($admin_pages as $page => $title)
if (in_array($page, $privileges)) 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);
return '<ul class="nav nav-pills nav-stacked">' . $menu . '</ul>'; if (count($admin_menu) > 0)
$menu[] = toolbar_dropdown('', _("Admin"), $admin_menu);
return toolbar($menu);
} }
function make_navigation_for($name, $pages) { function make_navigation_for($name, $pages) {

View File

@ -19,8 +19,8 @@ function div($class, $content = array(), $id = "") {
* @param array $items * @param array $items
* @return string * @return string
*/ */
function toolbar($items = array()) { function toolbar($items = array(), $right = false) {
return '<ul class="nav navbar-nav navbar-right">' . join("\n", $items) . '</ul>'; 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. * Fügt dazu die übergebenen Elemente zusammen.
*/ */
function page_with_title($title, $elements) { 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>';
} }
/** /**

View File

@ -24,12 +24,11 @@
</button> </button>
<a class="navbar-brand" href="?"><span class="icon-icon_angel"></span> <strong>ENGELSYSTEM</strong></a> <a class="navbar-brand" href="?"><span class="icon-icon_angel"></span> <strong>ENGELSYSTEM</strong></a>
</div> </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> </div>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-md-2" style="margin-top: 28px;">%menu%</div>
%content% %content%
</div> </div>
<div class="row"> <div class="row">