return "<a data-pjax='0' href='" . Yii::$app->urlManager->createUrl(['model/attributes/view', 'id' => $model->id]) . "'>{$model->id}</a>"; }, 'options' => ['class' => 'id-column']], ['attribute' => 'name', 'label' => Yii::t('main', 'Name'), 'options' => ['class' => 'name-column']], 'alias', 'description:ntext', ['label' => Yii::t('main', 'Type'), 'format' => 'raw', 'enableSorting' => false, 'value' => function ($model) { return "<a data-pjax='0' href='" . Yii::$app->urlManager->createUrl(['model/attr-types/view', 'id' => $model->attr_type_id]) . "'>{$model->attributeType->name}</a>"; }], ['label' => Yii::t('main', 'Inherited From'), 'format' => 'raw', 'value' => function ($thisModel) use($model) { return $thisModel->fromType !== $model->id ? $thisModel->fromTypeName : ''; }], ['label' => '', 'format' => 'raw', 'value' => function ($model) { return $model->is_system ? '<span class="label label-warning">' . Yii::t('main', 'System') . '</span>' : ''; }]], 'toolbar' => ['items' => [['icon' => 'glyphicon glyphicon-plus', 'url' => ['attributes/create', 'object_type_id' => $model->id], 'title' => Yii::t('main', 'Create')], ['icon' => 'glyphicon glyphicon-pencil', 'title' => Yii::t('main', 'Update'), 'options' => ['data' => ['is-toolbar' => true, 'action' => Yii::$app->urlManager->createUrl(['model/attributes/update', 'object_type_id' => $model->id])]]], ['icon' => 'glyphicon glyphicon-trash', 'title' => Yii::t('main', 'Delete'), 'options' => ['data' => ['is-toolbar' => true, 'multiple' => true, 'action' => Yii::$app->urlManager->createUrl(['model/attributes/delete-multiple']), 'confirm-message' => Yii::t('main', 'Are you sure you want to delete this items?'), 'toolbar_method' => 'post']]], ['kind' => 'separator'], ['icon' => 'fa fa-link', 'title' => Yii::t('main', 'Attach'), 'options' => ['data' => ['toggle' => 'modal', 'target' => '#attribute-explorer-modal']]], ['icon' => 'fa fa-unlink', 'title' => Yii::t('main', 'Detach'), 'options' => ['data' => ['is-toolbar' => true, 'multiple' => true, 'action' => Yii::$app->urlManager->createUrl(['model/object-types/detach-attributes', 'object_type_id' => $model->id]), 'confirm-message' => Yii::t('main', 'Are you sure you want to detach this attributes?'), 'toolbar_method' => 'post']]], ['kind' => 'separator'], ['icon' => 'glyphicon glyphicon-import', 'title' => Yii::t('main', 'Import')], ['icon' => 'glyphicon glyphicon-export', 'title' => Yii::t('main', 'Export')]]]]); ?> <?php echo Table::widget(['dataProvider' => $children, 'title' => Yii::t('main', 'Children'), 'pjax' => true, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'checkboxOptions' => function ($model) { return ['value' => $model->id]; }, 'options' => ['class' => 'checkbox-column']], ['attribute' => 'id', 'label' => Yii::t('main', 'ID'), 'format' => 'raw', 'enableSorting' => false, 'value' => function ($model) { return "<a data-pjax='0' href='" . Yii::$app->urlManager->createUrl(['model/object-types/view', 'id' => $model->id]) . "'>{$model->id}</a>"; }, 'options' => ['class' => 'id-column']], ['attribute' => 'name', 'label' => Yii::t('main', 'Name'), 'format' => 'raw', 'enableSorting' => false, 'value' => function ($model) { return "<a data-pjax='0' href='" . Yii::$app->urlManager->createUrl(['model/object-types/view', 'id' => $model->id]) . "'>{$model->name}</a>"; }, 'options' => ['class' => 'name-column']], ['attribute' => 'description', 'label' => Yii::t('main', 'Description')], ['attribute' => 'alias', 'label' => Yii::t('main', 'Alias')], ['label' => '', 'format' => 'raw', 'value' => function ($model) { return $model->is_system ? '<span class="label label-warning">' . Yii::t('main', 'System') . '</span>' : ''; }]], 'toolbar' => ['items' => [['icon' => 'glyphicon glyphicon-plus', 'url' => ['create', 'parent_id' => $model->id], 'title' => Yii::t('main', 'Create')], ['icon' => 'glyphicon glyphicon-pencil', 'title' => Yii::t('main', 'Update'), 'options' => ['data' => ['is-toolbar' => true, 'action' => Yii::$app->urlManager->createUrl(['model/object-types/update'])]]], ['icon' => 'glyphicon glyphicon-trash', 'title' => Yii::t('main', 'Delete'), 'options' => ['data' => ['is-toolbar' => true, 'multiple' => true, 'action' => Yii::$app->urlManager->createUrl(['model/object-types/delete-multiple']), 'confirm-message' => Yii::t('main', 'Are you sure you want to delete this items?'), 'toolbar_method' => 'post']]], ['kind' => 'separator'], ['icon' => 'glyphicon glyphicon-import', 'title' => Yii::t('main', 'Import')], ['icon' => 'glyphicon glyphicon-export', 'title' => Yii::t('main', 'Export')]]]]); ?> <?php $modalFooter = Html::button(Yii::t('main', 'Close'), ['class' => 'btn btn-default btn-close modal-close']); $modalFooter .= Html::button(Yii::t('main', 'Select'), ['class' => 'btn btn-primary btn-select', 'data' => ['is-toolbar' => true, 'multiple' => true, 'action' => Yii::$app->urlManager->createUrl(['model/object-types/attach-attributes', 'object_type_id' => $model->id]), 'toolbar_method' => 'post']]); Modal::begin(['header' => '<h4>' . Yii::t('main', 'Attach attribute') . '</h4>', 'id' => 'attribute-explorer-modal', 'options' => ['class' => 'attribute-explorer-modal'], 'footer' => $modalFooter]); Pjax::begin(['enablePushState' => false]); // TODO: Get table via ajax echo GridView::widget(['dataProvider' => $attributesDataProvider, 'summary' => '', 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'multiple' => false], 'id', 'name', ['label' => Yii::t('main', 'Type'), 'format' => 'raw', 'enableSorting' => false, 'value' => function ($model) { return $model->attributeType->name; }]]]);
</div> <?php $formHtml = ob_get_clean(); ?> <?php $generalPanel = Panel::widget(['title' => Yii::t('main', 'General'), 'content' => $formHtml, 'options' => ['class' => 'panel panel-success']]); ?> <?php $attachedToPanel = null; if (!empty($attachedTo)) { $attachedToPanel = Table::widget(['title' => Yii::t('main', 'Attached to'), 'dataProvider' => $attachedTo, 'columns' => [['label' => Yii::t('main', 'Object Type'), 'format' => 'raw', 'value' => function ($model) { return "<a data-pjax='0' href='" . Yii::$app->urlManager->createUrl(['model/attributes/update', 'id' => $model->attr_id, 'object_type_id' => $model->object_type_id]) . "'>{$model->objectType->name}</a>"; }], ['label' => '', 'format' => 'raw', 'value' => function ($model) { $multiple = $model->is_multiple ? ' <span class="label label-info">' . Yii::t('main', 'Multiple') . '</span>' : ' '; $readonly = $model->is_readonly ? ' <span class="label label-info">' . Yii::t('main', 'Read only') . '</span>' : ' '; $hidden = $model->is_hidden ? ' <span class="label label-info">' . Yii::t('main', 'Hidden') . '</span>' : ' '; return $multiple . $readonly . $hidden; }]]]); } ?> <?php $attachInfoPanel = null; ?> <?php if (!empty($attachInfo)) { ?> <?php ob_start();
/** * @var yii\web\View $this * @var yii\data\ActiveDataProvider $dataProvider * @var common\models\search\AttributeTypes $searchModel */ $this->title = Yii::t('main', 'Attribute Types'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="attribute-types-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo Table::widget(['dataProvider' => $dataProvider, 'title' => Yii::t('main', 'List'), 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['class' => 'checkbox-column']], ['attribute' => 'id', 'format' => 'raw', 'value' => function ($model) { return "<a data-pjax='0' href='" . Yii::$app->urlManager->createUrl(['model/attr-types/view', 'id' => $model->id]) . "'>{$model->id}</a>"; }, 'options' => ['class' => 'id-column']], ['attribute' => 'name', 'format' => 'raw', 'value' => function ($model) { return "<a data-pjax='0' href='" . Yii::$app->urlManager->createUrl(['model/attr-types/view', 'id' => $model->id]) . "'>{$model->name}</a>"; }, 'options' => ['class' => 'name-column']], 'alias', ['label' => '', 'format' => 'raw', 'value' => function ($model) { return $model->is_system ? '<span class="label label-warning">' . Yii::t('main', 'System') . '</span>' : ''; }]], 'toolbar' => ['items' => [['icon' => 'glyphicon glyphicon-plus', 'url' => ['create'], 'title' => Yii::t('main', 'Create')], ['icon' => 'glyphicon glyphicon-pencil', 'title' => Yii::t('main', 'Update'), 'options' => ['data' => ['is-toolbar' => true, 'action' => Yii::$app->urlManager->createUrl(['model/attr-types/update'])]]], ['icon' => 'glyphicon glyphicon-trash', 'title' => Yii::t('main', 'Delete')], ['kind' => 'separator'], ['icon' => 'glyphicon glyphicon-import', 'title' => Yii::t('main', 'Import')], ['icon' => 'glyphicon glyphicon-export', 'title' => Yii::t('main', 'Export')]]]]); ?> </div>
$this->params['subtitle'] = Yii::t('rbac', 'Roles list'); $this->params['breadcrumbs'] = [$this->title]; $gridId = 'roles-grid'; $gridConfig = ['id' => $gridId, 'dataProvider' => $provider, 'title' => Yii::t('rbac', 'List'), 'columns' => [['class' => CheckboxColumn::classname()], 'name', 'description', 'ruleName', 'data', 'createdAt:date', 'updatedAt:date']]; $boxButtons = $actions = []; $showActions = false; if (Yii::$app->user->can('BCreateRoles')) { $boxButtons[] = '{create}'; } if (Yii::$app->user->can('BUpdateRoles')) { $actions[] = '{update}'; $showActions = $showActions || true; } if (Yii::$app->user->can('BDeleteRoles')) { $boxButtons[] = '{batch-delete}'; $actions[] = '{delete}'; $showActions = $showActions || true; } if ($showActions === true) { $gridConfig['columns'][] = ['class' => ActionColumn::className(), 'template' => implode(' ', $actions)]; } $boxButtons = !empty($boxButtons) ? implode(' ', $boxButtons) : null; ?> <div class="row"> <div class="col-xs-12"> <?php echo Table::widget($gridConfig); ?> </div> </div>