[Задача 12794] Изменил верстку меню на использование bootstrap navigation bar. Изменил menu helper.

parent 15bf7e76
...@@ -50,11 +50,11 @@ class Typos extends CI_Controller { ...@@ -50,11 +50,11 @@ class Typos extends CI_Controller {
$data['base_url'] = $this->config->base_url(); $data['base_url'] = $this->config->base_url();
if ($this->session->usertype == 'admin') { if ($this->session->usertype == 'admin') {
$data['items'] = menu_admin($data['base_url']); $data['menuItems'] = menu_admin($data['base_url']);
} }
if ($this->session->usertype == 'user') { if ($this->session->usertype == 'user') {
$data['items'] = menu_user($data['base_url']); $data['menuItems'] = menu_user($data['base_url']);
} }
$this->load->view($this->header_name, $data); $this->load->view($this->header_name, $data);
......
...@@ -8,25 +8,41 @@ ...@@ -8,25 +8,41 @@
/** /**
* Composes and returns a admin menu as array of items * Composes and returns a admin menu as array of items
* @return string * @return array
*/ */
function menu_admin($baseUrl) { function menu_admin($baseUrl) {
$data['sites'] = "<a href='".$baseUrl."index.php/admins/sites'>Сайты</a>"; $data = [];
$data['users'] = "<a href='".$baseUrl."index.php/admins/users'>Пользователи</a>";
$data['typos'] = "<a href='".$baseUrl."index.php/users/typos'>Опечатки</a>"; $data[] = [
$data['logout'] = "<a href='".$baseUrl."index.php/authorization/logout'>Выйти</a>"; "href" => "${baseUrl}index.php/admins/sites",
"name" => "Сайты"
];
$data[] = [
"href" => "${baseUrl}index.php/admins/users",
"name" => "Пользователи"
];
$data[] = [
"href" => "${baseUrl}index.php/users/typos",
"name" => "Опечатки"
];
return $data; return $data;
} }
/** /**
* Composes and returns a user menu as array of items * Composes and returns a user menu as array of items
* @return string * @return array
*/ */
function menu_user($baseUrl) { function menu_user($baseUrl) {
//$data['typos'] = "<a href='".$baseUrl."index.php/users/typos'>Опечатки</a>"; $data = [];
$data['logout'] = "<a href='".$baseUrl."index.php/authorization/logout'>Выйти</a>";
$data[] = [
"href" => "${baseUrl}index.php/users/typos",
"name" => "Опечатки"
];
return $data; return $data;
} }
...@@ -17,8 +17,3 @@ ...@@ -17,8 +17,3 @@
</head> </head>
<body> <body>
<!-- Шапка -->
<header id="head">
<h1> TYPOS@ETERSOFT - Сервис опечаток </h1>
</header>
<div class="left"> <!-- Шапка-меню -->
<div id="menu"> <nav class="header navbar navbar-expand-md navbar-light bg-light">
<span class="heading">Меню</span> <a href="#" class="navbar-brand">
<hr> <img src="//time.office.etersoft.ru/images/logo.png" width="30" height="30" alt="Etersoft Logo">
<div class="items"> TYPOS@ETERSOFT - Сервис опечаток
<ul> </a>
<?php
if ($items) { <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
foreach ($items as $item) { area-controls="#navbarNav" area-expanded="false" area-label="Раскрыть меню">
echo "<li>".$item."</li>"; <span class="navbar-toggler-icon"></span>
} </button>
}
?> <div class="collapse navbar-collapse " id="navbarNav">
</ul> <ul class="navbar-nav mr-auto">
</div>
<?foreach ($menuItems as $index => $item): ?>
<?if ($index === 0): ?>
<li class="nav-item active">
<a href="<?= $item["href"] ?>" class="nav-link">
<?= $item["name"] ?>
<span class="sr-only">(текущая)</span>
</a>
</li>
<?else:?>
<li class="nav-item">
<a href="<?= $item["href"] ?>" class="nav-link">
<?= $item["name"] ?>
</a>
</li>
<?endif;?>
<?endforeach;?>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a href="<?=$base_url?>index.php/authorization/logout">Выйти</a>
</li>
</ul>
</div> </div>
</div> </nav>
\ No newline at end of file \ No newline at end of file
...@@ -50,16 +50,8 @@ body { ...@@ -50,16 +50,8 @@ body {
float: left; float: left;
} }
#head { .header {
padding: 8px;
margin-bottom: 15px; margin-bottom: 15px;
background-color: #F3F3F3;
}
#head h1 {
vertical-align: center;
margin: 0;
color: #FF9C00;
} }
#footer { #footer {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment