<?php
/**
 * @var $this NodeController
 * @var QuestionRoot $model
 */
?>

<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('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/>';
    }
    ?>

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

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

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