Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- .headtable{
- width:50%;
- background-color: #2eb8b8;
- padding: 8px;
- }
- .isitable{
- background-color: #f2f2f2;
- width: 100px;
- }
- </style>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>CRJUL</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">-->
- </head>
- <div class="panel panel-info">
- <div class="panel-heading"><center><h4>Tabel Naskah Masuk</center></h4></div>
- <div class="panel-body">
- <?php
- require 'koneksi.php';
- koneksi_buka();
- ?>
- <div style="overflow-x:auto;">
- <table class="table table-condensed table-bordered table-hover" cellpadding="0" cellspacing="0">
- <thead>
- <tr>
- <th class="headtable">No.</th>
- <th class="headtable"> Kode Naskah</th>
- <th class="headtable">Tanggal</th>
- <th class="headtable">Alamat Pengirim</th>
- <th class="headtable">Telpon</th>
- <th class="headtable">E-mail</th>
- <th class="headtable">Judul Naskah</th>
- <th class="headtable">Penulis</th>
- <th class="headtable">Format Naskah</th>
- <th class="headtable">Isi Naskah</th>
- <th class="headtable">Keterangan</th>
- <th class="headtable">Kelengkapan Naskah</th>
- <!--<th style="width:100px">Jenjang</th>
- <th style="width:100px">Kategori</th>
- <th style="width:100px">Tanggal Screening</th>
- <th style="width:100px">Hasil Screening</th> -->
- <th class="headtable">Status</th>
- <th>Edit & Delete</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $i = 1;
- $jml_per_halaman = 10;
- $jml_data = mysql_num_rows(mysql_query("SELECT * FROM tabledata"));
- $jml_halaman = ceil($jml_data / $jml_per_halaman);
- if(isset($_POST['cari'])) {
- $kunci = $_POST['cari'];
- echo "<strong>Hasil pencarian untuk kata kunci $kunci</strong>";
- $query = mysql_query("
- SELECT * FROM tabledata
- WHERE kode_nas LIKE '%$kunci%'
- OR tanggal LIKE '%$kunci%'
- OR alamat LIKE '%$kunci%'
- OR telpon LIKE '%$kunci%'
- OR email LIKE '%$kunci%'
- OR judul LIKE '%$kunci%'
- OR nama LIKE '%$kunci%'
- OR format_nas LIKE '%$kunci%'
- OR isi_naskah LIKE '%$kunci%'
- OR keterangan LIKE '%$kunci%'
- OR lengkap_nas LIKE '%$kunci%'
- OR jenjang LIKE '%$kunci%'
- OR kategori LIKE '%$kunci%'
- OR tanggal_screening LIKE '%$kunci%'
- OR hasil_screening LIKE '%$kunci%'
- OR status LIKE '%$kunci%'
- ");
- } elseif(isset($_POST['halaman'])) {
- $halaman = $_POST['halaman'];
- $i = ($halaman - 1) * $jml_per_halaman + 1;
- $query = mysql_query("SELECT * FROM tabledata LIMIT ".(($halaman - 1) * $jml_per_halaman).", $jml_per_halaman");
- } else {
- $query = mysql_query("SELECT * FROM tabledata LIMIT 0, $jml_per_halaman");
- $halaman = 1;
- }
- while($data = mysql_fetch_array($query)) {
- if($data['status']==1) {
- $status = "YES";
- } else {
- $status = "NO";
- }
- ?>
- <tr>
- <td class="isitable"><?php echo $i ?></td>
- <td class="isitable"><?php echo $data['kode_nas'] ?></td>
- <td class="isitable"><?php echo date('d-m-y'); $data['tanggal'] ?></td>
- <td class="isitable"><?php echo $data['alamat'] ?></td>
- <td class="isitable"><?php echo $data['telpon'] ?></td>
- <td class="isitable"><?php echo $data['email'] ?></td>
- <td class="isitable"><?php echo $data['judul'] ?></td>
- <td class="isitable"><?php echo $data['nama'] ?></td>
- <td class="isitable"><?php echo $data['format_nas'] ?></td>
- <td class="isitable"><?php echo $data['isi_naskah'] ?></td>
- <td class="isitable"><?php echo $data['keterangan'] ?></td>
- <td class="isitable"><?php echo $data['lengkap_nas'] ?></td>
- <!--<td><?php echo $data['jenjang'] ?></td>
- <td><?php echo $data['kategori'] ?></td>
- <td><?php echo $data['tanggal_screening'] ?></td>
- <td><?php echo $data['hasil_screening'] ?></td> -->
- <td class="isitable"><?php echo $status ?></td>
- <td>
- <a href="#dialog-tabledata" id="<?php echo $data['kd_id'] ?>" class="ubah" data-toggle="modal">
- <i class="icon-pencil"></i>
- </a>
- <a href="#" id="<?php echo $data['kd_id'] ?>" class="hapus">
- <i class="icon-trash"></i>
- </a>
- </td>
- </tr>
- <?php
- $i++;
- }
- ?>
- </tbody>
- </table>
- <?php if(!isset($_POST['cari'])) { ?>
- <div class="pagination pagination-right">
- <ul>
- <?php
- $no_hal_tampil = 5;
- if ($jml_halaman <= $no_hal_tampil) {
- $no_hal_awal = 1;
- $no_hal_akhir = $jml_halaman;
- } else {
- $val = $no_hal_tampil - 2; //3
- $mod = $halaman % $val; //
- $kelipatan = ceil($halaman/$val);
- $kelipatan2 = floor($halaman/$val);
- if($halaman < $no_hal_tampil) {
- $no_hal_awal = 1;
- $no_hal_akhir = $no_hal_tampil;
- } elseif ($mod == 2) {
- $no_hal_awal = $halaman - 1;
- $no_hal_akhir = $kelipatan * $val + 2;
- } else {
- $no_hal_awal = ($kelipatan2 - 1) * $val + 1;
- $no_hal_akhir = $kelipatan2 * $val + 2;
- }
- if($jml_halaman <= $no_hal_akhir) {
- $no_hal_akhir = $jml_halaman;
- }
- }
- for($i = $no_hal_awal; $i <= $no_hal_akhir; $i++) {
- $aktif = $i == $halaman ? ' active' : '';
- ?>
- <li class="halaman<?php echo $aktif ?>" id="<?php echo $i ?>"><a href="#"><?php echo $i ?></a></li>
- <?php } ?>
- </ul>
- </div>
- <?php } ?>
- <?php
- koneksi_tutup();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement