Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <link href='../css/icon.css' type='text/css' rel='stylesheet' />
- <script type="text/javascript">
- function pilihan()
- {
- // membaca jumlah komponen dalam form bernama 'myform'
- var jumKomponen = document.myform.length;
- // jika checkbox 'Pilih Semua' dipilih
- if (document.myform[0].checked == true)
- {
- // semua checkbox pada data akan terpilih
- for (i=1; i<=jumKomponen; i++)
- {
- if (document.myform[i].type == "checkbox") document.myform[i].checked = true;
- }
- }
- // jika checkbox 'Pilih Semua' tidak dipilih
- else if (document.myform[0].checked == false)
- {
- // semua checkbox pada data tidak dipilih
- for (i=1; i<=jumKomponen; i++)
- {
- if (document.myform[i].type == "checkbox") document.myform[i].checked = false;
- }
- }
- }
- </script>
- <h3 align="center">Data Anggota</h3>
- <?php echo "<form name='myform' method='POST' action='include/deleteloker.php'>";
- echo "<tr><td background='red'><input type='checkbox' name='pilih' onclick='pilihan()' /> </td>";?><input type="submit" class="btn btn-danger" value="Antrikan" onClick="return warning();" name="submit"></a>
- <a href='?module=data-antrian-loker'><input type="button" class="btn btn-danger" value="Daftar Antrian" name="print"></a>
- <a href='include/prosesbarcode.php' target="_blank"><input type="button" class="btn btn-danger" value="Print" name="print"></a><br><br>
- <?php
- include '../koneksi.php';
- // jumlah data yang akan ditampilkan per halaman
- $dataPerPage = 10;
- // apabila $_GET['page'] sudah didefinisikan, gunakan nomor halaman tersebut,
- // sedangkan apabila belum, nomor halamannya 1.
- if(isset($_GET['page']))
- {
- $noPage = $_GET['page'];
- }
- else $noPage = 1;
- // perhitungan offset
- $offset = ($noPage - 1) * $dataPerPage;
- // query SQL untuk menampilkan data perhalaman sesuai offset
- $query = "SELECT * FROM loker LIMIT $offset, $dataPerPage";
- $result = mysql_query($query) or die('Error');
- // menampilkan data
- ?>
- <table cellpadding="0" cellspacing="0" border="1" class="display" id="example">
- <thead>
- <tr>
- <th width="10px">Pilih</th><th width="10px">No</th><th >Nama</th><th >Alamat</th>
- <th>Edit</th><th>Delete</th>
- </tr>
- </thead>
- <tbody><?php
- while($data = mysql_fetch_array($result))
- {
- ?>
- <tr class="odd graaadeX">
- <td><input type="checkbox" name="id[<?php echo $i;?>]" value="<?php echo $data['id'];?>" />
- </td><td valign="top" width="10px"> <?php $i++; echo $j+1;?> </td>
- <td valign="top" > <?php echo $data["loker"];?></td>
- <td valign="top" > <?php echo $data["alamat"];?></td>
- <td valign="top" class="center"><?php echo "<a href='?module=edit-loker&id=".$data['id']."'><i class='icon-edit'></i> </a>
- </td>";?><td valign="top" class="center"><?php echo "<a href='?module=hapus-loker&id=".$data['id']."'><i class='icon-trash'></i> </a>
- </td>";?>
- </tr><?php $j++; ?>
- <?php }
- ?>
- <?php
- echo" <link href='../css/datables/demo_page.css' type='text/css' rel='stylesheet' />
- <link href='../css/datables/demo_table.css' type='text/css' rel='stylesheet' />
- "; ?>
- </tbody>
- </table><?php
- echo "</table>";
- // mencari jumlah semua data dalam tabel guestbook
- $query = "SELECT COUNT(*) AS jumData FROM loker";
- $hasil = mysql_query($query);
- $data = mysql_fetch_array($hasil);
- $jumData = $data['jumData'];
- // menentukan jumlah halaman yang muncul berdasarkan jumlah semua data
- $jumPage = ceil($jumData/$dataPerPage);
- // menampilkan link previous
- if ($noPage > 1) echo "<a href='".$_SERVER['PHP_SELF']."?page=".($noPage-1)."'><< Prev</a>";
- // memunculkan nomor halaman dan linknya
- for($page = 1; $page <= $jumPage; $page++)
- {
- if ((($page >= $noPage - 3) && ($page <= $noPage + 3)) || ($page == 1) || ($page == $jumPage))
- {
- if (($showPage == 1) && ($page != 2)) echo "...";
- if (($showPage != ($jumPage - 1)) && ($page == $jumPage)) echo "...";
- if ($page == $noPage) echo " <b>".$page."</b> ";
- else echo " <a href='".$_SERVER['PHP_SELF']."?page=".$page."'>".$page."</a> ";
- $showPage = $page;
- }
- }
- // menampilkan link next
- if ($noPage < $jumPage) echo "<a href='".$_SERVER['PHP_SELF']."?page=".($noPage+1)."'>Next >></a>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement