<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\web\View;

/** @var yii\web\View $this */
/** @var app\models\Page $model */
/** @var yii\widgets\ActiveForm $form */
$uuid = 'docs_page';
$cat = Yii::$app->request->get('cat', '');
if( $cat == '' ){
	$cat = $model->cat;
}
@session_start();
$_SESSION['KCFINDER']['admin_news'] = true;
$this->registerJs(
    "$( function() { $( '#tabs' ).tabs();});",
    View::POS_READY
);

// CKEditor
$this->registerJs(
<<<JS
$(function () {
	if($('#docs-text').length != 0){
    CKEDITOR.replace('docs-text', {
        'filebrowserBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=files&uid=$uuid',
        'filebrowserImageBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=images&uid=$uuid',
        'filebrowserFlashBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=flash&uid=$uuid',
        'filebrowserUploadUrl': '/components/admin/ckeditor/kcfinder/upload.php?type=files&uid=$uuid',
        'filebrowserImageUploadUrl': '/components/admin/ckeditor/kcfinder/upload.php?type=images&uid=$uuid',
        'filebrowserFlashUploadUrl': '/components/admin/ckeditor/kcfinder/upload.php?type=flash&uid=$uuid',
        'filebrowserAudioBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=files&uid=$uuid',
        'filebrowserlightboxUploadUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=files&uid=$uuid',
        'height': 400
    });
	}
});
JS
    ,
    View::POS_READY,
    'ck_editor'
);

?>
<div class="page-form">

    <?php $form = ActiveForm::begin(); ?>
<div id="tabs">
  <ul>
    <li><a href="#tabs-1">Основные настройки</a></li>
    <li><a href="#tabs-2">Дополнения</a></li>
  </ul>
  <div id="tabs-1">
	<input type="hidden" name="Docs[uid]" value="<?=$uid?>">
<?
	if( $cat ){
?>
	<input type="hidden" name="Docs[cat]" value="<?=$cat?>">
<?
	}
?>
    <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'text')->textarea(['rows' => 6]) ?>


  </div>  
  <div id="tabs-2">
  Антрацитовые замки.
  </div>
</div>    
    <div class="form-group m-4">
        <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>

