<?php
$this->load->library('ciext/ciext');
$this->ciext->load_jquery();
$this->js_css->parse_js('user/js/login.js');
$this->js_css->parse_css('user/css/login.css');
?>
<script type="text/javascript">
    $(function () {
        if ('{status}' === 'true') {
            $('#loginBlock').show();
        }
    });
</script>

<?php if (!$loggedIn) : ?>
    <li>
        <a href="#" id="loginBtn"><i class="icon_login"></i><?php echo $this->lang->line('Войти') ?></a>
        <div class="popup login_pp" id="loginBlock">
            <div class="popup_bg"></div>
            <div class="popup_content">
                <a href="#" class="close_popup"></a>
                <h3><?php echo $this->lang->line('Sign in') ?></h3>
                <?php echo form_open('ajax/user/action/login', array('class' => 'form_register')) ?>
                <div class="field-box">
                    <label><?php echo $this->lang->line('E-mail') ?></label>
                    <input type="text" name="login" required tabindex="1" value="<?php echo $login ?>"/>
                </div>
                <div class="field-box password-field">
                    <label><?php echo $this->lang->line('Пароль') ?></label>
                    <a href="<?= $this->config->item('forgot_password_page') ?>"><?php echo $this->lang->line('Forgot your password?') ?></a>
                    <input type="password" name="password" required tabindex="2"/>
                </div>
                <?php if ($status === 'true') : ?>
                    <p class="error"><?php echo $this->lang->line('Wrong login or password') ?></p>
                <?php endif; ?>
                <div class="field-box button-field-box"> 
                    <a href="<?= $this->config->item('registration_page') ?>" class="register_link"><?php echo $this->lang->line('Sign up') ?></a>
                    <input tabindex="3" type="submit" class="big_orange" value="<?php echo $this->lang->line('Sign in') ?>" />
                </div>
                <?php echo form_close() ?>
            </div>
        </div>
    </li>
    <li>
        <a href="<?= $this->config->item('registration_page') ?>"><i class="icon_registr"></i><?php echo $this->lang->line('Sign up') ?></a>
    </li>
<?php else: ?>
    <li>
        <a href="<?= $this->config->item('profile_page') ?>"><i class="icon_registr"></i><?php echo $this->lang->line('Profile') ?></a>
    </li>
    <li>
        <a href="/ajax/user/action/logout"><i class="icon_logout"></i><?php echo $this->lang->line('Logout') ?></a>
    </li>
<?php endif; ?>
    
