<?php use yii\grid\GridView; use yii\helpers\Url; use yii\widgets\Pjax; /** * @var $id * @var yii\web\View $this * @var yii\data\ActiveDataProvider $dataProvider * @var app\modules\seo\models\Redirect $searchModel */ ?> <?php Pjax::begin(); ?> <?php echo GridView::widget(['id' => $id, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'layout' => "{items}\n{summary}\n{pager}", 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['width' => '10px']], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'id', 'options' => ['width' => '60px']], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'type', 'filter' => \app\modules\seo\models\Redirect::getTypes()], 'from', 'to', ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'active', 'filter' => [0 => 'false', 1 => 'true']], ['class' => 'app\\backend\\components\\ActionColumn', 'urlCreator' => function ($action, $model, $key, $index) { $params = is_array($key) ? $key : ['id' => (string) $key]; $action .= '-redirect'; $params[0] = $this->context->id ? $this->context->id . '/' . $action : $action; $params['returnUrl'] = \app\backend\components\Helper::getReturnUrl(); return Url::toRoute($params); }, 'options' => ['width' => '95px'], 'buttons' => [['url' => 'update', 'icon' => 'pencil', 'class' => 'btn-primary', 'label' => Yii::t('app', 'Edit')], ['url' => 'delete', 'icon' => 'trash-o', 'class' => 'btn-danger', 'label' => Yii::t('app', 'Delete')]]]], 'tableOptions' => ['class' => 'table table-striped table-condensed table-hover']]); ?> <?php Pjax::end();
$this->endBlock('submit'); ?> <div class="redirect-form"> <?php $form = ActiveForm::begin(['id' => 'redirect-form']); ?> <?php echo $model->isNewRecord ? '' : $form->field($model, 'id')->textInput(['disabled' => 'disabled']); ?> <?php echo $form->field($model, 'type')->dropDownList(\app\modules\seo\models\Redirect::getTypes()); ?> <?php echo $form->field($model, 'from')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'to')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'active')->checkbox([0 => 'false', 1 => 'true']); ?> <?php