Advertisement
pmtpenza22

Untitled

Feb 15th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. <?php
  2.  
  3. use yii\helpers\Html;
  4. use yii\widgets\ActiveForm;
  5. use common\models\User;
  6. use mihaildev\ckeditor\CKEditor;
  7. use kartik\file\FileInput;
  8. use yii\web\NotFoundHttpException;
  9. use yii\web\Controller;
  10. use yii\helpers\FileHelper;
  11. use yii\helpers\Url;
  12. use yii\web\UploadedFile;
  13. use \yii\helpers\VarDumper;
  14. use \yii\helpers\ArrayHelper;
  15.  
  16. /* @var $this yii\web\View */
  17. /* @var $model backend\models\Product */
  18. /* @var $form yii\widgets\ActiveForm */
  19. ?>
  20.  
  21. <div class="product-form">
  22.  
  23. <?php $form = ActiveForm::begin([
  24. 'options'=>['enctype'=>'multipart/form-data'],
  25. ]); ?>
  26.  
  27. <?= $form->field($model, 'name')->textInput(['maxlength' => true])?>
  28.  
  29. <?= $form->field($model, 'price_roz')->textInput(['maxlength' => true]) ?>
  30.  
  31. <?= $form->field($model, 'price_opt')->textInput(['maxlength' => true]) ?>
  32.  
  33. <?= $form->field($model, 'category_id')
  34. ->dropDownList(ArrayHelper::map(backend\models\Cat::find()->orderBy('name')->all(), 'id', 'name'), ['prompt'=>'Выбрать категории']) ?>
  35.  
  36. <?php echo $form->field($model, 'status')->dropDownList(User::statuses()) ?>
  37.  
  38. <?php if (!$model->isNewRecord) {
  39. echo \kartik\file\FileInput::widget([
  40. 'name' => 'ImagesManager[attachment]',
  41. 'options'=>[
  42. 'multiple'=>true
  43. ],
  44. 'pluginOptions' => [
  45. 'deleteUrl'=>'http://localhost/mobile-go/backend/web/index.php?r=product/delete-image',
  46. 'initialPreview'=> $model->imagesLinks,
  47. 'initialPreviewAsData'=>true,
  48. 'overwriteInitial'=>false,
  49. 'initialPreviewConfig'=>$model->imagesLinksData,
  50. 'uploadUrl' => 'http://localhost/mobile-go/backend/web/index.php?r=site/save-img',
  51. 'uploadExtraData' => [
  52. 'ImagesManager[class]' => $model->formName(),
  53. 'ImagesManager[product_id]' => $model->id
  54. ],
  55. 'maxFileCount' => 10
  56. ],
  57. 'pluginEvents' => [
  58. 'filesorted' => new \yii\web\JsExpression('function(event, params) {
  59. $.post("'.Url::toRoute(["/product/sort-image",
  60. "id"=>$model->id]).'",{sort: params});
  61. }')
  62. ],
  63. ]);
  64. } ?>
  65.  
  66. <?php if (!$model->isNewRecord) {echo $form->field($model, 'description')->widget(CKEditor::className(),[
  67. 'editorOptions' => [
  68. 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
  69. 'inline' => false, //по умолчанию false
  70. ],
  71. ]); }?>
  72.  
  73. <?php if(!$model->isNewRecord) echo $form->field($model, 'meta_title')->textInput() ?>
  74.  
  75. <?php if(!$model->isNewRecord) echo $form->field($model, 'meta_keyword')->textInput(['maxlength' => true]) ?>
  76.  
  77. <?php if(!$model->isNewRecord) echo $form->field($model, 'meta_description')->textInput(['maxlength' => true]) ?>
  78.  
  79. <?php if(!$model->isNewRecord) echo $form->field($model, 'hit')->checkbox(['0','1']) ?>
  80.  
  81. <?php if(!$model->isNewRecord) echo $form->field($model, 'new')->checkbox(['0','1']) ?>
  82.  
  83. <?php if(!$model->isNewRecord) echo $form->field($model, 'sale')->checkbox(['0','1']) ?>
  84.  
  85. <div class="form-group">
  86. <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
  87. </div>
  88.  
  89. <?php ActiveForm::end(); ?>
  90. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement