<?php $form = ActiveForm::begin(); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('maddoger/user', 'Create') : Yii::t('maddoger/user', 'Save'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php echo $form->field($model, 'name')->textInput(['maxlength' => 64]); ?> <?php echo $form->field($model, 'type')->dropDownList(AuthItem::getTypeValues(), ['prompt' => Yii::t('maddoger/user', 'Choose item type')]); ?> <?php echo $form->field($model, 'description')->textarea(['rows' => 2]); ?> <?php $all = AuthItem::find()->select(['name', 'type', 'description'])->orderBy('type, name')->asArray()->all(); $items = [1 => [], 2 => []]; foreach ($all as $ar) { if ($ar['name'] != $model->name) { $items[$ar['type']][$ar['name']] = $ar['description']; } } $items = [Yii::t('maddoger/user', 'Roles') => $items[1], Yii::t('maddoger/user', 'Permissions') => $items[2]];
*/ $this->title = Yii::t('maddoger/user', 'Roles'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="auth-item-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <div> <div class="pull-left"><?php echo Html::a(Yii::t('maddoger/user', 'Create new role'), ['create'], ['class' => 'btn btn-success']); ?> </div> <div class="pull-right"><?php echo Html::a(Yii::t('maddoger/user', 'Update roles from modules'), ['update-from-modules'], ['class' => 'btn btn-primary']); ?> </div> <div class="clearfix"></div> </div> <br /> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'class' => 'grid-view', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'description:ntext', 'name', ['value' => function ($model, $index, $widget) { $values = AuthItem::getTypeValues(); return isset($values[$model->type]) ? $values[$model->type] : null; }, 'filter' => AuthItem::getTypeValues(), 'attribute' => 'type'], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>