<?
global $lang , $user;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<title>Panel Administratora</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<link rel="stylesheet" type="text/css" href="../resources/jq_tooltip/tooltip.css">
	<link rel="Stylesheet" type="text/css" href="../resources/jquery/jquery-ui-1.8.2.custom.css">
	<link rel="Stylesheet" type="text/css" href="../resources/jq_impromptu/jquery-impromptu.css">
	<script type="text/javascript" src="../resources/jquery/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="../resources/jquery/jquery-ui-1.8.2.custom.min.js"></script>
	<script type="text/javascript" src="../resources/contextmenu.js"></script>
	<script type="text/javascript" src="../resources/jq_tooltip/tooltip.js"></script>
	<script type="text/javascript" src="../resources/ckeditor/ckeditor.js"></script>
	<script type="text/javascript" src="../resources/ckeditor/adapters/jquery.js"></script>
	<script type="text/javascript" src="../resources/jq_impromptu/jquery-impromptu.3.1.min.js"></script>
	<script type="text/javascript" src="../resources/jquery/jquery.ui.datepicker-pl.js"></script>
	<?
		global $xajax;
		$xajax -> printJavascript( '../resources/xajax/' );
	?>
</head>
<body>
  <div class='page_header'>
    <div class="page_header_content">
      <div id="logo" onClick='document.location.href="./";'><?=$this -> _site_title;?></div>
      <?
      if ( $user &&  $user -> get_login() )
      {
        ?>
        <div id="user_menu_after">
          <form method='POST' id='f_logon' action='./'>
            <input type='hidden' name='rw' value='user_logout'>
          </form>
          <a href="#" class="logout" onClick='$("#f_logon").submit();'>
            <span></span>
          </a>
        </div>
        <div id="user_menu">
          <img src="../images/system/user.png">
          <a href="./?page_type=settings" id="login"><?=$user -> get_login();?></a>
        </div>
        <?
      }
      ?>
    </div>
  </div>
  <div class="page_main">
    <?
    if ( $user && $user -> get_admin() )
    {
      ?>
      <div class="page_main_left">
        <ul class="menu_left">
          <li>
            <a href="./?page_type=page_articles" <? if ( $this -> _p == 'page_articles' || $this -> _p == 'article_archive' || $this -> _p == 'page_article_sort' || $this -> _p == 'page_articles' || $this -> _p == 'menu_definition' || $this -> _p == 'page_definition' ) echo 'class="active"';?>>
              <span>
                <img src="../../images/system/pages.png">
              </span>
              <?=$lang -> getTrans( 'T_CMS' );?>
            </a>
            <ul>
              <li><a href="./?page_type=menu_definition" <? if ( $this -> _p == 'menu_definition' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_DEFINICJE_MENU' );?></a></li>
              <li><a href="./?page_type=page_definition" <? if ( $this -> _p == 'page_definition' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_STRONY' );?></a></li>
              <li><a href="./?page_type=page_articles" <? if ( $this -> _p == 'page_articles' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_ARTYKULY' );?></a></li>
              <li><a href="./?page_type=page_article_sort" <? if ( $this -> _p == 'page_article_sort' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_SORTOWANIE_ARTYKULOW' );?></a></li>
              <li><a href="./?page_type=article_archive" <? if ( $this -> _p == 'article_archive' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_ARCHIWUM' );?></a></li>
              <li><a href="http://<?=$this -> _site_title;?>" target="_blank"><?=$lang -> getTrans( 'T_PODGLAD' );?></a></li>
            </ul>
          </li>
          <li>
            <a href="./?page_type=settings" <? if ( $this -> _p == 'settings' || $this -> _p == 'layout' || $this -> _p == 'translation' || $this -> _p == 'lang' || $this -> _p == 'admins' || $this -> _p == 'users' ) echo 'class="active"';?>>
              <span>
                <img src="../../images/system/settings.png">
              </span>
              <?=$lang -> getTrans( 'T_KONFIGURACJA' );?>
            </a>
            <ul>
              <li><a href="./?page_type=users" <? if ( $this -> _p == 'users' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_UZYTKOWNICY' );?></a></li>
              <li><a href="./?page_type=admins" <? if ( $this -> _p == 'admins' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_ADMINISTRATORZY' );?></a></li>
              <?
              if ( $user -> _login == 'vampirius' )
              {
                ?>
                <li><a href="./?page_type=lang" <? if ( $this -> _p == 'lang' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_JEZYKI' );?></a></li>
                <li><a href="./?page_type=translation" <? if ( $this -> _p == 'translation' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_TLUMACZENIA' );?></a></li>
                <?
              }
              ?>
              <li><a href="./?page_type=settings" <? if ( $this -> _p == 'settings' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_USTAWIENIA' );?></a></li>
              <li><a href="./?page_type=layout" <? if ( $this -> _p == 'layout' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_SZABLONY' );?></a></li>
            </ul>
          </li>
          <li>
            <a href="./?page_type=page_articles" <? if ( $this -> _p == 'guest_book' || $this -> _p == 'banned_login' || $this -> _p == 'banned_email' || $this -> _p == 'adverts' || $this -> _p == 'banner' ) echo 'class="active"';?>>
              <span>
                <img src="../../images/system/other.png">
              </span>
              <?=$lang -> getTrans( 'T_POZOSTALE' );?>
            </a>
            <ul>
              <li><a href="./?page_type=guest_book" <? if ( $this -> _p == 'guest_book' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_KSIEGA_GOSCI' );?></a></li>
              <li><a href="./?page_type=banner" <? if ( $this -> _p == 'banner' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_BANERY' );?></a></li>
              <li><a href="./?page_type=adverts" <? if ( $this -> _p == 'adverts' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_REKLAMA' );?></a></li>
              <li><a href="./?page_type=banned_email" <? if ( $this -> _p == 'banned_email' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_ZAKAZANE_MAILE' );?></a></li>
              <li><a href="./?page_type=banned_login" <? if ( $this -> _p == 'banned_login' ) echo 'style="background: #FFF !important;"';?>><?=$lang -> getTrans( 'T_ZAKAZANE_LOGINY' );?></a></li>
            </ul>
          </li>
        </ul>
      </div>
      <?
    }
    ?>
    <div class="page_main_right">
      <?
      if ( isset( $this -> _alert ) )
      {
        ?>
        <script type='text/javascript'>
          function closeAlert()
          {
            $("#alert").hide('blind', { direction: 'vertical' }, 1000);
          }
          $(document).ready(function(){
            setTimeout("closeAlert()",5000)
          });
        </script>
        <div id="alert" class="alert">
          <div>
            <img src="../images/system/sico_alert.png">
            <?=$this -> _alert;?>
          </div>
        </div>
        <?
      }

      /*
        * formularz logowania
        */
      if ( !isset( $user ) || !is_object( $user ) || !$user -> get_admin() )
      {
        ?>
        <form method='POST' id='f_logon' action='./'>
          <input type='hidden' name='rw' value='user_logon'>

          <div class="login_form">
            <div class="title"><?=ucfirst( $lang -> getTrans( 'T_LOGOWANIE' ) );?>:</div>
            <div class="label"><?=$lang -> getTrans( 'T_LOGIN' );?>::</div>
            <div class="input">
              <input type="text" name="user_login" class="input_login" style="width: 228px; height: 20px;" onKeyPress='checkKey(event,"f_logon")'>        
            </div>
            <div class="label"><?=$lang -> getTrans( 'T_HASLO' );?>:</div>
            <div class="input">
                <input type="password" class="input_login" name="user_password" style="width: 228px; height: 20px;"> 
            </div>
            <input type="button" class="button" onClick="$( '#f_logon' ).submit();" value="<?=$lang -> getTrans( 'T_ZALOGUJ' );?>">
          </div>
        </form>
        <?
      }
      else if ( $user -> get_admin() )
        echo $this -> _content;
      ?>
    </div>
  </div>
  <div id="dialog_place"></div>
</body>
</html>