pmtpenza22

Untitled

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