예제 #1
0
$this->pageTitle = Yii::t('AuthModule.forms', 'Login. Title');
$isAjax = Yii::app()->request->isAjaxRequest;
if (!isset($model)) {
    $model = new LoginForm();
}
if (isset($username)) {
    $model->username = $username;
}
$model->rememberMe = true;
$formRender = new FormElements($this, $model);
//$formRender->startForm('user-login', true);
$formRender->startForm('user-login', $isAjax);
$formRender->showErrors(Yii::t('AuthModule.forms', 'Login. Login failure'));
$formRender->textField('username', Yii::t('AuthModule.forms', 'Login. Username placeholder'));
$formRender->passwordField('password', Yii::t('AuthModule.forms', 'Login. Password placeholder'));
$formRender->checkBox('rememberMe', Yii::t('AuthModule.forms', 'Login. Remember me checkbox'));
$formRender->capthaField('verifyCode');
if ($model->scenario != 'withCaptcha') {
    Yii::app()->clientScript->registerScript("captcha", "\n                \$('#captcha').hide();\n            ");
}
$buttonLabel = Yii::t('AuthModule.forms', 'Login. Submit button');
if (!$isAjax) {
    $formRender->submitButton($buttonLabel);
} else {
    $url = $this->createUrl('login');
    $formRender->ajaxSubmitPanel($buttonLabel, $url);
}
$formRender->endForm();
?>
   
예제 #2
0
?>

    <?php 
$formRender = new FormElements($this, $model);
$formRender->startForm();
$formRender->showErrors();
if ($isNewRecord) {
    $formRender->textField('username', Yii::t('AuthModule.forms', 'Registration form. Username placeholder'));
    if (isset($inivtationGuid)) {
        $model->invitationGuid = $inivtationGuid;
        //$formRender->textField('invitationGuid', Yii::t('AuthModule.forms', 'Invitation'));
        $formRender->from->hiddenField($model, 'invitationGuid');
    }
} else {
    $formRender->textFieldDisabled('username');
}
$formRender->textField('email', Yii::t('AuthModule.forms', 'User form. Email placeholder'));
$formRender->textField('full_name', Yii::t('AuthModule.forms', 'User form. Fullname placeholder'));
$formRender->passwordField('password_entered', Yii::t('AuthModule.forms', 'User form. Password placeholder'));
$formRender->capthaField('verifyCode');
if ($isNewRecord) {
    $termsUrl = Yii::app()->createUrl('site/page', array('view' => 'terms'));
    $formRender->termsField('termsSigned', $termsUrl);
    $formRender->submitButton(Yii::t('AuthModule.forms', 'Registration form. Submit button'));
} else {
    $formRender->submitButton(Yii::t('AuthModule.forms', 'Update form. Submit button'));
}
$formRender->endForm();
?>