<?php use yii\helpers\Html; use yii\grid\GridView; use backend\modules\banner\models\Banner; /* @var $this yii\web\View */ /* @var $searchModel backend\modules\banner\models\BannerSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('backend', 'Banners'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="box box-primary"> <div class="box-body"> <p> <?php echo Html::a(Yii::t('backend', 'Create Banner'), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'img', 'format' => 'raw', 'value' => function ($model, $key, $index, $column) { return Html::img('/storage/banner/' . $model->img, ['width' => '130px']); }, 'contentOptions' => ['style' => 'width:160px;']], 'name', 'link', 'status', ['attribute' => 'type', 'filter' => Banner::getTypeArray(), 'value' => 'TypeName'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'contentOptions' => ['class' => 'actionColumn'], 'buttonOptions' => ['class' => 'btn btn-sm btn-default', 'style' => 'padding:1px 10px;']]]]); ?> </div> </div>
<div class="box-body"> <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <div class="row"> <div class="col-lg-4 col-md-6"> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'link')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'type')->dropDownlist(Banner::getTypeArray()); ?> <?php echo $form->field($model, 'status')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'img')->fileInput(); ?> <?php if (!$model->isNewRecord) { ?> <img src="<?php echo Yii::$app->params['domainName'] . '/images/' . $model->img; ?> " /> <?php