add backend theme AdminLte, bind reception/transaction to a permission
This commit is contained in:
parent
e13866d7da
commit
bcae71155e
@ -8,6 +8,7 @@ use yii\helpers\Html;
|
|||||||
class AdminMenuStructure{
|
class AdminMenuStructure{
|
||||||
|
|
||||||
public $menuItems;
|
public $menuItems;
|
||||||
|
public $emptyUrl = '#';//maybe null
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->menuItems = [];
|
$this->menuItems = [];
|
||||||
@ -43,7 +44,8 @@ class AdminMenuStructure{
|
|||||||
// Beállítások
|
// Beállítások
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
$items[] = ['label' => 'Felhasználók', 'url' =>['/user/index']];
|
$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
|
'items' => $items
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -57,7 +59,7 @@ class AdminMenuStructure{
|
|||||||
$items[] = ['label' => 'Termék kategóriák', 'url' => ['/product-category/index'] ];
|
$items[] = ['label' => 'Termék kategóriák', 'url' => ['/product-category/index'] ];
|
||||||
$items[] = ['label' => 'Bérlet típusok', 'url' => ['/ticket-type/index'] ];
|
$items[] = ['label' => 'Bérlet típusok', 'url' => ['/ticket-type/index'] ];
|
||||||
// $items[] = ['label' => 'Pénznem', 'url' => ['/currency/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
|
'items' => $items
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -65,10 +67,10 @@ class AdminMenuStructure{
|
|||||||
// BÉRLETEK
|
// BÉRLETEK
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
$items = [];
|
$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érletkártyák', 'url' => ['/card/index'] ];
|
||||||
$items[] = ['label' => 'Bérletek', 'url' => ['/ticket/index' , 'TicketSearch[start]' =>$today,'TicketSearch[end]' => $tomorrow ] ];
|
$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
|
'items' => $items
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -78,7 +80,7 @@ class AdminMenuStructure{
|
|||||||
$items = [];
|
$items = [];
|
||||||
$items[] = ['label' => 'Termékek', 'url' => ['/product/index'] ];
|
$items[] = ['label' => 'Termékek', 'url' => ['/product/index'] ];
|
||||||
$items[] = ['label' => 'Beszerzések', 'url' => ['/procurement/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
|
'items' => $items
|
||||||
];
|
];
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
@ -88,7 +90,7 @@ class AdminMenuStructure{
|
|||||||
$items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index' , 'TransferSearch[start]' =>$today,'TransferSearch[end]' => $tomorrow ] ];
|
$items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index' , 'TransferSearch[start]' =>$today,'TransferSearch[end]' => $tomorrow ] ];
|
||||||
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
|
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
|
||||||
$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$todayDatetime,'CollectionSearch[end]' => $tomorrowDatetime ] ];
|
$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
|
'items' => $items
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -112,7 +114,7 @@ class AdminMenuStructure{
|
|||||||
|
|
||||||
public function run(){
|
public function run(){
|
||||||
$this->addUserMainMenu();
|
$this->addUserMainMenu();
|
||||||
$this->addLoginMainMenu();
|
// $this->addLoginMainMenu();
|
||||||
return $this->menuItems;
|
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 = new LoginForm();
|
||||||
|
$model->roles = [
|
||||||
|
'admin',
|
||||||
|
'employee'
|
||||||
|
];
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->login()) {
|
if ($model->load(Yii::$app->request->post()) && $model->login()) {
|
||||||
return $this->goBack();
|
return $this->goBack();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -30,9 +30,9 @@ class UserController extends \backend\controllers\BackendController
|
|||||||
'rules' => [
|
'rules' => [
|
||||||
// allow authenticated users
|
// allow authenticated users
|
||||||
[
|
[
|
||||||
'actions' => [ 'index','view' ],
|
'actions' => [ 'index','view' ,'role'],
|
||||||
'allow' => true,
|
'allow' => true,
|
||||||
'roles' => ['employee','admin','reception'],
|
'roles' => ['employee','admin' ],
|
||||||
],
|
],
|
||||||
// allow authenticated users
|
// allow authenticated users
|
||||||
[
|
[
|
||||||
@ -177,6 +177,44 @@ class UserController extends \backend\controllers\BackendController
|
|||||||
return $this->redirect(['index']);
|
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.
|
* Finds the User model based on its primary key value.
|
||||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
|||||||
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
|
<?php
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
/* @var $this \yii\web\View */
|
/* @var $this \yii\web\View */
|
||||||
/* @var $content string */
|
/* @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();
|
if (class_exists('backend\assets\AppAsset')) {
|
||||||
$items = $adminMenu->run();
|
backend\assets\AppAsset::register($this);
|
||||||
?>
|
} else {
|
||||||
<?php $this->beginPage() ?>
|
app\assets\AppAsset::register($this);
|
||||||
<!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">
|
dmstr\web\AdminLteAsset::register($this);
|
||||||
<?php
|
|
||||||
NavBar::begin([
|
$directoryAsset = Yii::$app->assetManager->getPublishedUrl('@vendor/almasaeed2010/adminlte/dist');
|
||||||
'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();
|
|
||||||
?>
|
?>
|
||||||
|
<?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">
|
<?= $this->render(
|
||||||
<?= Breadcrumbs::widget([
|
'header.php',
|
||||||
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
|
['directoryAsset' => $directoryAsset]
|
||||||
]) ?>
|
) ?>
|
||||||
<?php //echo Alert::widget() ?>
|
|
||||||
<?php
|
<?= $this->render(
|
||||||
echo AlertBlock::widget([
|
'left.php',
|
||||||
'useSessionFlash' => true,
|
['directoryAsset' => $directoryAsset]
|
||||||
'type' => AlertBlock::TYPE_GROWL,
|
)
|
||||||
'delay' => '1'
|
|
||||||
]);
|
|
||||||
?>
|
?>
|
||||||
<?= $content ?>
|
|
||||||
|
<?= $this->render(
|
||||||
|
'content.php',
|
||||||
|
['content' => $content, 'directoryAsset' => $directoryAsset]
|
||||||
|
) ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class="footer">
|
<?php $this->endBody() ?>
|
||||||
<div class="container">
|
</body>
|
||||||
<p class="pull-left">© <?= Yii::$app->name ?> <?= Yii::$app->params['version'] ?> Fitness - WebAdmin <?= date('Y') ?></p>
|
</html>
|
||||||
|
<?php $this->endPage() ?>
|
||||||
<p class="pull-right"><?= Yii::powered() ?></p>
|
<?php } ?>
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<?php $this->endBody() ?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
<?php $this->endPage() ?>
|
|
||||||
|
|||||||
@ -1,27 +1,45 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $name string */
|
/* @var $name string */
|
||||||
/* @var $message string */
|
/* @var $message string */
|
||||||
/* @var $exception Exception */
|
/* @var $exception Exception */
|
||||||
|
|
||||||
use yii\helpers\Html;
|
|
||||||
|
|
||||||
$this->title = $name;
|
$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">
|
<div class="error-content">
|
||||||
<?= nl2br(Html::encode($message)) ?>
|
<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>
|
</div>
|
||||||
|
|
||||||
<p>
|
</section>
|
||||||
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>
|
|
||||||
|
|||||||
@ -2,16 +2,11 @@
|
|||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
|
|
||||||
$this->title = 'My Yii Application';
|
$this->title = Yii::$app->name;
|
||||||
?>
|
?>
|
||||||
<div class="site-index">
|
<div class="site-index">
|
||||||
|
|
||||||
<div class="jumbotron">
|
<div class="jumbotron">
|
||||||
<h1>Web Admin</h1>
|
<h1>Web Admin</h1>
|
||||||
|
|
||||||
<p class="lead">Üdvözöljük adminisztrációs felületünkön</p>
|
<p class="lead">Üdvözöljük adminisztrációs felületünkön</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,35 +1,59 @@
|
|||||||
<?php
|
<?php
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\bootstrap\ActiveForm;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $form yii\bootstrap\ActiveForm */
|
/* @var $form yii\bootstrap\ActiveForm */
|
||||||
/* @var $model \common\models\LoginForm */
|
/* @var $model \common\models\LoginForm */
|
||||||
|
|
||||||
use yii\helpers\Html;
|
$this->title = 'Bejelentkezés';
|
||||||
use yii\bootstrap\ActiveForm;
|
|
||||||
|
|
||||||
$this->title = Yii::t('common/site' , 'Login');
|
$fieldOptions1 = [
|
||||||
$this->params['breadcrumbs'][] = $this->title;
|
'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="login-box">
|
||||||
|
<div class="login-logo">
|
||||||
<div class="row">
|
<a href="#"><b>Fitness</b>Adminisztráció</a>
|
||||||
<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>
|
||||||
</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>
|
||||||
@ -95,8 +95,8 @@ class Account extends \yii\db\ActiveRecord
|
|||||||
|
|
||||||
static function types() {
|
static function types() {
|
||||||
return [
|
return [
|
||||||
self::TYPE_ALL => Yii::t('common/account', 'Visible for all'),
|
self::TYPE_ALL => Yii::t('common/account', 'Account'),
|
||||||
self::TYPE_VALUE_HIDDEN => Yii::t('common/account', 'Only the name is visible'),
|
// self::TYPE_VALUE_HIDDEN => Yii::t('common/account', 'Only the name is visible'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,8 @@ class LoginForm extends Model
|
|||||||
|
|
||||||
private $_user;
|
private $_user;
|
||||||
|
|
||||||
|
public $roles = null ;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
@ -81,6 +83,20 @@ class LoginForm extends Model
|
|||||||
$this->_user = User::findByUsername($this->username);
|
$this->_user = User::findByUsername($this->username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $this->_user != null ){
|
||||||
|
if ( $this->roles != null ){
|
||||||
|
$canLogin = false;
|
||||||
|
foreach ($this->roles as $role){
|
||||||
|
$canLogin = $canLogin || Yii::$app->authManager->checkAccess($this->_user->id, $role);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !$canLogin ){
|
||||||
|
\Yii::info("user ".$this->_user->username." has no permission to login to administration area!");
|
||||||
|
$this->_user = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->_user;
|
return $this->_user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,6 +27,8 @@ class User extends ActiveRecord implements IdentityInterface
|
|||||||
const STATUS_DELETED = 0;
|
const STATUS_DELETED = 0;
|
||||||
const STATUS_ACTIVE = 10;
|
const STATUS_ACTIVE = 10;
|
||||||
|
|
||||||
|
const ROLE_RECEPTION = 'receptionist';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -23,7 +23,8 @@
|
|||||||
"bower-asset/remarkable-bootstrap-notify": "^3.1",
|
"bower-asset/remarkable-bootstrap-notify": "^3.1",
|
||||||
"yiisoft/yii2-jui": "^2.0",
|
"yiisoft/yii2-jui": "^2.0",
|
||||||
"bower-asset/moment": "^2.10",
|
"bower-asset/moment": "^2.10",
|
||||||
"bower-asset/accounting": "^0.3.2"
|
"bower-asset/accounting": "^0.3.2",
|
||||||
|
"dmstr/yii2-adminlte-asset": "2.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"yiisoft/yii2-codeception": "*",
|
"yiisoft/yii2-codeception": "*",
|
||||||
|
|||||||
230
composer.lock
generated
230
composer.lock
generated
@ -4,9 +4,49 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "eae88fa0f2daec7b60e8779c8881f167",
|
"hash": "48dcd434e58d6b2167477f208c700dc3",
|
||||||
"content-hash": "246d974f7a8d14e65a24bb4d5af20079",
|
"content-hash": "2678695117e871d59f193589465751cf",
|
||||||
"packages": [
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "almasaeed2010/adminlte",
|
||||||
|
"version": "v2.3.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/almasaeed2010/AdminLTE.git",
|
||||||
|
"reference": "1ee281b3b99e8d8cccdc72fb8437c6888149cb46"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/almasaeed2010/AdminLTE/zipball/1ee281b3b99e8d8cccdc72fb8437c6888149cb46",
|
||||||
|
"reference": "1ee281b3b99e8d8cccdc72fb8437c6888149cb46",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Abdullah Almsaeed",
|
||||||
|
"email": "support@almsaeedstudio.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "AdminLTE - admin control panel and dashboard that's based on Bootstrap 3",
|
||||||
|
"homepage": "http://almsaeedstudio.com/",
|
||||||
|
"keywords": [
|
||||||
|
"JS",
|
||||||
|
"admin",
|
||||||
|
"back-end",
|
||||||
|
"css",
|
||||||
|
"less",
|
||||||
|
"responsive",
|
||||||
|
"template",
|
||||||
|
"theme",
|
||||||
|
"web"
|
||||||
|
],
|
||||||
|
"time": "2015-10-23 14:50:49"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "bower-asset/accounting",
|
"name": "bower-asset/accounting",
|
||||||
"version": "v0.3.2",
|
"version": "v0.3.2",
|
||||||
@ -72,6 +112,43 @@
|
|||||||
"web"
|
"web"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "bower-asset/fontawesome",
|
||||||
|
"version": "v4.4.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/FortAwesome/Font-Awesome.git",
|
||||||
|
"reference": "e554555d73a44e0a7d11b0361ad7a5325a5f551c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/FortAwesome/Font-Awesome/zipball/e554555d73a44e0a7d11b0361ad7a5325a5f551c",
|
||||||
|
"reference": "e554555d73a44e0a7d11b0361ad7a5325a5f551c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"type": "bower-asset-library",
|
||||||
|
"extra": {
|
||||||
|
"bower-asset-main": [
|
||||||
|
"less/font-awesome.less",
|
||||||
|
"scss/font-awesome.scss"
|
||||||
|
],
|
||||||
|
"bower-asset-ignore": [
|
||||||
|
"*/.*",
|
||||||
|
"*.json",
|
||||||
|
"src",
|
||||||
|
"*.yml",
|
||||||
|
"Gemfile",
|
||||||
|
"Gemfile.lock",
|
||||||
|
"*.md"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"license": [
|
||||||
|
"OFL-1.1",
|
||||||
|
"MIT",
|
||||||
|
"CC-BY-3.0"
|
||||||
|
],
|
||||||
|
"description": "Font Awesome"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "bower-asset/jquery",
|
"name": "bower-asset/jquery",
|
||||||
"version": "2.1.4",
|
"version": "2.1.4",
|
||||||
@ -390,6 +467,103 @@
|
|||||||
],
|
],
|
||||||
"time": "2015-03-06 05:28:07"
|
"time": "2015-03-06 05:28:07"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "cebe/yii2-gravatar",
|
||||||
|
"version": "1.1",
|
||||||
|
"target-dir": "cebe/gravatar",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/cebe/yii2-gravatar.git",
|
||||||
|
"reference": "c9c01bd14c9bdee9e5ae1ef1aad23f80c182c057"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/cebe/yii2-gravatar/zipball/c9c01bd14c9bdee9e5ae1ef1aad23f80c182c057",
|
||||||
|
"reference": "c9c01bd14c9bdee9e5ae1ef1aad23f80c182c057",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"yiisoft/yii2": "*"
|
||||||
|
},
|
||||||
|
"type": "yii2-extension",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"cebe\\gravatar\\": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Carsten Brandt",
|
||||||
|
"email": "mail@cebe.cc",
|
||||||
|
"homepage": "http://cebe.cc/",
|
||||||
|
"role": "Core framework development"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Gravatar Widget for Yii 2",
|
||||||
|
"keywords": [
|
||||||
|
"gravatar",
|
||||||
|
"yii"
|
||||||
|
],
|
||||||
|
"time": "2013-12-10 17:49:58"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dmstr/yii2-adminlte-asset",
|
||||||
|
"version": "2.2.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/dmstr/yii2-adminlte-asset.git",
|
||||||
|
"reference": "c842a15ceef4e903f70ac927ec3246e6d53e1148"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/dmstr/yii2-adminlte-asset/zipball/c842a15ceef4e903f70ac927ec3246e6d53e1148",
|
||||||
|
"reference": "c842a15ceef4e903f70ac927ec3246e6d53e1148",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"almasaeed2010/adminlte": "~2.0",
|
||||||
|
"cebe/yii2-gravatar": "1.*",
|
||||||
|
"rmrevin/yii2-fontawesome": "~2.9",
|
||||||
|
"yiisoft/yii2": "2.*",
|
||||||
|
"yiisoft/yii2-bootstrap": "2.*"
|
||||||
|
},
|
||||||
|
"type": "yii2-extension",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"dmstr\\": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Tobias Munk",
|
||||||
|
"email": "tobias@diemeisterei.de"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Evgeniy Tkachenko",
|
||||||
|
"email": "et.coder@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Backend theme for Yii2 Framework",
|
||||||
|
"keywords": [
|
||||||
|
"AdminLTE",
|
||||||
|
"extension",
|
||||||
|
"yii2"
|
||||||
|
],
|
||||||
|
"time": "2015-11-06 10:35:36"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "ezyang/htmlpurifier",
|
"name": "ezyang/htmlpurifier",
|
||||||
"version": "v4.6.0",
|
"version": "v4.6.0",
|
||||||
@ -1556,6 +1730,58 @@
|
|||||||
],
|
],
|
||||||
"time": "2014-11-09 19:54:17"
|
"time": "2014-11-09 19:54:17"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "rmrevin/yii2-fontawesome",
|
||||||
|
"version": "2.12.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/rmrevin/yii2-fontawesome.git",
|
||||||
|
"reference": "62308687477734c166753de0ad9e2333dc7dce32"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/rmrevin/yii2-fontawesome/zipball/62308687477734c166753de0ad9e2333dc7dce32",
|
||||||
|
"reference": "62308687477734c166753de0ad9e2333dc7dce32",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"bower-asset/fontawesome": "4.4.*",
|
||||||
|
"php": ">=5.4.0",
|
||||||
|
"yiisoft/yii2": "2.0.*"
|
||||||
|
},
|
||||||
|
"type": "yii2-extension",
|
||||||
|
"extra": {
|
||||||
|
"asset-installer-paths": {
|
||||||
|
"npm-asset-library": "vendor/npm",
|
||||||
|
"bower-asset-library": "vendor/bower"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"rmrevin\\yii\\fontawesome\\": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Revin Roman",
|
||||||
|
"email": "roman@rmrevin.com",
|
||||||
|
"homepage": "https://rmrevin.com/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Asset Bundle for Yii2 with Font Awesome",
|
||||||
|
"keywords": [
|
||||||
|
"asset",
|
||||||
|
"awesome",
|
||||||
|
"bundle",
|
||||||
|
"font",
|
||||||
|
"yii"
|
||||||
|
],
|
||||||
|
"time": "2015-11-20 09:17:45"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "swiftmailer/swiftmailer",
|
"name": "swiftmailer/swiftmailer",
|
||||||
"version": "v5.4.1",
|
"version": "v5.4.1",
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m151123_172500_add_permission_reception_transfers extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$am = Yii::$app->authManager;
|
||||||
|
$permission = $am->createPermission("reception.transfers");
|
||||||
|
$permission->description = "Recepció.Tranzakciók";
|
||||||
|
$am->add($permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -56,17 +56,31 @@ class FrontendMenuStructure{
|
|||||||
|
|
||||||
protected function addRecepcio(){
|
protected function addRecepcio(){
|
||||||
if ( $this->isLogged() ){
|
if ( $this->isLogged() ){
|
||||||
|
|
||||||
|
$isadmin =Yii::$app->user->can('admin') ||Yii::$app->user->can('employee');
|
||||||
|
|
||||||
$this->menuItems[] = ['label' => Yii::t('frontend/customer','Reception'), 'url' => ['/customer/reception'] ];
|
$this->menuItems[] = ['label' => Yii::t('frontend/customer','Reception'), 'url' => ['/customer/reception'] ];
|
||||||
$this->menuItems[] = ['label' => Yii::t('frontend/account', 'Account'),
|
|
||||||
'items' => [
|
$items = [
|
||||||
['label' => Yii::t('frontend/account-state','Default account'), 'url' => ['/account/select'] ],
|
['label' => Yii::t('frontend/account-state','Default account'), 'url' => ['/account/select'] ],
|
||||||
['label' => Yii::t('frontend/account-state', 'Account states'), 'url' => ['/account-state/index'] ],
|
['label' => Yii::t('frontend/account-state', 'Account states'), 'url' => ['/account-state/index'] ],
|
||||||
['label' => Yii::t('frontend/account-state','Open account state'), 'url' => ['/account-state/open'] ],
|
['label' => Yii::t('frontend/account-state','Open account state'), 'url' => ['/account-state/open'] ],
|
||||||
['label' => Yii::t('frontend/account-state','Close account state'), 'url' => ['/account-state/close'] ],
|
['label' => Yii::t('frontend/account-state','Close account state'), 'url' => ['/account-state/close'] ],
|
||||||
['label' => Yii::t('frontend/money-movement','Money movements'), 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ],
|
['label' => Yii::t('frontend/money-movement','Money movements'), 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ],
|
||||||
['label' => Yii::t('frontend/transfer','Transfers'), 'url' => ['/transfer/index', 'TransferSearch[start]' => $this->start, 'TransferSearch[end]' => $this->tomorrow ] ],
|
];
|
||||||
['label' => Yii::t('frontend/collection','Collections'), 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$this->start,'CollectionSearch[end]' => $this->tomorrow ] ]
|
|
||||||
]
|
if ( $isadmin || Yii::$app->user->can('reception.transfers') ){
|
||||||
|
$items[] = ['label' => Yii::t('frontend/transfer','Transfers'), 'url' => ['/transfer/index', 'TransferSearch[start]' => $this->start, 'TransferSearch[end]' => $this->tomorrow ] ];
|
||||||
|
}
|
||||||
|
|
||||||
|
$items[] = ['label' => Yii::t('frontend/collection','Collections'), 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$this->start,'CollectionSearch[end]' => $this->tomorrow ] ];
|
||||||
|
|
||||||
|
$this->menuItems[] = ['label' => Yii::t('frontend/account', 'Account'),
|
||||||
|
'items' => $items
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user