<div class="form">

    <?php
    /**
     * @var BHorizontalForm $form
     * @var Question $model
     * @var QuestionI18n[] $i18nModels
     */
    ?>

    <?php $form = $this->beginWidget('BHorizontalForm', array(
    'id' => 'question-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('question_category_id') ? ' error' : '') ?>">
        <?php echo $form->label($model, 'question_category_id', array('class' => 'control-label'))?>
        <div class="controls">
            <?php echo $form->dropDownList(
            $model,
            'question_category_id',
            CHtml::listData(QuestionCategory::model()->findAll(), 'id', 'i18n.name')
        ); ?>
            <?php echo $form->error($model, 'question_category_id'); ?>
        </div>
    </div>

    <?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('question') ? ' error' : '') ?>">
            <?php echo $form->label($i18nModel, 'question', array('class' => 'control-label'))?>
            <div class="controls">
                <?php echo $form->textArea($i18nModel, "[$lang]question", array('rows' => 6, 'cols' => 50,'class'=>'input-xxlarge')); ?>
                <?php echo $form->error($i18nModel, 'question'); ?>
            </div>
        </div>

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

        <?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 -->
