public function renderTableRow($model, $key, $index) { $row = parent::renderTableRow($model, $key, $index); $cell = $this->extraRow->renderDataCell($model, $key, $index); $options['data-key'] = is_array($key) ? json_encode($key) : (string) $key; $options['data-key'] .= '-extra'; $options['class'] = 'h'; $row .= PHP_EOL . Html::tag('tr', $cell, $options); return $row; }
<?php use app\widgets\grid\GridView; $detailsLink = function ($model) { return ['label' => __('Edit'), 'href' => Url::to(['/partner/update', 'id' => $model->id])]; }; $columns = [['class' => 'yii\\grid\\CheckboxColumn'], ['class' => 'app\\widgets\\grid\\ImageColumn'], ['attribute' => 'name', 'link' => $detailsLink], 'email:email', 'city', ['attribute' => 'type', 'value' => function ($model, $key, $index, $column) { return $model->getLookupItem('type', $model->type); }], ['attribute' => 'status', 'value' => function ($model, $key, $index, $column) { return $model->getLookupItem('status', $model->status); }], 'created_at:date']; echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => $columns]);
use yii\helpers\Html; use yii\helpers\Url; use app\widgets\grid\GridView; $detailsLink = function ($model) { return ['label' => __('Edit'), 'class' => 'app-modal', 'href' => Url::to(['/donate/update', 'id' => $model->id, '_return_url' => Url::to()]), 'data-target-id' => 'donate_' . $model->id]; }; if (!empty($partnerId)) { $content = Html::a(__('Create donate'), ['/donate/update', 'partner_id' => $partnerId, '_return_url' => Url::to()], ['class' => 'btn btn-success btn-sm app-modal', 'data-target-id' => 'donate_create']); echo Html::tag('div', Html::tag('div', $content, ['class' => 'btn-group']), ['class' => 'pull-right']); } $columns = [['class' => 'yii\\grid\\CheckboxColumn'], ['attribute' => 'timestamp', 'format' => 'date', 'link' => $detailsLink], 'partner' => ['attribute' => 'partner', 'value' => 'partner.extendedName', 'link' => function ($model) { if ($model->partner_id && Yii::$app->user->can('partner_view')) { return Url::to(['partner/update', 'id' => $model->partner_id]); } }], 'user' => ['attribute' => 'user', 'value' => 'user.name', 'link' => function ($model) { if ($model->user_id && Yii::$app->user->can('user_view')) { return Url::to(['user/update', 'id' => $model->user_id]); } }], 'sum' => ['attribute' => 'sum', 'value' => function ($model, $key, $index, $column) { return Yii::$app->formatter->asDecimal($model->sum) . ' руб.'; }], ['class' => 'app\\widgets\\grid\\ActionColumn', 'size' => 'xs', 'items' => [$detailsLink, function ($model) { if (Yii::$app->user->can('donate_manage')) { return ['label' => __('Delete'), 'href' => Url::to(['donate/delete', 'id' => $model->id, '_return_url' => Url::to()]), 'data-method' => 'post', 'data-confirm' => __('Are you sure you want to delete this item?')]; } }]]]; if (!empty($partnerId)) { unset($columns['partner']); } echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => $columns, 'ajaxPager' => !empty($partnerId)]);
echo ActionsDropdown::widget(['layout' => 'info', 'items' => [['label' => __('Delete'), 'url' => Url::to(['delete']), 'linkOptions' => ['data-app-process-items' => 'ids', 'data-confirm' => __('Are you sure you want to delete this item?'), 'data-method' => 'post']]]]); ?> </div> <?php } ?> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('components/search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], ['attribute' => 'name', 'link' => $detailsLink], ['attribute' => 'format', 'value' => function ($model, $key, $index, $column) { return $model->getLookupItem('format', $model->format); }], ['attribute' => 'status', 'value' => function ($model, $key, $index, $column) { return $model->getLookupItem('status', $model->status); }], 'updated_at:date', ['class' => 'app\\widgets\\grid\\CounterColumn', 'label' => __('Mailing lists'), 'countField' => 'mailingListsCount'], ['class' => 'app\\widgets\\grid\\ActionColumn', 'size' => 'xs', 'items' => [$detailsLink, function ($model) { if (Yii::$app->user->can('newsletter_manage')) { return ['label' => __('Delete'), 'href' => Url::to(['print-template/delete', 'id' => $model->id, '_return_url' => Url::to()]), 'data-method' => 'post', 'data-confirm' => __('Are you sure you want to delete this item?')]; } }]]]]); ?> </div>
<div class="btn-group"> <?php echo Html::a(__('Create state'), ['update', '_return_url' => Url::to()], ['class' => 'btn btn-success app-modal', 'data-target-id' => 'state_create']); ?> </div> <?php echo ActionsDropdown::widget(['layout' => 'info', 'items' => [['label' => __('Delete'), 'url' => Url::to(['delete']), 'linkOptions' => ['data-app-process-items' => 'ids', 'data-confirm' => __('Are you sure you want to delete this item?'), 'data-method' => 'post']]]]); ?> </div> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('components/search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], ['attribute' => 'name', 'link' => $detailsLink], ['attribute' => 'country.name', 'label' => __('Country'), 'link' => function ($model) { return ['class' => 'app-modal', 'href' => Url::to(['/country/update', 'id' => $model->country_id, '_return_url' => Url::to()]), 'data-target-id' => 'country_' . $model->country_id]; }], 'code', ['class' => 'app\\widgets\\grid\\ActionColumn', 'size' => 'xs', 'items' => [$detailsLink, function ($model) { if (Yii::$app->user->can('state_manage')) { return ['label' => __('Delete'), 'href' => Url::to(['state/delete', 'id' => $model->id, '_return_url' => Url::to()]), 'data-method' => 'post', 'data-confirm' => __('Are you sure you want to delete this item?')]; } }]]]]); ?> </div>
use yii\helpers\Html; use yii\helpers\Url; use app\widgets\grid\GridView; use app\widgets\ActionsDropdown; $this->title = Yii::t('app', 'Stores'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="store-index"> <div class="pull-right"> <?php echo ActionsDropdown::widget(['layout' => 'info', 'items' => [['label' => __('Send admin notification'), 'url' => Url::to(['admin-notification']), 'linkOptions' => ['data-c-process-items' => 'ids']], ['label' => __('Delete selected'), 'url' => Url::to(['delete']), 'linkOptions' => ['data-c-process-items' => 'ids', 'data-confirm' => __('Are you sure you want to delete selected items?'), 'data-method' => 'post']]]]); ?> </div> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('components/search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], 'id', 'domain', 'created_at:datetime', 'updated_at:datetime', ['class' => 'app\\widgets\\grid\\ActionColumn', 'size' => 'xs', 'extraItems' => [['action' => 'admin-notification', 'idField' => 'ids', 'label' => __('Send admin notification')]]]]]); ?> </div>
echo Html::a(__('Create user role'), ['update', '_return_url' => Url::to()], ['class' => 'btn btn-success app-modal', 'data-target-id' => 'user-role_create']); ?> </div> <?php echo ActionsDropdown::widget(['layout' => 'info', 'items' => [['label' => __('Delete selected'), 'url' => Url::to(['delete']), 'linkOptions' => ['data-app-process-items' => 'id', 'data-confirm' => __('Are you sure you want to delete this item?'), 'data-method' => 'post']]]]); ?> </div> <?php } ?> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], ['attribute' => 'description', 'label' => __('Name'), 'link' => $detailsLink], ['class' => 'app\\widgets\\grid\\CounterColumn', 'label' => __('Users'), 'count' => function ($model) { return count(Yii::$app->authManager->getUserIdsByRole($model['name'])); }, 'link' => function ($model) { return Url::to(['user/index', 'user_role_id' => $model['name']]); }], ['class' => 'app\\widgets\\grid\\ActionColumn', 'size' => 'xs', 'items' => [$detailsLink, function ($model) { if (Yii::$app->user->can('user_manage')) { return ['label' => __('Delete'), 'href' => Url::to(['user-role/delete', 'id' => $model['id'], '_return_url' => Url::to()]), 'data-method' => 'post', 'data-confirm' => __('Are you sure you want to delete this item?')]; } }]]]]); ?> </div>
echo Html::a(__('Create newsletter'), ['create'], ['class' => 'btn btn-success']); ?> </div> <?php echo ActionsDropdown::widget(['layout' => 'info', 'items' => [['label' => __('Delete'), 'url' => Url::to(['delete']), 'linkOptions' => ['data-app-process-items' => 'ids', 'data-confirm' => __('Are you sure you want to delete this item?'), 'data-method' => 'post']]]]); ?> </div> <?php } ?> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('components/search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], ['attribute' => 'subject', 'link' => $detailsLink], 'created_at:date', 'updated_at:date', ['class' => 'app\\widgets\\grid\\CounterColumn', 'label' => __('Mailing lists'), 'countField' => 'mailingListsCount'], ['class' => 'app\\widgets\\grid\\CounterColumn', 'label' => __('Logs'), 'countField' => 'logsCount'], ['class' => 'app\\widgets\\grid\\ActionColumn', 'size' => 'xs', 'items' => [$detailsLink, function ($model) { if (Yii::$app->user->can('newsletter_manage')) { return ['label' => __('Delete'), 'href' => Url::to(['newsletter/delete', 'id' => $model->id, '_return_url' => Url::to()]), 'data-method' => 'post', 'data-confirm' => __('Are you sure you want to delete this item?')]; } }]]]]); ?> </div>
</div> <?php } ?> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('components/search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], ['attribute' => 'name', 'link' => $detailsLink], 'email', ['attribute' => 'status', 'value' => function ($model, $key, $index, $column) { return $model->getLookupItem('status', $model->status); }], ['class' => 'app\\widgets\\grid\\ActionColumn', 'size' => 'xs', 'items' => [$detailsLink, function ($model) { if (Yii::$app->user->can('user_manage')) { return ['label' => __('Delete'), 'href' => Url::to(['user/delete', 'id' => $model->id, '_return_url' => Url::to()]), 'data-method' => 'post', 'data-confirm' => __('Are you sure you want to delete this item?')]; } }, function ($model) { if (Yii::$app->user->can('user_act_on_behalf')) { return ['label' => __('Act on behalf of'), 'href' => Url::to(['user/act-on-behalf', 'id' => $model->id]), 'data-method' => 'post']; } }]]]]); ?> </div>
$this->title = Yii::t('app', 'Users'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="user-index"> <div class="pull-right"> <div class="btn-group"> <?php echo Html::a(Yii::t('app', 'Create user'), ['create'], ['class' => 'btn btn-success']); ?> </div> <?php echo ActionsDropdown::widget(['layout' => 'info', 'items' => [['label' => __('Delete selected'), 'url' => Url::to(['delete']), 'linkOptions' => ['data-c-process-items' => 'ids', 'data-confirm' => __('Are you sure you want to delete selected items?'), 'data-method' => 'post']]]]); ?> </div> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('components/search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], 'id', 'username', 'email:email', 'fullname', ['class' => 'app\\widgets\\grid\\ActionColumn', 'size' => 'xs']]]); ?> </div>