This commit is contained in:
2020-02-01 16:47:12 +07:00
commit 4c619ad6e6
16739 changed files with 3329179 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model yii2mod\rbac\models\AuthItemModel */
?>
<div class="auth-item-form">
<?php $form = ActiveForm::begin(); ?>
<?php echo $form->field($model, 'name')->textInput(['maxlength' => 64]); ?>
<?php echo $form->field($model, 'description')->textarea(['rows' => 2]); ?>
<?php echo $form->field($model, 'ruleName')->widget('yii\jui\AutoComplete', [
'options' => [
'class' => 'form-control',
],
'clientOptions' => [
'source' => array_keys(Yii::$app->authManager->getRules()),
],
]);
?>
<?php echo $form->field($model, 'data')->textarea(['rows' => 6]); ?>
<div class="form-group">
<?php echo Html::submitButton($model->getIsNewRecord() ? Yii::t('yii2mod.rbac', 'Create') : Yii::t('yii2mod.rbac', 'Update'), ['class' => $model->getIsNewRecord() ? 'btn btn-success' : 'btn btn-primary']); ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -0,0 +1,19 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model \yii2mod\rbac\models\AuthItemModel */
$labels = $this->context->getLabels();
$this->title = Yii::t('yii2mod.rbac', 'Create ' . $labels['Item']);
$this->params['breadcrumbs'][] = ['label' => Yii::t('yii2mod.rbac', $labels['Items']), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$this->render('/layouts/_sidebar');
?>
<div class="auth-item-create">
<h1><?php echo Html::encode($this->title); ?></h1>
<?php echo $this->render('_form', [
'model' => $model,
]); ?>
</div>

View File

@@ -0,0 +1,52 @@
<?php
use yii\grid\GridView;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $dataProvider \yii\data\ArrayDataProvider */
/* @var $searchModel \yii2mod\rbac\models\search\AuthItemSearch */
$labels = $this->context->getLabels();
$this->title = Yii::t('yii2mod.rbac', $labels['Items']);
$this->params['breadcrumbs'][] = $this->title;
$this->render('/layouts/_sidebar');
?>
<div class="item-index">
<h1><?php echo Html::encode($this->title); ?></h1>
<p>
<?php echo Html::a(Yii::t('yii2mod.rbac', 'Create ' . $labels['Item']), ['create'], ['class' => 'btn btn-success']); ?>
</p>
<?php Pjax::begin(['timeout' => 5000, 'enablePushState' => false]); ?>
<?php echo GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'name',
'label' => Yii::t('yii2mod.rbac', 'Name'),
],
[
'attribute' => 'ruleName',
'label' => Yii::t('yii2mod.rbac', 'Rule Name'),
'filter' => ArrayHelper::map(Yii::$app->getAuthManager()->getRules(), 'name', 'name'),
'filterInputOptions' => ['class' => 'form-control', 'prompt' => Yii::t('yii2mod.rbac', 'Select Rule')],
],
[
'attribute' => 'description',
'format' => 'ntext',
'label' => Yii::t('yii2mod.rbac', 'Description'),
],
[
'header' => Yii::t('yii2mod.rbac', 'Action'),
'class' => 'yii\grid\ActionColumn',
],
],
]); ?>
<?php Pjax::end(); ?>
</div>

View File

@@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model \yii2mod\rbac\models\AuthItemModel */
$context = $this->context;
$labels = $this->context->getLabels();
$this->title = Yii::t('yii2mod.rbac', 'Update ' . $labels['Item'] . ' : {0}', $model->name);
$this->params['breadcrumbs'][] = ['label' => Yii::t('yii2mod.rbac', $labels['Items']), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->name]];
$this->params['breadcrumbs'][] = Yii::t('yii2mod.rbac', 'Update');
$this->render('/layouts/_sidebar');
?>
<div class="auth-item-update">
<h1><?php echo Html::encode($this->title); ?></h1>
<?php echo $this->render('_form', [
'model' => $model,
]); ?>
</div>

View File

@@ -0,0 +1,50 @@
<?php
use yii\helpers\Html;
use yii\helpers\Json;
use yii\widgets\DetailView;
use yii2mod\rbac\RbacAsset;
RbacAsset::register($this);
/* @var $this yii\web\View */
/* @var $model \yii2mod\rbac\models\AuthItemModel */
$labels = $this->context->getLabels();
$this->title = Yii::t('yii2mod.rbac', $labels['Item'] . ' : {0}', $model->name);
$this->params['breadcrumbs'][] = ['label' => Yii::t('yii2mod.rbac', $labels['Items']), 'url' => ['index']];
$this->params['breadcrumbs'][] = $model->name;
$this->render('/layouts/_sidebar');
?>
<div class="auth-item-view">
<h1><?php echo Html::encode($this->title); ?></h1>
<p>
<?php echo Html::a(Yii::t('yii2mod.rbac', 'Update'), ['update', 'id' => $model->name], ['class' => 'btn btn-primary']); ?>
<?php echo Html::a(Yii::t('yii2mod.rbac', 'Delete'), ['delete', 'id' => $model->name], [
'class' => 'btn btn-danger',
'data-confirm' => Yii::t('yii2mod.rbac', 'Are you sure to delete this item?'),
'data-method' => 'post',
]); ?>
<?php echo Html::a(Yii::t('yii2mod.rbac', 'Create'), ['create'], ['class' => 'btn btn-success']); ?>
</p>
<div class="row">
<div class="col-sm-12">
<?php echo DetailView::widget([
'model' => $model,
'attributes' => [
'name',
'description:ntext',
'ruleName',
'data:ntext',
],
]); ?>
</div>
</div>
<?php echo $this->render('../_dualListBox', [
'opts' => Json::htmlEncode([
'items' => $model->getItems(),
]),
'assignUrl' => ['assign', 'id' => $model->name],
'removeUrl' => ['remove', 'id' => $model->name],
]); ?>
</div>