<?php
session_start();
ini_set('date.timezone', 'Asia/Jakarta');
require_once "./class/library.php";
$lib= new library();
$p=@$_GET["p"];
if(!isset($_SESSION['ses_knn_admin_id']))
{ 
	header("location:login.php");
	exit;
} 

$tipe_user_nama="";
$tipe_user=0;
$foto_profil= (@$_SESSION['ses_knn_admin_foto']=="") ? "default.jpg" : @$_SESSION['ses_knn_admin_foto'];
if(@$_SESSION['ses_knn_admin_tipe']==1) { $tipe_user_nama="Petugas"; $tipe_user=1; } 
elseif(@$_SESSION['ses_knn_admin_tipe']==2) { $tipe_user_nama="Administrator"; $tipe_user=2; }
?>
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link rel="apple-touch-icon" sizes="76x76" href="../assets/img/favicon.png">
  <link rel="icon" type="image/png" href="../assets/img/favicon.png">
  <title>Aplikasi Metode K-Nearest Neighbor | Metode KNN | Anindyadev.com</title>
  <meta name="description" content="Source Code aplikasi metode K-Nearest Neighbor (Metode KNN), Metode ANN/JST untuk klasifikasi, dapat digunakan untuk belajar dan atau dikembangkan untuk pengerjaan Tugas Akhir atau Skripsi. anindyadev.com siap membantu untuk pengembangan ataupun judul-judul lain diluar source code program aplikasi yang sudah ada.">
  <meta name="keywords" content="k-nearest neighbor, metode knn, lvq, jst, ann, jaringan syaraf tiruan, artificial neural network, demo aplikasi, software, klasifikasi, anindyadev.com"> 
  <!-- Fonts and icons -->
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet" />
  <!-- Nucleo Icons -->
  <link href="../assets/css/nucleo-icons.css" rel="stylesheet" />
  <link href="../assets/css/nucleo-svg.css" rel="stylesheet" />
  <!-- Font Awesome Icons -->
  <script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script>
  <link href="../assets/css/nucleo-svg.css" rel="stylesheet" />
  <!-- CSS Files -->
  <link id="pagestyle" href="../assets/css/argon-dashboard.css?v=2.0.4" rel="stylesheet" />
  <link rel="stylesheet" href="../assets/css/tabel.css">
  <link rel="stylesheet" href="../plugins/select2/css/select2.css">
	<link rel="stylesheet" href="../plugins/datatables-bs4/css/dataTables.bootstrap4.css">
</head>

<body class="g-sidenav-show bg-gray-100">
  <div class="min-height-300 bg-primary position-absolute w-100"></div>
  <aside class="sidenav bg-white navbar navbar-vertical navbar-expand-xs border-0 border-radius-xl my-3 fixed-start ms-4 " id="sidenav-main">
    <div class="sidenav-header">
      <i class="fas fa-times p-3 cursor-pointer text-secondary opacity-5 position-absolute end-0 top-0 d-none d-xl-none" aria-hidden="true" id="iconSidenav"></i>
      <a class="navbar-brand m-0" href=" https://demos.creative-tim.com/argon-dashboard/pages/dashboard.html " target="_blank">
        <img src="../assets/img/favicon.png" class="navbar-brand-img h-100" alt="logo">
        <span class="ms-1 font-weight-bold">Aplikasi Metode KNN</span>
      </a>
    </div>
    <hr class="horizontal dark mt-0">
    <div class="collapse navbar-collapse  w-auto " id="sidenav-collapse-main">
      <ul class="navbar-nav">
        <li class="nav-item">
          <a class="nav-link <?php if($p=="dashboard" || $p=="") { echo "active bg-primary text-white"; } ?>" href="?p=dashboard">
            <div class="icon icon-shape icon-sm border-radius-md text-center me-2 d-flex align-items-center justify-content-center">
              <i class="ni ni-tv-2 <?php if($p=="dashboard" || $p=="") { echo "text-white"; } else {  echo "text-primary"; } ?> text-sm opacity-10"></i>
            </div>
            <span class="nav-link-text ms-1">Dashboard</span>
          </a>
        </li>
        <li class="nav-item">
          <a class="nav-link <?php if($p=="testing" || $p=="testing-input") { echo "active bg-primary text-white"; } ?>" href="?p=testing">
            <div class="icon icon-shape icon-sm border-radius-md text-center me-2 d-flex align-items-center justify-content-center">
              <i class="ni ni-folder-17 <?php if($p=="testing" || $p=="testing-input") { echo "text-white"; } else {  echo "text-warning"; } ?> text-sm opacity-10"></i>
            </div>
            <span class="nav-link-text ms-1">Data Testing</span>
          </a>
        </li>
        <li class="nav-item">
          <a class="nav-link <?php if($p=="testing-import") { echo "active bg-primary text-white"; } ?>" href="?p=testing-import">
            <div class="icon icon-shape icon-sm border-radius-md text-center me-2 d-flex align-items-center justify-content-center">
              <i class="ni ni-cloud-upload-96 <?php if($p=="testing-import") { echo "text-white"; } else { echo "text-info"; } ?> text-sm opacity-10"></i>
            </div>
            <span class="nav-link-text ms-1">Import Testing (CSV)</span>
          </a>
        </li>
        <li class="nav-item">
          <a class="nav-link <?php if($p=="training" || $p=="training-input") { echo "active bg-primary text-white"; } ?>" href="?p=training">
            <div class="icon icon-shape icon-sm border-radius-md text-center me-2 d-flex align-items-center justify-content-center">
              <i class="ni ni-credit-card  <?php if($p=="training" || $p=="training-input") { echo "text-white"; } else {  echo "text-success"; } ?> text-sm opacity-10"></i>
            </div>
            <span class="nav-link-text ms-1">Data Training</span>
          </a>
        </li>
        <li class="nav-item mt-3">
          <h6 class="ps-4 ms-2 text-uppercase text-xs font-weight-bolder opacity-6">Pengaturan</h6>
        </li>
        <li class="nav-item">
          <a class="nav-link <?php if($p=="kriteria" || $p=="kriteria-input") { echo "active bg-primary text-white"; } ?>" href="?p=kriteria">
            <div class="icon icon-shape icon-sm border-radius-md text-center me-2 d-flex align-items-center justify-content-center">
              <i class="ni ni-box-2  <?php if($p=="kriteria" || $p=="kriteria-input") { echo "text-white"; } else {  echo "text-primary"; } ?> text-sm opacity-10"></i>
            </div>
            <span class="nav-link-text ms-1">Kriteria</span>
          </a>
        </li>
        <li class="nav-item">
          <a class="nav-link <?php if($p=="kriteria-nilai" || $p=="kriteria-nilai-input") { echo "active bg-primary text-white"; } ?>" href="?p=kriteria-nilai">
            <div class="icon icon-shape icon-sm border-radius-md text-center me-2 d-flex align-items-center justify-content-center">
              <i class="ni ni-single-copy-04  <?php if($p=="kriteria-nilai" || $p=="kriteria-nilai-input") { echo "text-white"; } else {  echo "text-warning"; } ?> text-sm opacity-10"></i>
            </div>
            <span class="nav-link-text ms-1">Kriteria Nilai</span>
          </a>
        </li>
        <li class="nav-item">
          <a class="nav-link <?php if($p=="administrator" || $p=="administrator-input") { echo "active bg-primary text-white"; } ?>" href="?p=administrator">
            <div class="icon icon-shape icon-sm border-radius-md text-center me-2 d-flex align-items-center justify-content-center">
              <i class="ni ni ni-single-02 <?php if($p=="administrator" || $p=="administrator-input") { echo "text-white"; } else {  echo "text-info"; } ?> text-sm opacity-10"></i>
            </div>
            <span class="nav-link-text ms-1">Administrator</span>
          </a>
        </li>
      </ul>
    </div>
    
  </aside>
  <main class="main-content position-relative border-radius-lg ">
    <!-- Navbar -->
    <nav class="navbar navbar-main navbar-expand-lg px-0 mx-4 shadow-none border-radius-xl " id="navbarBlur" data-scroll="false">
      <div class="container-fluid py-1 px-3">
        <div class="collapse navbar-collapse mt-sm-0 mt-2 me-md-0 me-sm-4" id="navbar">
          <div class="ms-md-auto pe-md-3 d-flex align-items-center">
          </div>
          <div class="ms-md-auto pe-md-3 d-xl-none d-flex align-items-center">
              <a href="javascript:;" class="nav-link text-white p-0" id="iconNavbarSidenav">
                <div class="sidenav-toggler-inner">
                  <i class="sidenav-toggler-line bg-white"></i>
                  <i class="sidenav-toggler-line bg-white"></i>
                  <i class="sidenav-toggler-line bg-white"></i>
                </div>
              </a>
          </div>          
          <ul class="navbar-nav justify-content-end">
            <li class="nav-item px-2 d-flex align-items-center">
              <a href="javascript:;" class="nav-link text-white p-0">
                <i class="fa fa-user fixed-plugin-button-nav cursor-pointer"></i>
                <span class="d-sm-inline">Administrator |</span>
              </a>
            </li>
            <li class="nav-item px-3 d-flex align-items-center">
              <a href="logout.php" class="nav-link text-white px-0">
                <i class="fa fa-sign-out me-sm-1"></i>
                <span class="d-sm-inline">Sign Out</span>
              </a>
            </li>
            <li class="nav-item d-flex align-items-center">
              <a href="?p=password" class="nav-link text-white px-0">
                <i class="fa fa-key me-sm-1"></i>
                <span class="d-sm-inline d-none">Ubah Password</span>
              </a>
            </li>
          </ul>
        </div>
      </div>
    </nav>
    <!-- End Navbar -->
    <div class="container-fluid py-4">

      <?php
        switch ($p) {
          case "testing":
            include ("lst_testing.php");
            break;
          case "testing-input":
            include ("inp_testing.php");
            break;
          case "testing-import":
            include ("imp_testing.php");
            break;
          case "perhitungan":
            include ("lst_perhitungan.php");
            break;					
          case "training":
            include ("lst_training.php");
            break;
          case "training-input":
            include ("inp_training.php");
            break;
          case "pohon":
            include ("lst_pohon_lvq.php");
            break;
          case "kriteria":
            include ("lst_kriteria.php");
            break;
          case "kriteria-input":
            include ("inp_kriteria.php");
            break;
          case "kriteria-nilai":
            include ("lst_kriteria_nilai.php");
            break;
          case "kriteria-nilai-input":
            include ("inp_kriteria_nilai.php");
            break;
          case "administrator":
            include ("lst_administrator.php");
            break;
          case "administrator-input":
            include ("inp_administrator.php");
            break;
          case "password":
            include ("inp_password.php");
            break;
          case "foto":
            include ("inp_foto.php");
            break;
          default:
            include ("beranda.php");
        }
			?>

     
    </div>
  </main>

  <!--   Core JS Files   -->
  <script src="../plugins/jquery/jquery.min.js"></script>
  <script src="../assets/js/core/popper.min.js"></script>
  <script src="../assets/js/core/bootstrap.min.js"></script>
  <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="../assets/js/plugins/perfect-scrollbar.min.js"></script>
  <script src="../assets/js/plugins/smooth-scrollbar.min.js"></script>
  <script src="../plugins/select2/js/select2.full.min.js"></script>	
  <script src="../plugins/datatables/jquery.dataTables.js"></script>
  <script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.js"></script>
  <script src="../assets/js/validator.min.js"></script>
  
  <script>
    var win = navigator.platform.indexOf('Win') > -1;
    if (win && document.querySelector('#sidenav-scrollbar')) {
      var options = {
        damping: '0.5'
      }
      Scrollbar.init(document.querySelector('#sidenav-scrollbar'), options);
    }

    $(document).ready(function() {
		      
      //Modal Hapus
      $('.openHapus').on('click',function(){
        var dataURL = $(this).attr('data-href');
        var dataTitle = $(this).attr('data-title');
        $('.modal-title').text('Hapus Data?'); 
        $('.modal-body').html('Anda yakin akan menghapus data <b>'+dataTitle+'</b> ini?'); 
        $('.modal-footer').html('<button type="button" class="btn btn-default" data-bs-dismiss="modal">Batal</button><a href="'+dataURL+'" class="btn btn-danger">Hapus</a>'); 
        $('#modalHapus').modal('show');
      }); 

      //Datatable
      $("#tabel_data_simple,#tabel_data_simple2").DataTable({
          "paging": true,
          "lengthChange": false,
          "searching": false,
          "ordering": false,
          "info": false,
          "autoWidth": false,	
          "language": {
            "paginate": {
              "previous": "<i class='fa fa-chevron-left'></i>",
              "next": "<i class='fa fa-chevron-right'></i>",            
            }
          }

      });
      
      var t = $('#tabel_data').DataTable( {	
        "oLanguage": {
          "sSearch": "Pencarian:",
          "sLengthMenu": "Tampilkan _MENU_ baris",
          "sZeroRecords": "Data tidak ditemukan (kosong).",
          "sInfo": "Baris (_START_ sampai _END_) dari total _TOTAL_ baris",
          "sInfoEmpty": "Nol (0) Baris",
          "sInfoFiltered": " - dari _MAX_ baris"
        },

        "language": {
          "paginate": {
            "previous": "<i class='fa fa-chevron-left'></i>",
            "next": "<i class='fa fa-chevron-right'></i>",            
          }
        },

        "columnDefs": [ {
          "searchable": false,
          "orderable": false,
          "targets": 'no_sort'
        } ],
              
        "order": [ ]
      
      } );
    
      t.on( 'order.dt search.dt', function () {
        t.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
          cell.innerHTML = i+1;
        } );
      } ).draw();
      
      $('.select2').select2();
      // form repeater Initialization
      $('.repeater').repeater({
          isFirstItemUndeletable: true,

          show: function () {
            $(this).find('span').remove();
            $(this).find('select').select2({});
            $(this).slideDown();
          },
          hide: function (deleteElement) {
          if (confirm('Are you sure you want to delete this element?')) {
            $(this).slideUp(deleteElement);
            hapus_item();
          }
          }


      });
      
    });
  </script>
  <!-- Github buttons -->
  <script async defer src="https://buttons.github.io/buttons.js"></script>
  <!-- Control Center for Soft Dashboard: parallax effects, scripts for the example pages etc -->
  <script src="../assets/js/argon-dashboard.min.js?v=2.0.4"></script>
</body>

</html>