Advertisement
geratno

Untitled

Jul 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.29 KB | None | 0 0
  1.  
  2. <style>
  3.  
  4. .headtable{
  5. width:50%;
  6. background-color: #2eb8b8;
  7. padding: 8px;
  8. }
  9.  
  10. .isitable{
  11. background-color: #f2f2f2;
  12. width: 100px;
  13. }
  14.  
  15.  
  16. </style>
  17.  
  18.  
  19.  
  20. <!DOCTYPE html>
  21. <html lang="en">
  22. <head>
  23. <meta charset="utf-8">
  24. <title>CRJUL</title>
  25. <meta charset="utf-8">
  26. <meta name="viewport" content="width=device-width, initial-scale=1">
  27.  
  28. <!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">-->
  29.  
  30. </head>
  31.  
  32.  
  33.  
  34. <div class="panel panel-info">
  35. <div class="panel-heading"><center><h4>Tabel Naskah Masuk</center></h4></div>
  36. <div class="panel-body">
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. <?php
  50.  
  51. require 'koneksi.php';
  52.  
  53.  
  54. koneksi_buka();
  55.  
  56. ?>
  57.  
  58.  
  59.  
  60. <div style="overflow-x:auto;">
  61.  
  62.  
  63. <table class="table table-condensed table-bordered table-hover" cellpadding="0" cellspacing="0">
  64. <thead>
  65. <tr>
  66. <th class="headtable">No.</th>
  67. <th class="headtable"> Kode Naskah</th>
  68. <th class="headtable">Tanggal</th>
  69. <th class="headtable">Alamat Pengirim</th>
  70. <th class="headtable">Telpon</th>
  71. <th class="headtable">E-mail</th>
  72. <th class="headtable">Judul Naskah</th>
  73. <th class="headtable">Penulis</th>
  74. <th class="headtable">Format Naskah</th>
  75. <th class="headtable">Isi Naskah</th>
  76. <th class="headtable">Keterangan</th>
  77. <th class="headtable">Kelengkapan Naskah</th>
  78. <!--<th style="width:100px">Jenjang</th>
  79. <th style="width:100px">Kategori</th>
  80. <th style="width:100px">Tanggal Screening</th>
  81. <th style="width:100px">Hasil Screening</th> -->
  82. <th class="headtable">Status</th>
  83.  
  84.  
  85. <th>Edit & Delete</th>
  86. </tr>
  87. </thead>
  88. <tbody>
  89. <?php
  90. $i = 1;
  91. $jml_per_halaman = 10;
  92. $jml_data = mysql_num_rows(mysql_query("SELECT * FROM tabledata"));
  93. $jml_halaman = ceil($jml_data / $jml_per_halaman);
  94.  
  95. if(isset($_POST['cari'])) {
  96. $kunci = $_POST['cari'];
  97. echo "<strong>Hasil pencarian untuk kata kunci $kunci</strong>";
  98. $query = mysql_query("
  99. SELECT * FROM tabledata
  100. WHERE kode_nas LIKE '%$kunci%'
  101. OR tanggal LIKE '%$kunci%'
  102. OR alamat LIKE '%$kunci%'
  103. OR telpon LIKE '%$kunci%'
  104. OR email LIKE '%$kunci%'
  105. OR judul LIKE '%$kunci%'
  106. OR nama LIKE '%$kunci%'
  107. OR format_nas LIKE '%$kunci%'
  108. OR isi_naskah LIKE '%$kunci%'
  109. OR keterangan LIKE '%$kunci%'
  110. OR lengkap_nas LIKE '%$kunci%'
  111. OR jenjang LIKE '%$kunci%'
  112. OR kategori LIKE '%$kunci%'
  113. OR tanggal_screening LIKE '%$kunci%'
  114. OR hasil_screening LIKE '%$kunci%'
  115. OR status LIKE '%$kunci%'
  116.  
  117. ");
  118.  
  119. } elseif(isset($_POST['halaman'])) {
  120. $halaman = $_POST['halaman'];
  121. $i = ($halaman - 1) * $jml_per_halaman + 1;
  122. $query = mysql_query("SELECT * FROM tabledata LIMIT ".(($halaman - 1) * $jml_per_halaman).", $jml_per_halaman");
  123.  
  124. } else {
  125. $query = mysql_query("SELECT * FROM tabledata LIMIT 0, $jml_per_halaman");
  126. $halaman = 1;
  127. }
  128.  
  129.  
  130. while($data = mysql_fetch_array($query)) {
  131. if($data['status']==1) {
  132. $status = "YES";
  133. } else {
  134. $status = "NO";
  135. }
  136. ?>
  137. <tr>
  138. <td class="isitable"><?php echo $i ?></td>
  139. <td class="isitable"><?php echo $data['kode_nas'] ?></td>
  140. <td class="isitable"><?php echo date('d-m-y'); $data['tanggal'] ?></td>
  141. <td class="isitable"><?php echo $data['alamat'] ?></td>
  142. <td class="isitable"><?php echo $data['telpon'] ?></td>
  143. <td class="isitable"><?php echo $data['email'] ?></td>
  144. <td class="isitable"><?php echo $data['judul'] ?></td>
  145. <td class="isitable"><?php echo $data['nama'] ?></td>
  146. <td class="isitable"><?php echo $data['format_nas'] ?></td>
  147. <td class="isitable"><?php echo $data['isi_naskah'] ?></td>
  148. <td class="isitable"><?php echo $data['keterangan'] ?></td>
  149. <td class="isitable"><?php echo $data['lengkap_nas'] ?></td>
  150. <!--<td><?php echo $data['jenjang'] ?></td>
  151. <td><?php echo $data['kategori'] ?></td>
  152. <td><?php echo $data['tanggal_screening'] ?></td>
  153. <td><?php echo $data['hasil_screening'] ?></td> -->
  154. <td class="isitable"><?php echo $status ?></td>
  155.  
  156.  
  157. <td>
  158. <a href="#dialog-tabledata" id="<?php echo $data['kd_id'] ?>" class="ubah" data-toggle="modal">
  159. <i class="icon-pencil"></i>
  160. </a>
  161. <a href="#" id="<?php echo $data['kd_id'] ?>" class="hapus">
  162. <i class="icon-trash"></i>
  163. </a>
  164. </td>
  165. </tr>
  166. <?php
  167. $i++;
  168. }
  169. ?>
  170. </tbody>
  171. </table>
  172.  
  173. <?php if(!isset($_POST['cari'])) { ?>
  174.  
  175.  
  176. <div class="pagination pagination-right">
  177. <ul>
  178. <?php
  179.  
  180.  
  181. $no_hal_tampil = 5;
  182.  
  183. if ($jml_halaman <= $no_hal_tampil) {
  184. $no_hal_awal = 1;
  185. $no_hal_akhir = $jml_halaman;
  186. } else {
  187. $val = $no_hal_tampil - 2; //3
  188. $mod = $halaman % $val; //
  189. $kelipatan = ceil($halaman/$val);
  190. $kelipatan2 = floor($halaman/$val);
  191.  
  192. if($halaman < $no_hal_tampil) {
  193. $no_hal_awal = 1;
  194. $no_hal_akhir = $no_hal_tampil;
  195. } elseif ($mod == 2) {
  196. $no_hal_awal = $halaman - 1;
  197. $no_hal_akhir = $kelipatan * $val + 2;
  198. } else {
  199. $no_hal_awal = ($kelipatan2 - 1) * $val + 1;
  200. $no_hal_akhir = $kelipatan2 * $val + 2;
  201. }
  202.  
  203. if($jml_halaman <= $no_hal_akhir) {
  204. $no_hal_akhir = $jml_halaman;
  205. }
  206. }
  207.  
  208. for($i = $no_hal_awal; $i <= $no_hal_akhir; $i++) {
  209.  
  210. $aktif = $i == $halaman ? ' active' : '';
  211. ?>
  212. <li class="halaman<?php echo $aktif ?>" id="<?php echo $i ?>"><a href="#"><?php echo $i ?></a></li>
  213. <?php } ?>
  214. </ul>
  215. </div>
  216. <?php } ?>
  217.  
  218. <?php
  219.  
  220. koneksi_tutup();
  221. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement