formStory.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\widgets\ActiveForm;
  4. use kartik\datetime\DateTimePicker;
  5. $form = ActiveForm::begin([
  6. 'id' => 'story-form',
  7. 'options' => ['class' => 'form-horizontal', 'enctype' => 'multipart/form-data']]);
  8. ?>
  9. <input type="hidden" name="Story[id]" value="<?=$model->id?>">
  10. <input type="hidden" name="Story[ext]" value="<?=$model->ext?>">
  11. <?
  12. if($model->id){
  13. $imageSrc = "/story-images/".$model->id."_sizehd.jpg";
  14. }
  15. echo @app\components\admin\uploadcrop\UploadCrop::widget(
  16. [
  17. 'form' => $form,
  18. 'model' => $model,
  19. 'attribute' => 'photo',
  20. 'maxSize' => 3000,
  21. 'imageSrc' => (isset($imageSrc)) ? $imageSrc : '',
  22. 'title' => 'Фото',
  23. 'changePhotoTitle' => 'Фото',
  24. 'jcropOptions' => [
  25. 'center' => true,
  26. 'rotatable' => true,
  27. 'autoCrop' => true,
  28. 'autoCropArea' => false,
  29. 'checkOrientation' => true,
  30. 'aspectRatio' => 16 / 9,
  31. 'dragMode' => 'move',
  32. 'viewMode' => 1,
  33. 'autoCropArea' => '0.1',
  34. 'restore' => true,
  35. 'guides' => true,
  36. 'center' => true,
  37. 'movable' => false,
  38. 'highlight' => true,
  39. 'cropBoxMovable' => true,
  40. 'cropBoxResizable' => true,
  41. 'background' => false,
  42. 'minContainerHeight' => 500,
  43. 'minCanvasHeight' => 400,
  44. 'minCropBoxWidth' => 600,
  45. 'minCropBoxHeight' => 200,
  46. 'responsive' => true,
  47. 'toggleDragModeOnDblclick' => false,
  48. 'crop' => 'crq'
  49. ]
  50. ]
  51. );
  52. echo $form->field($model, 'url')->textInput([
  53. 'maxlength' => true,
  54. 'class' => 'form-control js-word-count-input',
  55. 'placeholder' => 'URL'
  56. ])->label('URL часть адреса рездела');
  57. echo $form->field($model, 'title')->textInput([
  58. 'maxlength' => true,
  59. 'class' => 'form-control js-word-count-input',
  60. 'placeholder' => 'Заголовок',
  61. // 'id' => 'js-news-content'
  62. ])->label('Заголовок сюжета');
  63. echo $form->field($model, 'meta_title')->textInput([
  64. 'maxlength' => true,
  65. 'class' => 'form-control js-word-count-input',
  66. 'placeholder' => 'Заголовок SEO'
  67. ])->label('Заголовок SEO');
  68. echo $form->field($model, 'description')->textarea([
  69. 'maxlength' => true,
  70. 'class' => 'form-control js-word-count-input',
  71. 'placeholder' => 'description'
  72. ])->label('Описание раздела кратко');
  73. echo $form->field($model, 'keywords')->textarea([
  74. 'maxlength' => true,
  75. 'class' => 'form-control js-word-count-input',
  76. 'placeholder' => 'ключевые слова'
  77. ])->label('ключевые слова через запятую');
  78. ?>
  79. <div class="form-group form-check">
  80. <?
  81. echo $form->field($model, 'active')->checkbox([
  82. 'class' => 'form-check-input',
  83. 'label' => 'Активный'
  84. ]);
  85. //($model->show == 'Y')?true:false,
  86. echo $form->field($model, 'show')->checkbox([
  87. 'class' => 'form-check-input',
  88. 'label' => 'Показывать везде',
  89. 'uncheck' => 'N',
  90. 'checked' => ($model->show == 'Y')?true:false
  91. ]);
  92. ?></div><div class="form-group"><?
  93. echo Html::submitButton('Send', ['class' => 'btn btn-success']);
  94. ?>
  95. </div>
  96. <?
  97. ActiveForm::end();