<?php use yii\helpers\Html; use yii\helpers\ArrayHelper; use yii\widgets\DetailView; use common\models\KefuFaq; /* @var $this yii\web\View */ /* @var $model common\models\KefuFaq */ $this->title = $model->title; $this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Kefu Faq'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="kefu-faq-view"> <p> <?php echo Html::a(Yii::t('backend', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t('backend', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('backend', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['title', ['attribute' => 'category_id', 'value' => $model->category ? $model->category->title : null], 'description', 'content:html', 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'status', 'value' => ArrayHelper::getValue(KefuFaq::getStatus(), $model->status)]]]); ?> </div>
use yii\helpers\Html; use yii\helpers\ArrayHelper; use yii\grid\GridView; use common\models\KefuFaq; /* @var $this yii\web\View */ /* @var $searchModel backend\models\search\KefuFaqSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('common', 'Kefu Faq'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="kefu-faq-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('backend', 'Create {modelClass}', ['modelClass' => Yii::t('common', 'Kefu Faq')]), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'title', ['attribute' => 'category_id', 'value' => function ($model) { return $model->category ? $model->category->title : null; }, 'filter' => ArrayHelper::map(\common\models\KefuFaqCat::find()->all(), 'id', 'title')], 'description', ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => KefuFaq::getStatus()], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
echo $form->field($model, 'category_id')->dropDownList(\yii\helpers\ArrayHelper::map($categories, 'id', 'title'), ['prompt' => Yii::t('common', '')]); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'description')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'content')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'status')->radioList(KefuFaq::getStatus()); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>