74 lines
2.2 KiB
PHP
74 lines
2.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
use common\models\CmsCategory;
|
||
|
|
use dosamigos\ckeditor\CKEditor;
|
||
|
|
use dosamigos\selectize\SelectizeTextInput;
|
||
|
|
use kartik\datetime\DateTimePicker;
|
||
|
|
use nickdenry\ckeditorRoxyFileman\RoxyFileManager;
|
||
|
|
use yii\helpers\ArrayHelper;
|
||
|
|
use yii\helpers\Html;
|
||
|
|
use yii\widgets\ActiveForm;
|
||
|
|
|
||
|
|
/* @var $this yii\web\View */
|
||
|
|
/* @var $model common\models\CmsPost */
|
||
|
|
/* @var $form yii\widgets\ActiveForm */
|
||
|
|
?>
|
||
|
|
|
||
|
|
|
||
|
|
<?php $form = ActiveForm::begin(); ?>
|
||
|
|
|
||
|
|
<?= $form->field($model, 'cms_category_id')->dropDownList(ArrayHelper::map(CmsCategory::find()->where(['status' => 1])->orderBy(['name' => SORT_ASC])->all(), 'id', 'name')) ?>
|
||
|
|
|
||
|
|
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||
|
|
|
||
|
|
<?= $form->field($model, 'description')->widget(CKEditor::className(), [
|
||
|
|
'preset' => 'custom',
|
||
|
|
'clientOptions' => RoxyFileManager::attach([
|
||
|
|
'extraPlugins' => 'justify,codesnippet,colorbutton,iframe,dialogadvtab,liststyle,smiley,devtools,div',
|
||
|
|
]),
|
||
|
|
]) ?>
|
||
|
|
|
||
|
|
<?php $this->registerJs("CKEDITOR.config.allowedContent = true;") ?>
|
||
|
|
<?php $this->registerJs("CKEDITOR.config.removeFormatAttributes = '';") ?>
|
||
|
|
|
||
|
|
<?= $form->field($model, 'gallery[]')->fileInput(['multiple' => true]) ?>
|
||
|
|
|
||
|
|
<?php if(!$model->isNewRecord && !empty($model->gallery)){?>
|
||
|
|
<div class="gallery row">
|
||
|
|
<?= $model->getGalleryBackUpdate() ?>
|
||
|
|
</div>
|
||
|
|
<?php }?>
|
||
|
|
|
||
|
|
<?= $form->field($model, 'tags')->widget(SelectizeTextInput::className(), [
|
||
|
|
// calls an action that returns a JSON object with matched
|
||
|
|
// tags
|
||
|
|
'loadUrl' => ['/cms/tag/list'],
|
||
|
|
'options' => ['class' => 'form-control'],
|
||
|
|
'clientOptions' => [
|
||
|
|
'plugins' => ['remove_button'],
|
||
|
|
'valueField' => 'name',
|
||
|
|
'labelField' => 'name',
|
||
|
|
'searchField' => ['name'],
|
||
|
|
'create' => true,
|
||
|
|
],
|
||
|
|
]) ?>
|
||
|
|
|
||
|
|
<?= $form->field($model, 'publish_at')->widget(DateTimePicker::class, [
|
||
|
|
'pluginOptions' => [
|
||
|
|
'format' => 'yyyy-mm-dd hh:ii:00',
|
||
|
|
'autoclose'=>true,
|
||
|
|
'todayHighlight' => true,
|
||
|
|
'todayBtn' => true,
|
||
|
|
]
|
||
|
|
]) ?>
|
||
|
|
|
||
|
|
<?= $form->field($model, 'status')->radioList([0 => 'ไม่เผยแพร่', 1 => 'แผยแพร่']) ?>
|
||
|
|
|
||
|
|
|
||
|
|
<div class="form-group">
|
||
|
|
<?= Html::submitButton('บันทึก', ['class' => 'btn btn-success']) ?>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<?php ActiveForm::end(); ?>
|
||
|
|
|