<?php
/* @var $this QuestionnaireController */
/* @var $model Questionnaire */
/* @var $form CActiveForm */
?>

<div class="col-xs-12">

    <?php
    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
        'id' => 'questionnaire-form',
        // Please note: When you enable ajax validation, make sure the corresponding
        // controller action is handling ajax validation correctly.
        // There is a call to performAjaxValidation() commented in generated controller code.
        // See class documentation of CActiveForm for details on this.
        'enableAjaxValidation' => true,
    ));
    ?>

    <p class="note">Fields with <span class="required">*</span> are required.</p>

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

    <?php echo $form->textFieldControlGroup($model, 'title', array('maxlength' => 500)); ?>
    <?php echo $form->textFieldControlGroup($model, 'title_en', array('maxlength' => 500)); ?>

    <?php echo $form->textAreaControlGroup($model, 'intro', array('rows' => 6, 'cols' => 50)); ?>
    <?php echo $form->textAreaControlGroup($model, 'intro_en', array('rows' => 6, 'cols' => 50)); ?>

    <?php //echo $form->numberFieldControlGroup($model, 'qorder',array('min' => 1, 'max'=>100)); ?>
    <?php echo $form->numberFieldControlGroup($model, 'qorder'); ?>

    <?php echo $form->dropDownListControlGroup($model, 'featured',array('0'=>'0','1'=>'1','2'=>'2')); ?>

    <div class="form-group">
        <?php echo $form->labelEx($model, 'publish_datetime', array('class' => 'col-md-3 control-label')); ?>
        <div class="col-md-5 controls">
            <?php
            if ($model->isNewRecord) {
                $model->publish_datetime = date('Y-m-d');
            }
            $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'model' => $model,
                'attribute' => 'publish_datetime',
                'options' => array(
                    'dateFormat' => 'yy-mm-dd',
                ),
                'htmlOptions' => array(
                    'size' => '10', // textField size
                    'maxlength' => '10', // textField maxlength
                    'class' => 'form-control',
                ),
            ));
            ?>
        </div>
        <?php echo $form->error($model, 'publish_datetime'); ?>
    </div>
    
    <div class="form-group">
        <?php echo $form->labelEx($model, 'end_datetime', array('class' => 'col-md-3 control-label')); ?>
        <div class="col-md-5 controls">
            <?php
            $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'model' => $model,
                'attribute' => 'end_datetime',
                'options' => array(
                    'dateFormat' => 'yy-mm-dd',
                ),
                'htmlOptions' => array(
                    'size' => '10', // textField size
                    'maxlength' => '10', // textField maxlength
                    'class' => 'form-control',
                ),
            ));
            ?>
        </div>
        <?php echo $form->error($model, 'end_datetime'); ?>
    </div>


    <?php
    echo TbHtml::formActions(array(
        TbHtml::submitButton($model->isNewRecord ? Yii::t('admin', 'Create') : Yii::t('admin', 'Save'), array('color' => TbHtml::BUTTON_COLOR_PRIMARY)),
        TbHtml::resetButton(Yii::t('admin', 'Reset')),
    ));
    ?>    
    <?php $this->endWidget(); ?>

</div>