$this->title = Yii::t('storecube', 'PAGE_PRODUCTS'); $this->params['breadcrumbs'][] = $this->title; ?> <?php $gridId = 'products-grid'; $panelButtons = $actions = []; if (Yii::$app->user->can('ACPProductsCreate')) { $panelButtons[] = '{create}'; } if (Yii::$app->user->can('ACPProductsUpdate')) { $actions[] = '{update}'; } if (Yii::$app->user->can('ACPProductsDelete')) { $panelButtons[] = '{mass-delete}'; $actions[] = '{delete}'; } if (Yii::$app->user->can('ACPProductsView')) { $actions[] = '{view}'; } $gridActionsColumn = ['class' => ActionColumn::className(), 'template' => implode(' ', $actions)]; $panelButtons = !empty($panelButtons) ? implode(' ', $panelButtons) : null; ?> <?php Panel::begin(['title' => $this->title, 'buttonsTemplate' => $panelButtons, 'grid' => $gridId]); ?> <?php echo GridView::widget(['id' => $gridId, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::classname()], 'article', 'name', 'short_desc:ntext', $gridActionsColumn], 'pager' => ['firstPageLabel' => 'First', 'lastPageLabel' => 'Last']]); Panel::end();
<?php use yii\widgets\DetailView; use cubiclab\store\StoreCube; use cubiclab\admin\widgets\Panel; $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => StoreCube::t('storecube', 'PAGE_CATEGORIES'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $panelButtons = []; if (Yii::$app->user->can('ACPCategoriesUpdate')) { $panelButtons[] = '{update}'; } if (Yii::$app->user->can('ACPCategoriesDelete')) { $panelButtons[] = '{delete}'; } $panelButtons = !empty($panelButtons) ? implode(' ', $panelButtons) : null; Panel::begin(['title' => StoreCube::t('storecube', 'PAGE_CATEGORIES') . ': ' . $this->title, 'buttonsTemplate' => $panelButtons]); echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'parent', 'name', 'slug', 'description:ntext', 'icon', 'status', 'order']]); Panel::end();
use yii\helpers\Html; use yii\widgets\DetailView; use cubiclab\project\scripts\BreadcrumbTraceHelper; use cubiclab\admin\widgets\Panel; /* @var $this yii\web\View */ /* @var $model app\modules\cubicProject\models\Projects */ $this->title = $model->name; BreadcrumbTraceHelper::bct_getBreadcrumbTrace($model, $trace); $this->params['breadcrumbs'] = $trace; //$this->params['breadcrumbs'][] = ['label' => 'Projects', 'url' => ['projectview', 'id'=>$model->id, ]]; //$this->params['breadcrumbs'][] = $this->title; ?> <?php Panel::begin(['title' => $this->title, 'headStyle' => Panel::WARNING, 'fullColor' => true]); ?> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a('Update', ['projectupdate', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('Delete', ['projectdelete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]); ?> </p>
<?php use yii\helpers\Html; use cubiclab\store\StoreCube; use cubiclab\admin\widgets\Panel; $this->title = StoreCube::t('storecube', 'PAGE_CREATE_PRICE_TYPES'); $this->params['breadcrumbs'][] = ['label' => StoreCube::t('storecube', 'PAGE_PRICE_TYPES'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; Panel::begin(['title' => $this->title]); echo $this->render('_form', ['model' => $model, 'currencyCodeArray' => $currencyCodeArray, 'currencySymbolArray' => $currencySymbolArray, 'statusArray' => $statusArray]); Panel::end();
/** * Created by PhpStorm. * User: pt1c * Date: 25.08.2015 * Time: 8:17 */ use yii\data\ArrayDataProvider; use yii\grid\GridView; use yii\grid\DataColumn; use yii\helpers\Url; use yii\helpers\Html; use yii\helpers\ArrayHelper; use cubiclab\admin\widgets\Panel; use yii\grid\ActionColumn; $this->title = Yii::t('userscube', 'PAGE_ROLE_MANAGMENT'); $this->params['breadcrumbs'][] = $this->title; $boxButtons[] = '{create}'; $boxButtons = !empty($boxButtons) ? implode(' ', $boxButtons) : null; //Html::a('Добавить роль', ['add-role'], ['class' => 'btn btn-success']) $buttons['create'] = ['url' => 'add-role']; Panel::begin(['title' => $this->title, 'buttons' => $buttons, 'buttonsTemplate' => $boxButtons]); $dataProvider = new ArrayDataProvider(['allModels' => Yii::$app->authManager->getRoles(), 'sort' => ['attributes' => ['name', 'description']], 'pagination' => ['pageSize' => 10]]); echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => DataColumn::className(), 'attribute' => 'name', 'label' => 'Роль'], ['class' => DataColumn::className(), 'attribute' => 'description', 'label' => 'Описание'], ['class' => DataColumn::className(), 'label' => 'Разрешенные доступы', 'format' => ['html'], 'value' => function ($data) { return implode('<br>', array_keys(ArrayHelper::map(Yii::$app->authManager->getPermissionsByRole($data->name), 'description', 'description'))); }], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'max-width: 21px;'], 'template' => '{update} {delete}', 'buttons' => ['update' => function ($url, $model) { return Html::a('<span class="fa fa-pencil"></span>', Url::toRoute(['update-role', 'name' => $model->name]), ['title' => Yii::t('yii', 'Update'), 'class' => 'btn btn-xs btn-success', 'data-pjax' => '0']); }, 'delete' => function ($url, $model) { return Html::a('<span class="fa fa-trash"></span>', Url::toRoute(['delete-role', 'name' => $model->name]), ['title' => Yii::t('yii', 'Delete'), 'class' => 'btn btn-xs btn-success', 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0']); }]]]]); Panel::end();