<?
global $user, $lang;
?>
<div class="user_panel">
  <div class="header"><?=$lang -> getTrans( 'T_PANEL_UZYTKOWNIKA' );?></div>
  <?
  if ( is_object( $user ) && $user -> get_login() )
  {
    ?>
    <div><?=ucfirst( $lang -> getTrans( 'T_WITAJ' ) );?>: <?=$user -> get_login();?></div>
    <div style="margin: auto; width: 90px; height: 25px; margin-top: 10px;">
      <form class="form_designer">
        <input type="button" onClick="xajax_logout();" value="<?=$lang -> getTrans( 'T_WYLOGUJ' );?>">
      </form>
    </div>
    <?
  }
  else
  {
    ?>
    <form class="form_designer">
      <table>
        <tr>
          <th class="header" style="padding: 0px 0px 10px;"><?=$lang -> getTrans( 'T_LOGIN' );?>:</th>
          <td class="row"><input type="text" name="l_login" id="l_login"></td>
        </tr>
        <tr>
          <th class="header" style="padding: 0px 0px 10px;"><?=$lang -> getTrans( 'T_HASLO' );?>:</th>
          <td class="row"><input type="password" name="l_password" id="l_password">
        </tr>
        <tr>
          <td></td>
          <td class="row center">
            <input type="button" value="<?=$lang -> getTrans( 'T_ZALOGUJ' );?>" onClick="loginUser()">
          </td>
        </tr>
        <tr>
          <td colspan="2" class="row">
            <?
            if ( \admin\factory\Settings::getSystemSettings( 'register' ) )
            {
              ?>
                <a href="rejestracja"><?=$lang -> getTrans( 'T_REJESTRACJA' );?></a> /
              <?
            }
            ?><a href="odzyskaj_haslo"><?=$lang -> getTrans( 'T_ODZYSKAJ_HASLO' );?></a>
          </td>
        </tr>
      </table>
    </form>
    <?
  }
  ?>
</div>
<script type="text/javascript">
  function loginUser()
  {
    var login     = $( '#l_login' ).val();
    var password  = $( '#l_password' ).val();

    if ( login && password )
    {
      $.prompt( '<?=$lang -> getTrans( 'T_PROSZE_CZEKAC' );?>..' );
      xajax_loginUser( login , password );
    }
  }
</script>