<div class="faq-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'faq_title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'faq_text')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['lang' => Yii::$app->controller->module->imperaviLanguage, 'minHeight' => 200, 'paragraphize' => false, 'cleanOnPaste' => false, 'replaceDivs' => false, 'linebreaks' => false, 'plugins' => ['fullscreen', 'imagemanager'], 'imageUpload' => Url::to(['/faq/default/image-upload']), 'imageManagerJson' => Url::to(['/faq/default/images-get'])]]); ?> <?php echo $form->field($model, 'faq_show_on_main')->dropDownList(Faq::getVisibleOnMain()); ?> <?php echo $form->field($model, 'faq_language')->dropDownList([Yii::$app->language => Yii::$app->language]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Module::t('faq', 'Create') : Module::t('faq', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
use vladkukushkin\faq\models\Faq; use vladkukushkin\faq\Module; /* @var $this yii\web\View */ /* @var $searchModel vladkukushkin\faq\models\search\FaqSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Module::t('faq', 'FREQUENTLY_ASKED_QUESTIONS'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="faq-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Module::t('faq', 'Create'), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'faq_id', 'faq_title', ['attribute' => 'faq_text', 'format' => 'raw'], ['attribute' => 'faq_show_on_main', 'value' => function ($model) { return Faq::getVisibleOnMain()[$model->faq_show_on_main]; }, 'filter' => Faq::getVisibleOnMain()], ['attribute' => 'faq_language', 'filter' => Faq::getLanguageFilter()], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
use yii\widgets\DetailView; use vladkukushkin\faq\models\Faq; use vladkukushkin\faq\Module; /* @var $this yii\web\View */ /* @var $model vladkukushkin\faq\models\Faq */ $this->title = $model->faq_title; $this->params['breadcrumbs'][] = ['label' => Module::t('faq', 'FREQUENTLY_ASKED_QUESTIONS'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="faq-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Module::t('faq', 'Update'), ['update', 'id' => $model->faq_id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Module::t('faq', 'Delete'), ['delete', 'id' => $model->faq_id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['faq_id', 'faq_title', ['attribute' => 'faq_text', 'format' => 'raw'], ['attribute' => 'faq_show_on_main', 'value' => Faq::getVisibleOnMain()[$model->faq_show_on_main]], 'faq_language']]); ?> </div>