Initial commit,修正
This commit is contained in:
Executable
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\AuthItemChild */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="auth-item-child-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'parent')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'child')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\AuthItemChild */
|
||||
|
||||
$this->title = 'Create Auth Item Child';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Auth Item Children', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="auth-item-child-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = 'Auth Item Children';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="auth-item-child-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Create Auth Item Child', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'parent',
|
||||
'child',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
]); ?>
|
||||
</div>
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\helpers\Url;
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\AuthItemChild */
|
||||
|
||||
$this->title = '配置权限';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Auth Item Children', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="ibox-content">
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<hr>
|
||||
<form action="<?=Url::toRoute(['permission/set','id'=>$id])?>" method="post">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<?php foreach($menu as $vo):?>
|
||||
<div class="col-sm-12 permission-block">
|
||||
<div class="ibox-permission">
|
||||
<h3><?= $vo->name?></h3>
|
||||
<hr>
|
||||
<input name="parent" type="hidden" value="<?=$id?>">
|
||||
<!--<label><input type="checkbox" class="chkall" name="checkall" value="1">全选</label> -->
|
||||
|
||||
<?php foreach($items as $v):?>
|
||||
<?php if($vo['id'] == $v->permissionName['parent']):?>
|
||||
<?php if($id == '超级管理员'):?>
|
||||
<label><input type="checkbox" class="chk" disabled name="permission[]" value="<?=$v->name?>"><?=($v->permissionName['name'] ==''? $v->name : $v->permissionName['name'])?></label>
|
||||
<?php else:?>
|
||||
<label><input type="checkbox" class="chk" name="permission[]" value="<?=$v->name?>"><?=($v->permissionName['name'] ==''? $v->name : $v->permissionName['name'])?></label>
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div class="clear"></div>
|
||||
<input type="submit" value="保存" class="btn btn-primary">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
var num = 0;
|
||||
var permission = <?= json_encode($Permission);?>;
|
||||
$('.chk').each(function(){
|
||||
var self = $(this);
|
||||
var selfVal = self.val();
|
||||
$.each(permission, function(n, v){
|
||||
if(v.name == selfVal){
|
||||
self.attr('checked' , 'true');
|
||||
num++;
|
||||
};
|
||||
});
|
||||
});
|
||||
var nums = $('.chk').size(); //全选勾中
|
||||
if(nums == num){
|
||||
$('.chkall').attr("checked",true);
|
||||
}
|
||||
|
||||
$(".chkall").click(function(){
|
||||
var isChecked = $(this).prop("checked");
|
||||
$("input[name='permission[]']").prop("checked", isChecked);
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\AuthItemChild */
|
||||
|
||||
$this->title = 'Update Auth Item Child: ' . ' ' . $model->parent;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Auth Item Children', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->parent, 'url' => ['view', 'parent' => $model->parent, 'child' => $model->child]];
|
||||
$this->params['breadcrumbs'][] = 'Update';
|
||||
?>
|
||||
<div class="auth-item-child-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\AuthItemChild */
|
||||
|
||||
$this->title = $model->parent;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Auth Item Children', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="auth-item-child-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Update', ['update', 'parent' => $model->parent, 'child' => $model->child], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Delete', ['delete', 'parent' => $model->parent, 'child' => $model->child], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => 'Are you sure you want to delete this item?',
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'parent',
|
||||
'child',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user