Advertisement
pmtpenza22

Untitled

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