<?php
/* @var $this SiteController */
/* @var $model RegistrationForm */
/* @var $form CActiveForm  */

$this->pageTitle = 'Регистрация';
?>
<script>
    var password_length = 6,
            symbols = new Array(                    
                    1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 
                    'n', 'o', 'p', 'r', 's', 't', 'y', 'u', 'w', 'y', 'z', 'x', 'v', 'u', 'q', 'a'
                    );
    function makeSymbol(num_symbol) {
        if (num_symbol >= password_length) {
            return false;
        }
        var idx = Math.floor(Math.random() * symbols.length);
        $('#RegistrationForm_password').val($('#RegistrationForm_password').val() + symbols[idx]);
        $('#RegistrationForm_confirm').val($('#RegistrationForm_confirm').val() + symbols[idx]);
        makeSymbol(++num_symbol);
    }
    $(document).ready(function() {
        $('#go').click(function() {
            $('#RegistrationForm_password').val('');
            $('#RegistrationForm_confirm').val('');
            makeSymbol(0);
            return false;
        });
    });
</script>

    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'registration-form',
        'enableAjaxValidation' => false,
    ));
    ?>

    <div class="form-group">
        <?php echo $form->label($model, 'login'); ?>
        <?php echo $form->textField($model, 'login', array('class' => 'form-control', 'placeholder' => $model->getAttributeLabel('login'))); ?>
        <?php echo $form->error($model, 'login'); ?>
    </div>
    
    <div class="form-group">
        <?php echo $form->label($model, 'password'); ?> <a href="#" id="go" class="small">[Генерировать]</a>
        <?php echo $form->textField($model, 'password', array('class' => 'form-control', 'placeholder' => $model->getAttributeLabel('password'))); ?>
        <?php echo $form->error($model, 'password'); ?>
    </div>

    <div class="form-group">
        <?php echo $form->label($model, 'confirm'); ?>
        <?php echo $form->textField($model, 'confirm', array('class' => 'form-control', 'placeholder' => $model->getAttributeLabel('confirm'))); ?>
        <?php echo $form->error($model, 'confirm'); ?>
    </div>    

    <div class="form-group">
        <?php echo $form->label($model, 'sex'); ?>
        <?php echo $form->dropDownList($model, 'sex', array('0'=>'мужской','1'=>'женский'), array('class' => 'form-control')); ?>
        <?php echo $form->error($model, 'sex'); ?>
    </div>   
    
    <div class="col-xs-6">
        <div class="form-group">
            <?php echo $form->label($model, 'side'); ?>
            <?php echo $form->dropDownList($model, 'side', array('1'=>'Краллы','2'=>'Элийцы'), array('class' => 'form-control')); ?>
            <?php echo $form->error($model, 'side'); ?>
        </div>
    </div>
    <div class="col-xs-6">
        <div class="form-group">
            <?php echo $form->label($model, 'class'); ?>
            <?php echo $form->dropDownList($model, 'class', array('1'=>'Воин','2'=>'Медик'), array('class' => 'form-control')); ?>
            <?php echo $form->error($model, 'class'); ?>
        </div>
    </div>
    <?php echo '<span class="small"> Регистрируясь, Вы принимаете условия '.CHtml::link(Yii::t('client_layout', 'соглашения'),array('help', 'id' => 1)).'</span>'; ?>
    
    <div class="form-group">
        <?php echo CHtml::submitButton(Yii::t('client_layout', 'Начать играть!'), array('class' => 'btn-block form-control')); ?>
    </div>
<?php $this->endWidget(); ?>
<hr>
<?php echo CHtml::link('<img src="/images/icons/arrow.png" alt="*"> На главную', '/', array('class' => 'block') )?>
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                



