<div class="form">

    <?php
    /**
     * @var BHorizontalForm $form
     * @var Contact $model
     * @var ContactI18n[] $i18nModels
     */
    ?>

    <?php $form = $this->beginWidget('BHorizontalForm', array(
    'id' => 'contact-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(array($model) + $i18nModels); ?>

    -->

    <div class="control-group <?php echo ($model->hasErrors('email') ? ' error' : '') ?>">
        <?php echo $form->label($model, 'email', array('class' => 'control-label'))?>
        <div class="controls">
            <?php echo $form->textField($model, 'email', array('size' => 45, 'maxlength' => 45)); ?>
            <?php echo $form->error($model, 'email'); ?>
        </div>
    </div>

    <div class="control-group <?php echo ($model->hasErrors('bcc_email') ? ' error' : '') ?>">
        <?php echo $form->label($model, 'bcc_email', array('class' => 'control-label'))?>
        <div class="controls">
            <?php echo $form->textField($model, 'bcc_email', array('size' => 45, 'maxlength' => 45)); ?>
            <?php echo $form->error($model, 'bcc_email'); ?>
        </div>
    </div>

    <div class="control-group <?php echo ($model->hasErrors('phone') ? ' error' : '') ?>">
        <?php echo $form->label($model, 'phone', array('class' => 'control-label'))?>
        <div class="controls">
            <?php echo $form->textField($model, 'phone', array('size' => 45, 'maxlength' => 45)); ?>
            <?php echo $form->error($model, 'phone'); ?>
        </div>
    </div>


    <?php
    echo $form->controlGroup($model, 'image',
        $form->fileField($model, 'image') . '<br/>' .
            CHtml::image($model->imageBehavior->getFileUrl('preview')));
    ?>

    <?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('name') ? ' error' : '') ?>">
            <?php echo $form->label($i18nModel, 'name', array('class' => 'control-label'))?>
            <div class="controls">
                <?php echo $form->textField($i18nModel, "[$lang]name", array('size' => 45, 'maxlength' => 45)); ?>
                <?php echo $form->error($i18nModel, 'name'); ?>
            </div>
        </div>

        <div class="control-group <?php echo ($i18nModel->hasErrors('position') ? ' error' : '') ?>">
            <?php echo $form->label($i18nModel, 'position', array('class' => 'control-label'))?>
            <div class="controls">
                <?php echo $form->textField($i18nModel, "[$lang]position", array('size' => 45, 'maxlength' => 45)); ?>
                <?php echo $form->error($i18nModel, 'position'); ?>
            </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 -->
