<?php
/**
 * @var $this NodeController
 * @var SportRoot $model
 * @var SportRootI18n[] $i18nModels
 */
?>

<div class="form">

<?php
/**
 * @var BHorizontalForm $form
 */
?>

<?php $form = $this->beginWidget('BHorizontalForm', array(
    'id' => 'service-form',
    'enableAjaxValidation' => false,
    'htmlOptions' => array(
        'enctype' => 'multipart/form-data',
    ),
)); ?>
<!--
    <p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>

    -->

<div class="control-group <?php echo ($model->hasErrors('video_stream') ? ' error' : '') ?>">
    <?php echo $form->label($model, 'video_stream', array('class' => 'control-label'))?>
    <div class="controls">
        <?php echo $form->checkBox($model, "video_stream"); ?>
        <?php echo $form->error($model, 'video_stream'); ?>
    </div>
</div>

<div class="control-group <?php echo ($model->hasErrors('show_silk_way') ? ' error' : '') ?>">
    <?php echo $form->label($model, 'show_silk_way', array('class' => 'control-label'))?>
    <div class="controls">
        <?php echo $form->checkBox($model, "show_silk_way"); ?>
        <?php echo $form->error($model, 'show_silk_way'); ?>
    </div>
</div>


<div class="control-group <?php echo ($model->hasErrors('contactIds') ? ' error' : '') ?>">
    <?php echo $form->label($model, 'contactIds', array('class' => 'control-label'))?>
    <div class="controls">
        <?php
        $this->widget('MultiSelect', array(
            'data' => Contact::listWithSelected($model->getContactIds()),
            'model' => $model,
            'attribute' => 'contactIds',
            'htmlOptions' => array(
                'style' => 'min-width:600px; min-height:200px;'
            )
        )); ?>
        <?php //echo Chosen::activeMultiSelect($model, 'contactIds', CHtml::listData(Contact::model()->findAll(), 'id', 'i18n.name')); ?>
        <?php echo $form->error($model, 'contactIds'); ?>
    </div>
</div>

<h2>Галерея под шапкой сайта</h2>
<?php
if ($model->galleryBehavior->getGallery() === null) {
    ?>
<p>Для управления галереей сохраните обьект</p>
    <?php
} else {
    $this->widget('GalleryManager', array(
        'htmlOptions' => array('style' => 'float:left;'),
        'gallery' => $model->galleryBehavior->getGallery(),
    ));
    echo '<br style="clear: both;"/><br/><br/>';
}
?>
<h2>Содержимое</h2>

<?php
/**
 * @var BTabs $tabs
 */
$tabs = $this->beginWidget('BTabs');
foreach ($i18nModels as $lang => $i18nModel):
    ?>
    <?php $tabs->beginTab(Yii::app()->params['languageNames'][$lang]) ?>
<div class="control-group <?php echo ($i18nModel->hasErrors('page_name') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'page_name', array('class' => 'control-label'))?>
    <div class="controls">
        <?php echo $form->textField($i18nModel, "[$lang]page_name", array('size' => 60, 'maxlength' => 512)); ?>
        <?php echo $form->error($i18nModel, 'page_name'); ?>
    </div>
</div>



<div class="control-group <?php echo ($i18nModel->hasErrors('study_title') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'study_title', array('class' => 'control-label'))?>
    <div class="controls">
        <?php echo $form->textField($i18nModel, "[$lang]study_title", array('size' => 60, 'maxlength' => 512)); ?>
        <?php echo $form->error($i18nModel, 'study_title'); ?>
    </div>
</div>

<div class="control-group <?php echo ($i18nModel->hasErrors('study_image') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'study_image', array('class' => 'control-label'))?>
    <div class="controls">
        <?php
        $this->widget('ServerFileInput', array(
            'model' => $i18nModel,
            'attribute' => "[$lang]study_image",
        ));
        ?>
        <?php echo $form->error($i18nModel, 'study_image'); ?>
    </div>
</div>

<div class="control-group <?php echo ($i18nModel->hasErrors('study_content') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'study_content', array('class' => 'control-label'))?>
    <div class="controls">
        <?php
        $this->widget('TinyMce', array(
            'model' => $i18nModel,
            'attribute' => "[$lang]study_content",
            'htmlOptions' => array(
                'rows' => 6,
                'cols' => 60,
            ),
        ));
        ?>
        <?php echo $form->error($i18nModel, 'study_content'); ?>
    </div>
</div>


<div class="control-group <?php echo ($i18nModel->hasErrors('study_button') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'study_button', array('class' => 'control-label'))?>
    <div class="controls">
        <?php echo $form->textField($i18nModel, "[$lang]study_button", array('size' => 60, 'maxlength' => 512)); ?>
        <?php echo $form->error($i18nModel, 'study_button'); ?>
    </div>
</div>

<div class="control-group <?php echo ($i18nModel->hasErrors('study_link') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'study_link', array('class' => 'control-label'))?>
    <div class="controls">
        <?php echo $form->textField($i18nModel, "[$lang]study_link", array('size' => 60, 'maxlength' => 512)); ?>
        <?php echo $form->error($i18nModel, 'study_link'); ?>
    </div>
</div>



<div class="control-group <?php echo ($i18nModel->hasErrors('awards_content') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'awards_content', array('class' => 'control-label'))?>
    <div class="controls">
        <?php
        $this->widget('TinyMce', array(
            'model' => $i18nModel,
            'attribute' => "[$lang]awards_content",
            'htmlOptions' => array(
                'rows' => 6,
                'cols' => 60,
            ),
        ));
        ?>
        <?php echo $form->error($i18nModel, 'awards_content'); ?>
    </div>
</div>

<div class="control-group <?php echo ($i18nModel->hasErrors('awards_button') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'awards_button', array('class' => 'control-label'))?>
    <div class="controls">
        <?php echo $form->textField($i18nModel, "[$lang]awards_button", array('size' => 60, 'maxlength' => 512)); ?>
        <?php echo $form->error($i18nModel, 'awards_button'); ?>
    </div>
</div>

<div class="control-group <?php echo ($i18nModel->hasErrors('awards_link') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'awards_link', array('class' => 'control-label'))?>
    <div class="controls">
        <?php echo $form->textField($i18nModel, "[$lang]awards_link", array('size' => 60, 'maxlength' => 512)); ?>
        <?php echo $form->error($i18nModel, 'awards_link'); ?>
    </div>
</div>


<div class="control-group <?php echo ($i18nModel->hasErrors('champions_content') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'champions_content', array('class' => 'control-label'))?>
    <div class="controls">
        <?php
        $this->widget('TinyMce', array(
            'model' => $i18nModel,
            'attribute' => "[$lang]champions_content",
            'htmlOptions' => array(
                'rows' => 6,
                'cols' => 60,
            ),
        ));
        ?>
        <?php echo $form->error($i18nModel, 'champions_content'); ?>
    </div>
</div>

<!--
<div class="control-group <?php /*echo ($i18nModel->hasErrors('team_link') ? ' error' : '') */?>">
    <?php /*echo $form->label($i18nModel, 'team_link', array('class' => 'control-label'))*/?>
    <div class="controls">
        <?php /*echo $form->textField($i18nModel, "[$lang]team_link", array('size' => 60, 'maxlength' => 512)); */?>
        <?php /*echo $form->error($i18nModel, 'team_link'); */?>
    </div>
</div>
-->

<div class="control-group <?php echo ($i18nModel->hasErrors('qualifications_content') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'qualifications_content', array('class' => 'control-label'))?>
    <div class="controls">
        <?php
        $this->widget('TinyMce', array(
            'model' => $i18nModel,
            'attribute' => "[$lang]qualifications_content",
            'htmlOptions' => array(
                'rows' => 6,
                'cols' => 60,
            ),
        ));
        ?>
        <?php echo $form->error($i18nModel, 'qualifications_content'); ?>
    </div>
</div>

    <?php echo $form->beginFieldset('СЕО Параметры'); ?>

<div class="control-group <?php echo ($i18nModel->hasErrors('title') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'title', array('class' => 'control-label'))?>
    <div class="controls">
        <?php echo $form->textField($i18nModel, "[$lang]title", array('size' => 60, 'maxlength' => 512, 'class' => 'input-xxlarge')); ?>
        <?php echo $form->error($i18nModel, 'title'); ?>
    </div>
</div>

<div class="control-group <?php echo ($i18nModel->hasErrors('keywords') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'keywords', array('class' => 'control-label'))?>
    <div class="controls">
        <?php echo $form->textArea($i18nModel, "[$lang]keywords", array('rows' => 6, 'cols' => 50, 'class' => 'input-xxlarge')); ?>
        <?php echo $form->error($i18nModel, 'keywords'); ?>
    </div>
</div>

<div class="control-group <?php echo ($i18nModel->hasErrors('description') ? ' error' : '') ?>">
    <?php echo $form->label($i18nModel, 'description', array('class' => 'control-label'))?>
    <div class="controls">
        <?php echo $form->textArea($i18nModel, "[$lang]description", array('rows' => 6, 'cols' => 50, 'class' => 'input-xxlarge')); ?>
        <?php echo $form->error($i18nModel, 'description'); ?>
    </div>
</div>

    <?php echo $form->endFieldset(); ?>

    <?php $tabs->endTab() ?>
    <?php
endforeach;
$this->endWidget();
?>

<div class="form-actions">
    <button type="submit" class="btn btn-large btn-primary">
        <?php echo ($model->isNewRecord ? 'Создать' : 'Сохранить'); ?>
    </button>
</div>

<?php $this->endWidget(); ?>

</div><!-- form -->
