- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
/******** Model **********/
$model = new CreateArticleForm();
if ($model->load(Yii::$app->request->post())) {
if ($model->create()) {
Yii::$app->session->setFlash('success', [
'type' => 'success',
'duration' => 0,
'icon' => 'fa fa-users',
'message' => 'Success created.',
'title' => 'Change password',
]);
} else {
Yii::$app->session->setFlash('danger', [
'type' => 'danger',
'duration' => 0,
'icon' => 'fa fa-users',
'message' => 'Error created.',
'title' => 'Change password',
]);
}
} else {
return $this->render('create-article',
[
'language_current' => $language_current,
'page' => $page,
'model' => $model,
]);
}
/******** View **********/
<?php Pjax::begin(['id' => 'my-pjax']); ?>
<?php $form = ActiveForm::begin(['id' => 'form-change-pass', 'options' => ['enctype' => 'multipart/form-data', 'data-pjax' => true]]); ?>
<?= $form->field($model, 'title')->textInput(['autofocus' => true, 'class' => 'form-control']) ?>
<label for="usr">Категория</label>
<div class="bs-docs-example">
<?= Html::activeDropDownList($model, 'id_category',
ArrayHelper::map(\common\models\Category::find()->all(), 'id', 'name'),
['class' => 'selectpicker dropdownlist form-control',
'data-width' => '100%',
'multiple' => 'true']) ?>
</div>
<?= $form->field($model, 'text', ['inputOptions' => ['class' => 'summernote form-control']])->textarea(['rows' => 6]) ?>
<?= Html::input('submit', '0', Yii::t('menu', 'form_submit')); ?>
<?php ActiveForm::end(); ?>
<?php Pjax::end(); ?>