Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 6.76 KB | None | 0 0
  1.  
  2. <?php
  3. date_default_timezone_set("Asia/Jakarta");
  4. if (date('h')<12&&date('a')=="am") {
  5.     $theme = "sunrise";
  6. }
  7. else{
  8.     $theme = "sunset";
  9.     $time = "Sore";
  10. }
  11.  
  12. $time;
  13. ?>
  14.  <!DOCTYPE html>
  15.  <html>
  16. <head>
  17.  
  18. <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
  19. integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
  20. <link rel="stylesheet" type="text/css" href="<?=base_url()?>media/plugins/toastr/toastr.min.css">
  21. <link rel="stylesheet" type="text/css" href="<?=base_url()?>media/css/bootstrap.css">
  22. <script src="<?=base_url()?>media/js/jquery.min.js"></script>
  23. <script src="<?=base_url()?>media/js/bootstrap.min.js"></script>
  24.  
  25. <script src="<?=base_url()?>media/js/bootstrap.js"></script>
  26. <script src="<?=base_url()?>media/plugins/toastr/toastr.min.js"></script>
  27.     <style type="text/css">
  28.         <?php if ($theme === "sunset"): ?> 
  29.         table{
  30.             border: 2px solid darkred;
  31.         }
  32.         td{
  33.             text-align: center;
  34.         }
  35.         a{
  36.             text-decoration: none;
  37.             color: purple ;
  38.         }
  39.         a:hover{
  40.             color: cyan;
  41.             background-color: lightgray;
  42.         }
  43.         .action{
  44.             background-color: skyblue;
  45.             border:2px solid blue;
  46.             width: 100%;
  47.             height: 100%;
  48.         }
  49.         .action2{
  50.             background-color: skyblue;
  51.             border:2px solid blue;
  52.             width: 98%;
  53.             height: 100%;
  54.         }
  55.         .link{
  56.             background-color: red;
  57.         }
  58.         body{
  59.             background : linear-gradient(to right, red 20%,yellow);
  60.             background-size: 100%
  61.         }
  62.         .theme{
  63.             text-align: bottom;
  64.             margin-top: 5%;
  65.             margin-left:80%;
  66.             color: orange;
  67.             position: absolute;
  68.             font-size: 75px;
  69.  
  70.         }
  71.         <?php  else: $time = "Pagi"; ?>
  72.         table{
  73.             border: 2px solid lightblue;
  74.         }
  75.         td{
  76.             text-align: center;
  77.         }
  78.         a{
  79.             text-decoration: none;
  80.             color: purple ;
  81.         }
  82.         a:hover{
  83.             color: cyan;
  84.             background-color: lightgray;
  85.         }
  86.         .action{
  87.             background-color: skyblue;
  88.             border:2px solid blue;
  89.             width: 100%;
  90.             height: 100%;
  91.         }
  92.         .action2{
  93.             background-color: skyblue;
  94.             border:2px solid blue;
  95.             width: 98%;
  96.             height: 100%;
  97.         }
  98.         .link{
  99.             background-color: lightblue;
  100.         }
  101.        
  102.         body{
  103.             background : linear-gradient(to right, red 20%,yellow );
  104.             background-size: 100%
  105.         }
  106.         .theme{
  107.             text-align: bottom;
  108.             margin-top: 5%;
  109.             margin-left:80%;
  110.             color: orange;
  111.             position: absolute;
  112.             font-size: 75px;
  113.  
  114.         }
  115.     <?php endif; ?>
  116.     .search{
  117.         border-color: green;
  118.     }
  119.     .keyword{
  120.         width: 100%;
  121.     }
  122.     th{
  123.         text-align: center;
  124.     }
  125.     </style>
  126. </head>
  127.  
  128. <?php
  129. $nama_admin = $_SESSION['username'];
  130. ?>
  131. <body background="100%">
  132.    
  133. <table border="1" width="100%">
  134.     <thead>
  135.         <tr>
  136.             <td colspan="10">
  137.                 <h1>
  138.                     Selamat <?=$time." ".$nama_admin ?> ! <i class="fas fa-sign-out-alt"></i>
  139.                 </h1>
  140.             </td>
  141.         </tr>
  142.         <tr class="link">
  143.             <td class="link">
  144.                 <a href="tambah.php">
  145.                 <div class="btn-primary">
  146.                     Tambah Data
  147.                 </div>
  148.                 </a>
  149.             </td>
  150.             <td colspan="5">
  151.                 Data Siswa SMKN 4 Bandung
  152.             </td>
  153.             <form method="get" action="index.php" class="form-inline">
  154.             <td colspan="2" >
  155.                 <div class="d-inline">
  156.                     <input type="text" name="keyword" class="form-control col-md-10" value="<?=@$keyword ?>" placeholder="Masukan Keyword..." autocomplete="off">
  157.                     <button type="submit" class="btn btn-outline-success my-2 my-sm-0 search" name="search" value="🔎" align="left">search</button>
  158.                 </div>
  159.             </td>
  160.             <td align="center">
  161.             <a href="index.php">
  162.                 <div class="btn-primary btn-primary show">Tampilkan Semua</div>
  163.             </td>
  164.             </a>
  165.             </form>
  166.            
  167.             <td><a href="logout.php" class="btn btn-danger">Logout</a>  </td>
  168.         </tr>
  169.         <tr>
  170.             <th>#</th>
  171.             <th>
  172.                 Nis
  173.                 <a href="index.php?sort=nis&order=asc">↑</a>
  174.                 <a href="index.php?sort=nis&order=desc">↓</a>
  175.             </th>
  176.             <th>
  177.                 Nama Lengkap
  178.                 <a href="index.php?sort=nama_lengkap&order=asc">↑</a>
  179.                 <a href="index.php?sort=nama_lengkap&order=desc">↓</a>
  180.             </th>
  181.             <th>
  182.                 Jenis Kelamin
  183.             </th>
  184.             <th width="70">
  185.                 Kelas
  186.                 <a href="index.php?sort=kelas&order=asc">↑</a>
  187.                 <a href="index.php?sort=kelas&order=desc">↓</a>
  188.             </th>
  189.             <th>
  190.                 Jurusan
  191.             </th>
  192.             <th>   
  193.                 Alamat
  194.             </th>
  195.             <th>   
  196.                 Nama Ibu
  197.             </th>
  198.             <th>
  199.                 Golongan Darah
  200.                 <a href="index.php?sort=golongan_darah&order=asc">↑</a>
  201.                 <a href="index.php?sort=golongan_darah&order=desc">↓</a>
  202.             </th>
  203.             <th>
  204.                 Aksi
  205.             </th>
  206.         </tr>
  207.     </thead>
  208.  
  209.     <tbody>
  210.         <?php
  211.            
  212.             while ($siswa = $listsiswa ->fetch_array()) {
  213.               ?>
  214.               <tr>
  215.                 <td>
  216.                     <?php if(!empty($siswa['file'])): ?>
  217.                         <img width="120" height="100" src="asset/images/<?=$siswa['file']?>">
  218.                     <?php else:echo"Belum Ditambahkan"; endif?>
  219.                 </td>
  220.                 <td><?= $siswa['nis'] ?></td>
  221.                 <td><?= $siswa['nama_lengkap'] ?></td>
  222.                 <td><?= $siswa['jenis_kelamin'] ?></td>
  223.                 <td><?= $siswa['nama_kelas'] ?></td>
  224.                 <td><?= $siswa['jurusan'] ?></td>
  225.                 <td><?= $siswa['alamat'] ?></td>
  226.                 <td><?= $siswa['nama_ibu_kandung'] ?></td>
  227.                 <td><?= $siswa['golongan_darah'] ?></td>
  228.                
  229.                 <td style="padding: 5px;">
  230.                         <a class="btn btn-primary" href="edit.php?nis=<?= $siswa['nis'] ?>">Edit</a>
  231.                         <a class="btn btn-danger btnDelete" href="delete.php?nis=<?= $siswa['nis'] ?>">Hapus</a>
  232.                 </td>
  233.               </tr>
  234.             <?php } ?>
  235.     </tbody>
  236. </table>
  237. <h1 class="theme"><?=$theme=='sunset'?'Sunset':'Sunrise' ?></h1>
  238.  
  239.     <div class="modal modal=fade" tabindex="-1" role="dialog">
  240.         <div class="modal-dialog">
  241.             <div class="modal-content">
  242.                 <div class="modal-header">
  243.                     <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  244.                     <h4 class="modal-title"></h4>
  245.                 </div>
  246.                 <div class="modal-body">
  247.                    
  248.                 </div>
  249.                 <div class="modal-footer">
  250.                     <button type="button" class="btn btn-primary btnYa">Ya</button>
  251.                     <button type="button" class="btn btn-danger" data-dismiss="modal">Tidak</button>
  252.                 </div>
  253.             </div>
  254.         </div>
  255.     </div>
  256.  
  257. <script>
  258.     $(function(){
  259.         $(".btnDelete").on('click',function(){
  260.             event.preventDefault();
  261.  
  262.             var nama = $(this).parent().parent().children()[2];
  263.             nama = $(nama).html();
  264.             var tr = $(this).parent().parent();
  265.  
  266.             $(".modal").modal('show');
  267.             $(".modal-title").html("Konfirmasi");
  268.             $(".modal-body").html("Anda Yakin Ingin Menghapus <b>"+nama+"</b> ?");
  269.  
  270.             var href = $(this).attr('href');
  271.  
  272.             $(".btnYa").off();
  273.             $(".btnYa").on('click',function(){
  274.                 $.ajax({
  275.                     'url' : href,
  276.                     'type' : 'POST',
  277.                     'success' : function(result){
  278.                         if(result == 1){
  279.                             $('.modal').modal('hide');
  280.                             tr.fadeOut();
  281.  
  282.                             toastr.success("Data Berhasil Dihapus");
  283.                         }
  284.                     }
  285.                 });
  286.             });
  287.         });
  288.     });
  289. </script>
  290.  
  291. </body>
  292.  </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement