add backend theme AdminLte, bind reception/transaction to a permission
This commit is contained in:
@@ -8,6 +8,7 @@ use yii\helpers\Html;
|
||||
class AdminMenuStructure{
|
||||
|
||||
public $menuItems;
|
||||
public $emptyUrl = '#';//maybe null
|
||||
|
||||
public function __construct(){
|
||||
$this->menuItems = [];
|
||||
@@ -43,7 +44,8 @@ class AdminMenuStructure{
|
||||
// Beállítások
|
||||
/////////////////////////////
|
||||
$items[] = ['label' => 'Felhasználók', 'url' =>['/user/index']];
|
||||
$this->menuItems[] = ['label' => 'Beállítások', 'url' => null,
|
||||
$items[] = ['label' => 'Jogosultságok', 'url' =>['/user/role']];
|
||||
$this->menuItems[] = ['label' => 'Beállítások', 'url' => $this->emptyUrl,
|
||||
'items' => $items
|
||||
];
|
||||
|
||||
@@ -57,7 +59,7 @@ class AdminMenuStructure{
|
||||
$items[] = ['label' => 'Termék kategóriák', 'url' => ['/product-category/index'] ];
|
||||
$items[] = ['label' => 'Bérlet típusok', 'url' => ['/ticket-type/index'] ];
|
||||
// $items[] = ['label' => 'Pénznem', 'url' => ['/currency/index'] ];
|
||||
$this->menuItems[] = ['label' => 'Törszadatok', 'url' => null,
|
||||
$this->menuItems[] = ['label' => 'Törszadatok', 'url' =>$this->emptyUrl,
|
||||
'items' => $items
|
||||
];
|
||||
|
||||
@@ -65,10 +67,10 @@ class AdminMenuStructure{
|
||||
// BÉRLETEK
|
||||
/////////////////////////////
|
||||
$items = [];
|
||||
$items[] = ['label' => 'Vendégek', 'url' => ['/customer/index'] ];
|
||||
$items[] = ['label' => 'Vendégek', 'url' => ['/customer/index'] , 'target_url' => ['/customer/index' ,'/customer/view','/ticket/index-customer'] ];
|
||||
$items[] = ['label' => 'Bérletkártyák', 'url' => ['/card/index'] ];
|
||||
$items[] = ['label' => 'Bérletek', 'url' => ['/ticket/index' , 'TicketSearch[start]' =>$today,'TicketSearch[end]' => $tomorrow ] ];
|
||||
$this->menuItems[] = ['label' => 'Bérletek/Vendégek', 'url' => null,
|
||||
$this->menuItems[] = ['label' => 'Bérletek/Vendégek', 'url' => $this->emptyUrl,
|
||||
'items' => $items
|
||||
];
|
||||
|
||||
@@ -78,7 +80,7 @@ class AdminMenuStructure{
|
||||
$items = [];
|
||||
$items[] = ['label' => 'Termékek', 'url' => ['/product/index'] ];
|
||||
$items[] = ['label' => 'Beszerzések', 'url' => ['/procurement/index'] ];
|
||||
$this->menuItems[] = ['label' => 'Termékek', 'url' => null,
|
||||
$this->menuItems[] = ['label' => 'Termékek', 'url' => $this->emptyUrl,
|
||||
'items' => $items
|
||||
];
|
||||
/////////////////////////////
|
||||
@@ -88,7 +90,7 @@ class AdminMenuStructure{
|
||||
$items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index' , 'TransferSearch[start]' =>$today,'TransferSearch[end]' => $tomorrow ] ];
|
||||
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
|
||||
$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$todayDatetime,'CollectionSearch[end]' => $tomorrowDatetime ] ];
|
||||
$this->menuItems[] = ['label' => 'Pénzügy', 'url' => null,
|
||||
$this->menuItems[] = ['label' => 'Pénzügy', 'url' => $this->emptyUrl,
|
||||
'items' => $items
|
||||
];
|
||||
|
||||
@@ -112,7 +114,7 @@ class AdminMenuStructure{
|
||||
|
||||
public function run(){
|
||||
$this->addUserMainMenu();
|
||||
$this->addLoginMainMenu();
|
||||
// $this->addLoginMainMenu();
|
||||
return $this->menuItems;
|
||||
}
|
||||
|
||||
|
||||
78
backend/components/LTEAdminMenu.php
Normal file
78
backend/components/LTEAdminMenu.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
namespace backend\components;
|
||||
|
||||
use \Yii;
|
||||
|
||||
|
||||
|
||||
class LTEAdminMenu extends \dmstr\widgets\Menu{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether a menu item is active.
|
||||
* This is done by checking if [[route]] and [[params]] match that specified in the `url` option of the menu item.
|
||||
* When the `url` option of a menu item is specified in terms of an array, its first element is treated
|
||||
* as the route for the item and the rest of the elements are the associated parameters.
|
||||
* Only when its route and parameters match [[route]] and [[params]], respectively, will a menu item
|
||||
* be considered active.
|
||||
* @param array $item the menu item to be checked
|
||||
* @return boolean whether the menu item is active
|
||||
*/
|
||||
protected function isItemActive($item)
|
||||
{
|
||||
|
||||
if (isset($item['target_url']) && is_array($item['target_url']) ) {
|
||||
foreach ($item['target_url'] as $target){
|
||||
$route = $target;
|
||||
if ($route[0] !== '/' && Yii::$app->controller) {
|
||||
$route = Yii::$app->controller->module->getUniqueId() . '/' . $route;
|
||||
}
|
||||
$arrayRoute = explode('/', ltrim($route, '/'));
|
||||
$arrayThisRoute = explode('/', $this->route);
|
||||
if ($arrayRoute[0] !== $arrayThisRoute[0]) {
|
||||
continue;
|
||||
}
|
||||
if (isset($arrayRoute[1]) && $arrayRoute[1] !== $arrayThisRoute[1]) {
|
||||
continue;
|
||||
}
|
||||
if (isset($arrayRoute[2]) && $arrayRoute[2] !== $arrayThisRoute[2]) {
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}else if (isset($item['url']) && is_array($item['url']) && isset($item['url'][0])) {
|
||||
$route = $item['url'][0];
|
||||
if ($route[0] !== '/' && Yii::$app->controller) {
|
||||
$route = Yii::$app->controller->module->getUniqueId() . '/' . $route;
|
||||
}
|
||||
$arrayRoute = explode('/', ltrim($route, '/'));
|
||||
$arrayThisRoute = explode('/', $this->route);
|
||||
if ($arrayRoute[0] !== $arrayThisRoute[0]) {
|
||||
return false;
|
||||
}
|
||||
if (isset($arrayRoute[1]) && $arrayRoute[1] !== $arrayThisRoute[1]) {
|
||||
return false;
|
||||
}
|
||||
if (isset($arrayRoute[2]) && $arrayRoute[2] !== $arrayThisRoute[2]) {
|
||||
return false;
|
||||
}
|
||||
// unset($item['url']['#']);
|
||||
// if (count($item['url']) > 1) {
|
||||
// foreach (array_splice($item['url'], 1) as $name => $value) {
|
||||
// if ($value !== null && (!isset($this->params[$name]) || $this->params[$name] != $value)) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -66,6 +66,10 @@ class SiteController extends Controller
|
||||
}
|
||||
|
||||
$model = new LoginForm();
|
||||
$model->roles = [
|
||||
'admin',
|
||||
'employee'
|
||||
];
|
||||
if ($model->load(Yii::$app->request->post()) && $model->login()) {
|
||||
return $this->goBack();
|
||||
} else {
|
||||
|
||||
@@ -30,9 +30,9 @@ class UserController extends \backend\controllers\BackendController
|
||||
'rules' => [
|
||||
// allow authenticated users
|
||||
[
|
||||
'actions' => [ 'index','view' ],
|
||||
'actions' => [ 'index','view' ,'role'],
|
||||
'allow' => true,
|
||||
'roles' => ['employee','admin','reception'],
|
||||
'roles' => ['employee','admin' ],
|
||||
],
|
||||
// allow authenticated users
|
||||
[
|
||||
@@ -176,6 +176,44 @@ class UserController extends \backend\controllers\BackendController
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new User model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionRole()
|
||||
{
|
||||
$model = new \backend\models\RoleForm();
|
||||
|
||||
$model->availablePermissions = [
|
||||
[
|
||||
'name' => "reception.transfers",
|
||||
'description' => 'Tranzakciók'
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) ) {
|
||||
if ( $model->validate() && $model->save()){
|
||||
Yii::$app->session->setFlash('success', 'Jogosultságok elmentve');
|
||||
return $this->redirect(['role' ]);
|
||||
}
|
||||
}else{
|
||||
$am = Yii::$app->authManager;
|
||||
$children = $am->getChildren(User::ROLE_RECEPTION);
|
||||
$model->permissions = [];
|
||||
foreach ($children as $child){
|
||||
$model->permissions[] = $child->name;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('role', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the User model based on its primary key value.
|
||||
|
||||
46
backend/models/RoleForm.php
Normal file
46
backend/models/RoleForm.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace backend\models;
|
||||
|
||||
use yii\base\Model;
|
||||
use common\models\User;
|
||||
|
||||
class RoleForm extends Model{
|
||||
|
||||
|
||||
public $permissions =[];
|
||||
public $availablePermissions = [];
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @formatter:off
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
['permissions',function ($attribute, $params) {
|
||||
if (!is_array($this->$attribute)) {
|
||||
echo "invalid arr";
|
||||
$this->addError($attribute, 'Invalid array');
|
||||
}
|
||||
}
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function save(){
|
||||
$am = \Yii::$app->authManager;
|
||||
//remove all reception permission
|
||||
$receptionItem = $am->getRole(User::ROLE_RECEPTION);
|
||||
$am->removeChildren($receptionItem);
|
||||
|
||||
if ( isset($receptionItem)){
|
||||
foreach ($this->permissions as $permissionName){
|
||||
$permission = $am->getPermission($permissionName);
|
||||
if ( isset( $permission )){
|
||||
$am->addChild($receptionItem, $permission);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
79
backend/views/layouts-orig/main.php
Normal file
79
backend/views/layouts-orig/main.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
/* @var $content string */
|
||||
|
||||
use backend\assets\AppAsset;
|
||||
use yii\helpers\Html;
|
||||
use yii\bootstrap\Nav;
|
||||
use yii\bootstrap\NavBar;
|
||||
use yii\widgets\Breadcrumbs;
|
||||
use common\widgets\Alert;
|
||||
use backend\components\AdminMenuStructure;
|
||||
use kartik\widgets\AlertBlock;
|
||||
|
||||
AppAsset::register($this);
|
||||
|
||||
$adminMenu = new AdminMenuStructure();
|
||||
$items = $adminMenu->run();
|
||||
?>
|
||||
<?php $this->beginPage() ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= Yii::$app->language ?>">
|
||||
<head>
|
||||
<meta charset="<?= Yii::$app->charset ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<?= Html::csrfMetaTags() ?>
|
||||
<title><?= Html::encode($this->title) ?></title>
|
||||
|
||||
|
||||
<?php $this->head() ?>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<?php $this->beginBody() ?>
|
||||
|
||||
<div class="wrap">
|
||||
<?php
|
||||
NavBar::begin([
|
||||
'brandLabel' => 'Botond Fitness WebAdmin',
|
||||
'brandUrl' => Yii::$app->homeUrl,
|
||||
'options' => [
|
||||
'class' => 'navbar-inverse navbar-fixed-top',
|
||||
],
|
||||
]);
|
||||
echo Nav::widget([
|
||||
'options' => ['class' => 'navbar-nav navbar-right'],
|
||||
'items' => $items,
|
||||
]);
|
||||
NavBar::end();
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<?= Breadcrumbs::widget([
|
||||
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
|
||||
]) ?>
|
||||
<?php //echo Alert::widget() ?>
|
||||
<?php
|
||||
echo AlertBlock::widget([
|
||||
'useSessionFlash' => true,
|
||||
'type' => AlertBlock::TYPE_GROWL,
|
||||
'delay' => '1'
|
||||
]);
|
||||
?>
|
||||
<?= $content ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="pull-left">© <?= Yii::$app->name ?> <?= Yii::$app->params['version'] ?> Fitness - WebAdmin <?= date('Y') ?></p>
|
||||
|
||||
<p class="pull-right"><?= Yii::powered() ?></p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<?php $this->endBody() ?>
|
||||
</body>
|
||||
</html>
|
||||
<?php $this->endPage() ?>
|
||||
26
backend/views/layouts/content.php
Normal file
26
backend/views/layouts/content.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
use yii\widgets\Breadcrumbs;
|
||||
use dmstr\widgets\Alert;
|
||||
|
||||
?>
|
||||
<div class="content-wrapper">
|
||||
<section class="content-header clearfix">
|
||||
|
||||
<?=
|
||||
Breadcrumbs::widget(
|
||||
[
|
||||
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
|
||||
]
|
||||
) ?>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
<?= Alert::widget() ?>
|
||||
<?= $content ?>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<footer class="main-footer">
|
||||
© <?= Yii::$app->name ?> <?= Yii::$app->params['version'] ?> Fitness - WebAdmin <?= date('Y') ?>
|
||||
</footer>
|
||||
|
||||
69
backend/views/layouts/header.php
Normal file
69
backend/views/layouts/header.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
/* @var $content string */
|
||||
?>
|
||||
|
||||
<header class="main-header">
|
||||
|
||||
<?= Html::a('<span class="logo-mini">A</span><span class="logo-lg">Fitness Admin</span>', Yii::$app->homeUrl, ['class' => 'logo']) ?>
|
||||
|
||||
<nav class="navbar navbar-static-top" role="navigation">
|
||||
|
||||
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
</a>
|
||||
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="#">Web Recepció</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-custom-menu">
|
||||
|
||||
<ul class="nav navbar-nav">
|
||||
|
||||
<!-- User Account: style can be found in dropdown.less -->
|
||||
|
||||
<li class="dropdown user user-menu">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<span class='glyphicon glyphicon-user'></span>
|
||||
<span class="hidden-xs"><?php echo Yii::$app->user->identity->username?></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- User image -->
|
||||
<li class="user-header">
|
||||
|
||||
<p>
|
||||
<?php echo Yii::$app->user->identity->username?>
|
||||
<small>Felhasználó</small>
|
||||
</p>
|
||||
</li>
|
||||
<!-- Menu Footer-->
|
||||
<li class="user-footer">
|
||||
<div class="pull-left">
|
||||
<!--
|
||||
<a href="#" class="btn btn-default btn-flat">Profile</a>
|
||||
-->
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<?= Html::a(
|
||||
Yii::t('common/site','Logout'),
|
||||
['/site/logout'],
|
||||
['data-method' => 'post', 'class' => 'btn btn-default btn-flat']
|
||||
) ?>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<!-- User Account: style can be found in dropdown.less -->
|
||||
<!--
|
||||
<li>
|
||||
<a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
|
||||
</li>
|
||||
-->
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
20
backend/views/layouts/left.php
Normal file
20
backend/views/layouts/left.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
use backend\components\AdminMenuStructure;
|
||||
?>
|
||||
|
||||
<?php
|
||||
$menu = new AdminMenuStructure();
|
||||
$menu = $menu->run();
|
||||
$items = $menu;
|
||||
|
||||
?>
|
||||
<aside class="main-sidebar">
|
||||
<section class="sidebar">
|
||||
<?= \backend\components\LTEAdminMenu::widget(
|
||||
[
|
||||
'options' => ['class' => 'sidebar-menu'],
|
||||
'items' => $items
|
||||
]
|
||||
) ?>
|
||||
</section>
|
||||
</aside>
|
||||
29
backend/views/layouts/main-login.php
Normal file
29
backend/views/layouts/main-login.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
use backend\assets\AppAsset;
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
/* @var $content string */
|
||||
|
||||
dmstr\web\AdminLteAsset::register($this);
|
||||
?>
|
||||
<?php $this->beginPage() ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= Yii::$app->language ?>">
|
||||
<head>
|
||||
<meta charset="<?= Yii::$app->charset ?>"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<?= Html::csrfMetaTags() ?>
|
||||
<title><?= Html::encode($this->title) ?></title>
|
||||
<?php $this->head() ?>
|
||||
</head>
|
||||
<body class="login-page">
|
||||
|
||||
<?php $this->beginBody() ?>
|
||||
|
||||
<?= $content ?>
|
||||
|
||||
<?php $this->endBody() ?>
|
||||
</body>
|
||||
</html>
|
||||
<?php $this->endPage() ?>
|
||||
@@ -1,76 +1,74 @@
|
||||
<?php
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
/* @var $content string */
|
||||
|
||||
use backend\assets\AppAsset;
|
||||
use yii\helpers\Html;
|
||||
use yii\bootstrap\Nav;
|
||||
use yii\bootstrap\NavBar;
|
||||
use yii\widgets\Breadcrumbs;
|
||||
use common\widgets\Alert;
|
||||
use backend\components\AdminMenuStructure;
|
||||
use kartik\widgets\AlertBlock;
|
||||
|
||||
AppAsset::register($this);
|
||||
if (Yii::$app->controller->action->id === 'login') {
|
||||
/**
|
||||
* Do not use this code in your template. Remove it.
|
||||
* Instead, use the code $this->layout = '//main-login'; in your controller.
|
||||
*/
|
||||
echo $this->render(
|
||||
'main-login',
|
||||
['content' => $content]
|
||||
);
|
||||
} else {
|
||||
|
||||
$adminMenu = new AdminMenuStructure();
|
||||
$items = $adminMenu->run();
|
||||
?>
|
||||
<?php $this->beginPage() ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= Yii::$app->language ?>">
|
||||
<head>
|
||||
<meta charset="<?= Yii::$app->charset ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<?= Html::csrfMetaTags() ?>
|
||||
<title><?= Html::encode($this->title) ?></title>
|
||||
<?php $this->head() ?>
|
||||
</head>
|
||||
<body>
|
||||
<?php $this->beginBody() ?>
|
||||
if (class_exists('backend\assets\AppAsset')) {
|
||||
backend\assets\AppAsset::register($this);
|
||||
} else {
|
||||
app\assets\AppAsset::register($this);
|
||||
}
|
||||
|
||||
<div class="wrap">
|
||||
<?php
|
||||
NavBar::begin([
|
||||
'brandLabel' => 'Botond Fitness WebAdmin',
|
||||
'brandUrl' => Yii::$app->homeUrl,
|
||||
'options' => [
|
||||
'class' => 'navbar-inverse navbar-fixed-top',
|
||||
],
|
||||
]);
|
||||
echo Nav::widget([
|
||||
'options' => ['class' => 'navbar-nav navbar-right'],
|
||||
'items' => $items,
|
||||
]);
|
||||
NavBar::end();
|
||||
dmstr\web\AdminLteAsset::register($this);
|
||||
|
||||
$directoryAsset = Yii::$app->assetManager->getPublishedUrl('@vendor/almasaeed2010/adminlte/dist');
|
||||
?>
|
||||
<?php $this->beginPage() ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= Yii::$app->language ?>">
|
||||
<head>
|
||||
<meta charset="<?= Yii::$app->charset ?>"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<?= Html::csrfMetaTags() ?>
|
||||
<title><?= Html::encode($this->title) ?></title>
|
||||
<?php $this->head() ?>
|
||||
<style type="text/css">
|
||||
.content-header > .breadcrumb{
|
||||
position: static;
|
||||
top: auto;
|
||||
left: auto;
|
||||
right: auto;
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="hold-transition skin-red sidebar-mini">
|
||||
<?php $this->beginBody() ?>
|
||||
<div class="wrapper">
|
||||
|
||||
<div class="container">
|
||||
<?= Breadcrumbs::widget([
|
||||
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
|
||||
]) ?>
|
||||
<?php //echo Alert::widget() ?>
|
||||
<?php
|
||||
echo AlertBlock::widget([
|
||||
'useSessionFlash' => true,
|
||||
'type' => AlertBlock::TYPE_GROWL,
|
||||
'delay' => '1'
|
||||
]);
|
||||
<?= $this->render(
|
||||
'header.php',
|
||||
['directoryAsset' => $directoryAsset]
|
||||
) ?>
|
||||
|
||||
<?= $this->render(
|
||||
'left.php',
|
||||
['directoryAsset' => $directoryAsset]
|
||||
)
|
||||
?>
|
||||
<?= $content ?>
|
||||
|
||||
<?= $this->render(
|
||||
'content.php',
|
||||
['content' => $content, 'directoryAsset' => $directoryAsset]
|
||||
) ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p class="pull-left">© <?= Yii::$app->name ?> <?= Yii::$app->params['version'] ?> Fitness - WebAdmin <?= date('Y') ?></p>
|
||||
|
||||
<p class="pull-right"><?= Yii::powered() ?></p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<?php $this->endBody() ?>
|
||||
</body>
|
||||
</html>
|
||||
<?php $this->endPage() ?>
|
||||
<?php $this->endBody() ?>
|
||||
</body>
|
||||
</html>
|
||||
<?php $this->endPage() ?>
|
||||
<?php } ?>
|
||||
|
||||
@@ -1,27 +1,45 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $name string */
|
||||
/* @var $message string */
|
||||
/* @var $exception Exception */
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
$this->title = $name;
|
||||
?>
|
||||
<div class="site-error">
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<div class="error-page">
|
||||
<h2 class="headline text-info"><i class="fa fa-warning text-yellow"></i></h2>
|
||||
|
||||
<div class="alert alert-danger">
|
||||
<?= nl2br(Html::encode($message)) ?>
|
||||
<div class="error-content">
|
||||
<h3><?= $name ?></h3>
|
||||
|
||||
<p>
|
||||
<?= nl2br(Html::encode($message)) ?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The above error occurred while the Web server was processing your request.
|
||||
Please contact us if you think this is a server error. Thank you.
|
||||
Meanwhile, you may <a href='<?= Yii::$app->homeUrl ?>'>return to dashboard</a> or try using the search
|
||||
form.
|
||||
</p>
|
||||
|
||||
<form class='search-form'>
|
||||
<div class='input-group'>
|
||||
<input type="text" name="search" class='form-control' placeholder="Search"/>
|
||||
|
||||
<div class="input-group-btn">
|
||||
<button type="submit" name="submit" class="btn btn-primary"><i class="fa fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The above error occurred while the Web server was processing your request.
|
||||
</p>
|
||||
<p>
|
||||
Please contact us if you think this is a server error. Thank you.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -2,16 +2,11 @@
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
|
||||
$this->title = 'My Yii Application';
|
||||
$this->title = Yii::$app->name;
|
||||
?>
|
||||
<div class="site-index">
|
||||
|
||||
<div class="jumbotron">
|
||||
<h1>Web Admin</h1>
|
||||
|
||||
<p class="lead">Üdvözöljük adminisztrációs felületünkön</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,35 +1,59 @@
|
||||
<?php
|
||||
use yii\helpers\Html;
|
||||
use yii\bootstrap\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $form yii\bootstrap\ActiveForm */
|
||||
/* @var $model \common\models\LoginForm */
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\bootstrap\ActiveForm;
|
||||
$this->title = 'Bejelentkezés';
|
||||
|
||||
$this->title = Yii::t('common/site' , 'Login');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
$fieldOptions1 = [
|
||||
'options' => ['class' => 'form-group has-feedback'],
|
||||
'inputTemplate' => "{input}<span class='glyphicon glyphicon-envelope form-control-feedback'></span>"
|
||||
];
|
||||
|
||||
$fieldOptions2 = [
|
||||
'options' => ['class' => 'form-group has-feedback'],
|
||||
'inputTemplate' => "{input}<span class='glyphicon glyphicon-lock form-control-feedback'></span>"
|
||||
];
|
||||
?>
|
||||
<div class="site-login">
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p><?php echo Yii::t('common/site' , 'Please fill out the following fields to login:') ?> </p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-5">
|
||||
<?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
|
||||
|
||||
<?= $form->field($model, 'username') ?>
|
||||
|
||||
<?= $form->field($model, 'password')->passwordInput() ?>
|
||||
|
||||
<?= $form->field($model, 'rememberMe')->checkbox() ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton( Yii::t('common/site' ,'Login'), ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="#"><b>Fitness</b>Adminisztráció</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.login-logo -->
|
||||
<div class="login-box-body">
|
||||
<p class="login-box-msg">Kérem jelentkezzen be</p>
|
||||
|
||||
<?php $form = ActiveForm::begin(['id' => 'login-form', 'enableClientValidation' => false]); ?>
|
||||
|
||||
<?= $form
|
||||
->field($model, 'username', $fieldOptions1)
|
||||
->label(false)
|
||||
->textInput(['placeholder' => $model->getAttributeLabel('username')]) ?>
|
||||
|
||||
<?= $form
|
||||
->field($model, 'password', $fieldOptions2)
|
||||
->label(false)
|
||||
->passwordInput(['placeholder' => $model->getAttributeLabel('password')]) ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<?= $form->field($model, 'rememberMe')->checkbox() ?>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<div class="col-xs-6">
|
||||
<?= Html::submitButton('Bejelentkezés', ['class' => 'btn btn-primary btn-block btn-flat', 'name' => 'login-button']) ?>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /.login-box-body -->
|
||||
</div><!-- /.login-box -->
|
||||
|
||||
27
backend/views/site_orig/error.php
Normal file
27
backend/views/site_orig/error.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $name string */
|
||||
/* @var $message string */
|
||||
/* @var $exception Exception */
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
$this->title = $name;
|
||||
?>
|
||||
<div class="site-error">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<div class="alert alert-danger">
|
||||
<?= nl2br(Html::encode($message)) ?>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The above error occurred while the Web server was processing your request.
|
||||
</p>
|
||||
<p>
|
||||
Please contact us if you think this is a server error. Thank you.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
17
backend/views/site_orig/index.php
Normal file
17
backend/views/site_orig/index.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
|
||||
$this->title = Yii::$app->name;
|
||||
?>
|
||||
<div class="site-index">
|
||||
|
||||
<div class="jumbotron">
|
||||
<h1>Web Admin</h1>
|
||||
|
||||
<p class="lead">Üdvözöljük adminisztrációs felületünkön</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
35
backend/views/site_orig/login.php
Normal file
35
backend/views/site_orig/login.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $form yii\bootstrap\ActiveForm */
|
||||
/* @var $model \common\models\LoginForm */
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\bootstrap\ActiveForm;
|
||||
|
||||
$this->title = Yii::t('common/site' , 'Login');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="site-login">
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p><?php echo Yii::t('common/site' , 'Please fill out the following fields to login:') ?> </p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-5">
|
||||
<?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
|
||||
|
||||
<?= $form->field($model, 'username') ?>
|
||||
|
||||
<?= $form->field($model, 'password')->passwordInput() ?>
|
||||
|
||||
<?= $form->field($model, 'rememberMe')->checkbox() ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton( Yii::t('common/site' ,'Login'), ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
72
backend/views/user/role.php
Normal file
72
backend/views/user/role.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\grid\GridView;
|
||||
use yii\data\ArrayDataProvider;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\User */
|
||||
|
||||
$this->title = Yii::t('app', 'Jogosultság szerkesztő');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Felhasználók'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
$availablePermissions = $model->availablePermissions ;
|
||||
|
||||
$permissions = $model->permissions;
|
||||
|
||||
?>
|
||||
<div class="user-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
|
||||
<div class="user-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
|
||||
|
||||
<h3>Engedélyezett jogosultságok</h3>
|
||||
<?php echo GridView::widget([
|
||||
'dataProvider' => new ArrayDataProvider( [
|
||||
'allModels' => $availablePermissions,
|
||||
'sort' => false,
|
||||
'pagination' => false,
|
||||
]),
|
||||
'columns' => [
|
||||
[
|
||||
'class' => 'yii\grid\CheckboxColumn',
|
||||
'name' => (new ReflectionClass( $model->classname() ))->getShortName() . '[permissions]',
|
||||
'checkboxOptions' => function ($model, $key, $index, $column) use ($permissions){
|
||||
$result = [];
|
||||
$result['value'] = $model['name'] ;
|
||||
|
||||
if ( isset($permissions) ){
|
||||
if ( is_array($permissions) ){
|
||||
if ( array_search($model['name'] , $permissions ) !== false){
|
||||
$result['checked'] = 'checked' ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
],
|
||||
[ 'attribute' => 'description' ],
|
||||
],
|
||||
])?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton( Yii::t('app', 'Mentés'), ['class' => 'btn btn-primary' ,'name' => 'RoleForm[save]']) ?>
|
||||
</div>
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user