_form.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\widgets\ActiveForm;
  4. use yii\web\View;
  5. /** @var yii\web\View $this */
  6. /** @var app\models\Page $model */
  7. /** @var yii\widgets\ActiveForm $form */
  8. $uuid = 'docs_page';
  9. $cat = Yii::$app->request->get('cat', '');
  10. if( $cat == '' ){
  11. $cat = $model->cat;
  12. }
  13. @session_start();
  14. $_SESSION['KCFINDER']['admin_news'] = true;
  15. $this->registerJs(
  16. "$( function() { $( '#tabs' ).tabs();});",
  17. View::POS_READY
  18. );
  19. // CKEditor
  20. $this->registerJs(
  21. <<<JS
  22. $(function () {
  23. if($('#docs-text').length != 0){
  24. CKEDITOR.replace('docs-text', {
  25. 'filebrowserBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=files&uid=$uuid',
  26. 'filebrowserImageBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=images&uid=$uuid',
  27. 'filebrowserFlashBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=flash&uid=$uuid',
  28. 'filebrowserUploadUrl': '/components/admin/ckeditor/kcfinder/upload.php?type=files&uid=$uuid',
  29. 'filebrowserImageUploadUrl': '/components/admin/ckeditor/kcfinder/upload.php?type=images&uid=$uuid',
  30. 'filebrowserFlashUploadUrl': '/components/admin/ckeditor/kcfinder/upload.php?type=flash&uid=$uuid',
  31. 'filebrowserAudioBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=files&uid=$uuid',
  32. 'filebrowserlightboxUploadUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=files&uid=$uuid',
  33. 'height': 400
  34. });
  35. }
  36. });
  37. JS
  38. ,
  39. View::POS_READY,
  40. 'ck_editor'
  41. );
  42. ?>
  43. <div class="page-form">
  44. <?php $form = ActiveForm::begin(); ?>
  45. <div id="tabs">
  46. <ul>
  47. <li><a href="#tabs-1">Основные настройки</a></li>
  48. <li><a href="#tabs-2">Дополнения</a></li>
  49. </ul>
  50. <div id="tabs-1">
  51. <input type="hidden" name="Docs[uid]" value="<?=$uid?>">
  52. <?
  53. if( $cat ){
  54. ?>
  55. <input type="hidden" name="Docs[cat]" value="<?=$cat?>">
  56. <?
  57. }
  58. ?>
  59. <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
  60. <?= $form->field($model, 'text')->textarea(['rows' => 6]) ?>
  61. </div>
  62. <div id="tabs-2">
  63. Антрацитовые замки.
  64. </div>
  65. </div>
  66. <div class="form-group m-4">
  67. <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
  68. </div>
  69. <?php ActiveForm::end(); ?>
  70. </div>