<?php
include 'config/conn.php';
error_reporting(0);
session_start();


// akses mac perangkat



//akhir akses mac perangkat
//untuk log aktivitas
include 'config/activity.php';

if ($_SESSION['namauser']) {

  include 'config/rupiah.php';
  include 'lib/function.php';
  $idletime = 10 * 6000;

  if (isset($_SESSION["timestamp"])) {
    if (time() - $_SESSION["timestamp"] > $idletime) {
      session_destroy();
      echo "<script>alert('Waktu Login Anda Telah Habis !'); window.location = 'index.php'</script>";
    }
  } else {
    $_SESSION["timestamp"] = time();
  }

  //pembuatan session timestamp
  $_SESSION["timestamp"] = time();
?>
  <!DOCTYPE html>
  <html lang="en">

  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" href="logo.ico">

    <!-- <meta http-equiv="refresh" content="2" /> -->

    <title><?php echo $_GET['module']; ?> E-Keu PTMA </title>

    <!-- Bootstrap -->
    <link href="plugins/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <link href="plugins/nprogress/nprogress.css" rel="stylesheet">
    <!-- iCheck -->
    <link href="plugins/iCheck/skins/flat/green.css" rel="stylesheet">

    <!-- bootstrap-progressbar -->
    <link href="plugins/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
    <!-- JQVMap -->
    <link href="plugins/jqvmap/dist/jqvmap.min.css" rel="stylesheet" />

    <!-- alert -->


    <!-- Datatables -->
    <link href="plugins/datatables.net-bs/css/dataTables.bootstrap.min.css" rel="stylesheet">
    <link href="plugins/vendors/datatables.net-buttons-bs/css/buttons.bootstrap.min.css" rel="stylesheet">
    <link href="plugins/datatables.net-fixedheader-bs/css/fixedHeader.bootstrap.min.css" rel="stylesheet">
    <link href="plugins/datatables.net-responsive-bs/css/responsive.bootstrap.min.css" rel="stylesheet">
    <link href="plugins/datatables.net-scroller-bs/css/scroller.bootstrap.min.css" rel="stylesheet">

    <link href="plugins/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.min.css" rel="stylesheet" />
    <!-- Custom Theme Style -->
    <link href="build/css/custom.min.css" rel="stylesheet">
    <link rel="stylesheet" href="build/datepicker.css">
    <link rel='stylesheet' href='plugins/sweetalert2.min.css'>
    <style>
      .datepicker {
        z-index: 1151;
      }

      .body {
        padding-top: 78px;
      }
    </style>

    <script>
      function startTime() {
        var today = new Date();
        var h = today.getHours();
        var m = today.getMinutes();
        var s = today.getSeconds();
        m = checkTime(m);
        s = checkTime(s);
        document.getElementById('txt').innerHTML =
          h + ":" + m + ":" + s;
        var t = setTimeout(startTime, 500);
      }

      function checkTime(i) {
        if (i < 10) {
          i = "0" + i
        }; // add zero in front of numbers < 10
        return i;
      }
    </script>

    <style>
      /* Style the button that is used to open and close the collapsible content */
      .collapsible {
        background-color: slategray;
        color: snow;
        cursor: pointer;
        padding: 18px;
        width: 100%;
        border: none;
        text-align: left;
        outline: none;
        font-size: 15px;
      }

      /* Add a background color to the button if it is clicked on (add the .active class with JS), and when you move the mouse over it (hover) */
      .active,
      .collapsible:hover {
        background-color: darkslateblue;
      }
    </style>




    <script>
      $(document).ready(function() {
        $('#datatable1').DataTable(); // Inisialisasi tabel pertama
        $('#datatable2').DataTable(); // Inisialisasi tabel kedua
      });
    </script>



    <!-- animate CSS
		============================================ -->
    <link rel="stylesheet" href="build/css/animate.css">



    <!-- style CSS
		============================================ -->
    <link rel="stylesheet" href="style.css">
    <!-- responsive CSS
		============================================ -->
    <!-- <link rel="stylesheet" href="build/css/responsive.css"> -->
    <!-- modernizr JS
		============================================ -->
    <!-- <script src="//cdn.jsdelivr.net/npm/sweetalert2@10"></script> -->
    <script src="plugins/alert.js"></script>
    <script src="plugins/fungsi_alert.js"></script>

  </head>

  <body class="nav-md footer_fixed">



    <div class="container body">
      <div class="">
        <!-- top navigation -->
        <?php 
        if($_SESSION['leveluser']=="admin"){
          include 'component/menu.php'; 
        }else{


        if ($_SESSION['id_divisi']=="3") {
        include 'component/menu_sd.php';   
        }elseif($_SESSION['id_divisi']=="2"){
        include 'component/menutk.php';    
        }else{
        include 'component/menu_lain.php';    
        }

      }
        
         ?>
        <!-- /top navigation -->

        <!-- page content -->
        <div class="middle_col" role="main">
          <?php include 'main.php'; ?>
        </div>
        <!-- /page content -->

        <!-- footer content -->
        <br><br>
        <footer>
          <div id="txt" class="pull-left" style="font-weight:bolder;"></div>
          <div class="pull-right">
            Copyright © 2021 V1.7 | Developed by BSC for Pondok Tahfidz Modern Al-Imam
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
      </div>
    </div>

    <script>
      //Memanggil fungsi jam realtime
      startTime();
    </script>



    <!-- jQuery -->
    <script src="plugins/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="plugins/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="plugins/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="plugins/nprogress/nprogress.js"></script>

    <!-- gauge.js -->
    <script src="plugins/gauge.js/dist/gauge.min.js"></script>
    <!-- bootstrap-progressbar -->
    <script src="plugins/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
    <!-- iCheck -->
    <script src="plugins/iCheck/icheck.min.js"></script>
    <!-- Skycons -->
    <script src="plugins/skycons/skycons.js"></script>

    <!-- DateJS -->
    <script src="plugins/DateJS/build/date.js"></script>



    <!-- bootstrap-daterangepicker -->
    <script src="plugins/moment/min/moment.min.js"></script>

    <!-- Datatables -->
    <script src="plugins/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="plugins/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="plugins/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="plugins/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="plugins/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="plugins/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="plugins/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="plugins/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="plugins/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="plugins/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="plugins/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="plugins/datatables.net-scroller/js/dataTables.scroller.min.js"></script>


    <script src="plugins/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min.js"></script>

    <script src="plugins/bootstrap3-typeahead.min.js"></script>
    <!-- Custom Theme Scripts -->
    <script src="build/js/custom.min.js"></script>

    <script src="js/bootstrap-datepicker.js"></script>
    <script src="js/bootstrap-modal.js"></script>
    <script src="js/bootstrap-transition.js"></script>

    <script src="js/pendukung.js"></script>


    <!-- CARA MENGATASI halaman Confirm Form Resubmission DENGAN JAVASCRIPT -->
    <!-- <script>
      if (window.history.replaceState) {
        window.history.replaceState(null, null, window.location.href);
      }
    </script> -->







  </body>

  </html>


<?php  } else {
  include 'login.php';
} ?>