<?PHP
require_once('core.php');
require_once('app/php/session.admin.php');
if($uti['rank'] < $S['rank_min'])
{
  header('Location: home');
  exit();
}
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title><?PHP echo htmlentities($cms['nom_hotel']); ?> | Panel</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.7 -->
  <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="bower_components/Ionicons/css/ionicons.min.css">
  <!-- jvectormap -->
  <link rel="stylesheet" href="bower_components/jvectormap/jquery-jvectormap.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Google Font -->
  <link rel="stylesheet"
        href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<body class="hold-transition skin-blue sidebar-mini" style="">
<div class="wrapper" style="">

  <header class="main-header">

    <!-- Logo -->
    <a href="home.php" class="logo">
      <!-- mini logo for sidebar mini 50x50 pixels -->
      <span class="logo-mini"><b>A</b>DM</span>
      <!-- logo for regular state and mobile devices -->
      <span class="logo-lg"><b>Admin</span>
    </a>

    <!-- Header Navbar: style can be found in header.less -->
    <nav class="navbar navbar-static-top">
      <!-- Sidebar toggle button-->
      <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
        <span class="sr-only">Toggle navigation</span>
      </a>
      <!-- Navbar Right Menu -->
      <div class="navbar-custom-menu">
        <ul class="nav navbar-nav">

          <!-- User Account: style can be found in dropdown.less -->
          <li class="dropdown user user-menu">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <img src="https://www.habbo.de/habbo-imaging/avatarimage?figure=<?PHP echo htmlspecialchars(trim($uti['look'])); ?>&direction=2&head_direction=3&action=wav&size=m&gesture=sml&headonly=1" class="user-image" alt="User Image">
              <span class="hidden-xs"><?PHP echo htmlentities($uti['username']); ?></span>
            </a>
            <ul class="dropdown-menu">
              <!-- User image -->
              <li class="user-header">
                <img src="https://www.habbo.de/habbo-imaging/avatarimage?figure=<?PHP echo htmlspecialchars(trim($uti['look'])); ?>&direction=2&head_direction=3&action=wav&size=m&gesture=sml&headonly=1" class="img-circle" alt="User Image">

                <p>
                  <?PHP echo htmlentities($uti['username']); ?>
                  <small>Membre depuis <?PHP echo date('d.m.Y', $uti['account_created']); ?></small>
                </p>
              </li>
              <!-- Menu Body -->
              <!-- Menu Footer-->
              <li class="user-footer">
                <div class="pull-right">
                  <a href="logout.php" class="btn btn-default btn-flat">Déconnexion</a>
                </div>
              </li>
            </ul>
          </li>
        </ul>
      </div>

    </nav>
  </header>
  <!-- Left side column. contains the logo and sidebar -->
  <?PHP require_once('template/header.php'); ?>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Dashboard
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">Dashboard</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <!-- Info boxes -->
      <div class="row">
        <div class="col-md-3 col-sm-6 col-xs-12">
          <div class="info-box">
            <span class="info-box-icon bg-aqua"><i class="ion ion-ios-people-outline"></i></span>

            <div class="info-box-content">
              <span class="info-box-text">Membres</span>
              <span class="info-box-number">
              <?PHP 
              $SelectUsers = $bdd->prepare('SELECT * FROM users'); 
              $SelectUsers->execute();
              echo $SelectUsers->rowCount();
              ?>
              </span>
            </div>
            <!-- /.info-box-content -->
          </div>
          <!-- /.info-box -->
        </div>
        <!-- /.col -->
        <div class="col-md-3 col-sm-6 col-xs-12">
          <div class="info-box">
            <span class="info-box-icon bg-red"><i class="ion ion-home"></i></span>

            <div class="info-box-content">
              <span class="info-box-text">Apparts</span>
              <span class="info-box-number">
              <?PHP 
              $SelectUsers = $bdd->prepare('SELECT * FROM rooms'); 
              $SelectUsers->execute();
              echo $SelectUsers->rowCount();
              ?>
              </span>
            </div>
            <!-- /.info-box-content -->
          </div>
          <!-- /.info-box -->
        </div>
        <!-- /.col -->

        <!-- fix for small devices only -->
        <div class="clearfix visible-sm-block"></div>

        <div class="col-md-3 col-sm-6 col-xs-12">
          <div class="info-box">
            <span class="info-box-icon bg-green"><i class="ion ion-person"></i></span>

            <div class="info-box-content">
              <span class="info-box-text">En ligne</span>
              <span class="info-box-number"><?PHP echo $JoueurEnLigne; ?></span>
            </div>
            <!-- /.info-box-content -->
          </div>
          <!-- /.info-box -->
        </div>
        <!-- /.col -->
        <div class="col-md-3 col-sm-6 col-xs-12">
          <div class="info-box">
            <span class="info-box-icon bg-yellow"><i class="ion ion-arrow-up-c"></i></span>

            <div class="info-box-content">
              <span class="info-box-text">Record connecté</span>
              <span class="info-box-number"><?PHP echo $RecordCo; ?></span>
            </div>
            <!-- /.info-box-content -->
          </div>
          <!-- /.info-box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->

      <div class="row">
      <div class="col-md-6">
              <!-- USERS LIST -->
              <div class="box box-danger">
                <div class="box-header with-border">
                  <h3 class="box-title">Derniers membres</h3>

                  <div class="box-tools pull-right">
                    <span class="label label-danger">8 Derniers inscrit</span>
                  </div>
                </div>
                <!-- /.box-header -->
                <div class="box-body no-padding">
                  <ul class="users-list clearfix">
                  <?PHP 
                  $SelectInscrit = $bdd->prepare('SELECT * FROM users ORDER BY id DESC LIMIT 8');
                  $SelectInscrit->execute();
                  while ($info = $SelectInscrit->fetch()) { ?>
                    <li>
                      <img src="https://www.habbo.de/habbo-imaging/avatarimage?figure=<?PHP echo htmlspecialchars(trim($info['look'])); ?>&direction=2&head_direction=3&action=wav&size=m&gesture=sml&headonly=0fwrap" alt="User Image">
                      <a class="users-list-name" href="#"><?PHP echo htmlspecialchars(trim($info['username'])); ?></a>
                      <span class="users-list-date"><?PHP echo date('d.m.Y', $info['account_created']); ?></span>
                    </li>
                    <?PHP } ?>
                  </ul>
                  <!-- /.users-list -->
                </div>
                <!-- /.box-body -->
              </div>
              <!--/.box -->
            </div>
            <div class="col-xs-6">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">5 Dernières actions des staff's</h3>

              <div class="box-tools">
              </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding">
              <table class="table table-hover">
                <tbody><tr>
                  <th>Pseudo</th>
                  <th>Date</th>
                  <th>Action</th>
                </tr>
                <?PHP 
                  $SelectLog = $bdd->prepare('SELECT * FROM pluscms_logstaff ORDER BY id DESC LIMIT 5');
                  $SelectLog->execute();
                  while ($log = $SelectLog->fetch()) { ?>
                <tr>
                  <td><?PHP echo htmlentities($log['pseudo']); ?></td>
                  <td><?PHP echo date('d.m.Y', $log['date']); ?></td>
                  <td><?PHP echo $log['action']; ?></td>
                </tr>
                <?PHP } ?>
              </tbody></table>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  <footer class="main-footer">
    <div class="pull-right hidden-xs">
      <b>PlusCMS</b> 
    </div>
    <strong>Cette administration est conçu pour PlusCMS par Dodone.</strong>
  </footer>

  <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>

</div>
<!-- ./wrapper -->

<!-- jQuery 3 -->
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="bower_components/fastclick/lib/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
<!-- Sparkline -->
<script src="bower_components/jquery-sparkline/dist/jquery.sparkline.min.js"></script>
<!-- jvectormap  -->
<script src="plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<!-- SlimScroll -->
<script src="bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- ChartJS -->
<script src="bower_components/Chart.js/Chart.js"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<script src="dist/js/pages/dashboard2.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
</body>
</html>
