Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- date_default_timezone_set("Asia/Jakarta");
- if (date('h')<12&&date('a')=="am") {
- $theme = "sunrise";
- }
- else{
- $theme = "sunset";
- $time = "Sore";
- }
- $time;
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
- integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
- <link rel="stylesheet" type="text/css" href="<?=base_url()?>media/plugins/toastr/toastr.min.css">
- <link rel="stylesheet" type="text/css" href="<?=base_url()?>media/css/bootstrap.css">
- <script src="<?=base_url()?>media/js/jquery.min.js"></script>
- <script src="<?=base_url()?>media/js/bootstrap.min.js"></script>
- <script src="<?=base_url()?>media/js/bootstrap.js"></script>
- <script src="<?=base_url()?>media/plugins/toastr/toastr.min.js"></script>
- <style type="text/css">
- <?php if ($theme === "sunset"): ?>
- table{
- border: 2px solid darkred;
- }
- td{
- text-align: center;
- }
- a{
- text-decoration: none;
- color: purple ;
- }
- a:hover{
- color: cyan;
- background-color: lightgray;
- }
- .action{
- background-color: skyblue;
- border:2px solid blue;
- width: 100%;
- height: 100%;
- }
- .action2{
- background-color: skyblue;
- border:2px solid blue;
- width: 98%;
- height: 100%;
- }
- .link{
- background-color: red;
- }
- body{
- background : linear-gradient(to right, red 20%,yellow);
- background-size: 100%
- }
- .theme{
- text-align: bottom;
- margin-top: 5%;
- margin-left:80%;
- color: orange;
- position: absolute;
- font-size: 75px;
- }
- <?php else: $time = "Pagi"; ?>
- table{
- border: 2px solid lightblue;
- }
- td{
- text-align: center;
- }
- a{
- text-decoration: none;
- color: purple ;
- }
- a:hover{
- color: cyan;
- background-color: lightgray;
- }
- .action{
- background-color: skyblue;
- border:2px solid blue;
- width: 100%;
- height: 100%;
- }
- .action2{
- background-color: skyblue;
- border:2px solid blue;
- width: 98%;
- height: 100%;
- }
- .link{
- background-color: lightblue;
- }
- body{
- background : linear-gradient(to right, red 20%,yellow );
- background-size: 100%
- }
- .theme{
- text-align: bottom;
- margin-top: 5%;
- margin-left:80%;
- color: orange;
- position: absolute;
- font-size: 75px;
- }
- <?php endif; ?>
- .search{
- border-color: green;
- }
- .keyword{
- width: 100%;
- }
- th{
- text-align: center;
- }
- </style>
- </head>
- <?php
- $nama_admin = $_SESSION['username'];
- ?>
- <body background="100%">
- <table border="1" width="100%">
- <thead>
- <tr>
- <td colspan="10">
- <h1>
- Selamat <?=$time." ".$nama_admin ?> ! <i class="fas fa-sign-out-alt"></i>
- </h1>
- </td>
- </tr>
- <tr class="link">
- <td class="link">
- <a href="tambah.php">
- <div class="btn-primary">
- Tambah Data
- </div>
- </a>
- </td>
- <td colspan="5">
- Data Siswa SMKN 4 Bandung
- </td>
- <form method="get" action="index.php" class="form-inline">
- <td colspan="2" >
- <div class="d-inline">
- <input type="text" name="keyword" class="form-control col-md-10" value="<?=@$keyword ?>" placeholder="Masukan Keyword..." autocomplete="off">
- <button type="submit" class="btn btn-outline-success my-2 my-sm-0 search" name="search" value="🔎" align="left">search</button>
- </div>
- </td>
- <td align="center">
- <a href="index.php">
- <div class="btn-primary btn-primary show">Tampilkan Semua</div>
- </td>
- </a>
- </form>
- <td><a href="logout.php" class="btn btn-danger">Logout</a> </td>
- </tr>
- <tr>
- <th>#</th>
- <th>
- Nis
- <a href="index.php?sort=nis&order=asc">↑</a>
- <a href="index.php?sort=nis&order=desc">↓</a>
- </th>
- <th>
- Nama Lengkap
- <a href="index.php?sort=nama_lengkap&order=asc">↑</a>
- <a href="index.php?sort=nama_lengkap&order=desc">↓</a>
- </th>
- <th>
- Jenis Kelamin
- </th>
- <th width="70">
- Kelas
- <a href="index.php?sort=kelas&order=asc">↑</a>
- <a href="index.php?sort=kelas&order=desc">↓</a>
- </th>
- <th>
- Jurusan
- </th>
- <th>
- Alamat
- </th>
- <th>
- Nama Ibu
- </th>
- <th>
- Golongan Darah
- <a href="index.php?sort=golongan_darah&order=asc">↑</a>
- <a href="index.php?sort=golongan_darah&order=desc">↓</a>
- </th>
- <th>
- Aksi
- </th>
- </tr>
- </thead>
- <tbody>
- <?php
- while ($siswa = $listsiswa ->fetch_array()) {
- ?>
- <tr>
- <td>
- <?php if(!empty($siswa['file'])): ?>
- <img width="120" height="100" src="asset/images/<?=$siswa['file']?>">
- <?php else:echo"Belum Ditambahkan"; endif?>
- </td>
- <td><?= $siswa['nis'] ?></td>
- <td><?= $siswa['nama_lengkap'] ?></td>
- <td><?= $siswa['jenis_kelamin'] ?></td>
- <td><?= $siswa['nama_kelas'] ?></td>
- <td><?= $siswa['jurusan'] ?></td>
- <td><?= $siswa['alamat'] ?></td>
- <td><?= $siswa['nama_ibu_kandung'] ?></td>
- <td><?= $siswa['golongan_darah'] ?></td>
- <td style="padding: 5px;">
- <a class="btn btn-primary" href="edit.php?nis=<?= $siswa['nis'] ?>">Edit</a>
- <a class="btn btn-danger btnDelete" href="delete.php?nis=<?= $siswa['nis'] ?>">Hapus</a>
- </td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
- <h1 class="theme"><?=$theme=='sunset'?'Sunset':'Sunrise' ?></h1>
- <div class="modal modal=fade" tabindex="-1" role="dialog">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
- <h4 class="modal-title"></h4>
- </div>
- <div class="modal-body">
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-primary btnYa">Ya</button>
- <button type="button" class="btn btn-danger" data-dismiss="modal">Tidak</button>
- </div>
- </div>
- </div>
- </div>
- <script>
- $(function(){
- $(".btnDelete").on('click',function(){
- event.preventDefault();
- var nama = $(this).parent().parent().children()[2];
- nama = $(nama).html();
- var tr = $(this).parent().parent();
- $(".modal").modal('show');
- $(".modal-title").html("Konfirmasi");
- $(".modal-body").html("Anda Yakin Ingin Menghapus <b>"+nama+"</b> ?");
- var href = $(this).attr('href');
- $(".btnYa").off();
- $(".btnYa").on('click',function(){
- $.ajax({
- 'url' : href,
- 'type' : 'POST',
- 'success' : function(result){
- if(result == 1){
- $('.modal').modal('hide');
- tr.fadeOut();
- toastr.success("Data Berhasil Dihapus");
- }
- }
- });
- });
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement