<?php
	require_once("koneksi.php");
    include 'header.php';
?>

	<!-- breadcrumbs -->
		<div class="breadcrumbs">
			<div class="container">
				<ol class="breadcrumb breadcrumb1">
					<li><span><i class="fa fa-sign-in" aria-hidden="true"></i><a href="login.php"> Masuk</a></span></li>
					<li class="active">Kelola Data Komentar</li>
				</ol>
			</div>
		</div>
	<!-- //breadcrumbs -->
	<!-- Page -->
		<?php 
			$per_hal		= 10;
			$jumlah_record	= mysqli_query($koneksi, "SELECT * FROM t_komentar");
			$no 			= 1;
			$jum 			= mysqli_num_rows($jumlah_record);
			$halaman 		= ceil($jum / $per_hal);
			$page 			= (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
			$start 			= ($page - 1) * $per_hal;
		?>
	<!-- //Page -->
		<div class="col-md-12">
			<table class="col-md-2">
				<tr>
					<br>
					<td>Jumlah Komentar Masuk</td>		
					<td>: <b><?php echo $jum; ?></b></td>
				</tr>
			</table>
		</div>
	<!-- checkout -->
			<div class="container"><br><br><br>
				<h2>Daftar Komentar : </h2><br>
				<div class="checkout-right">
					<table class="timetable_sub">
						<thead>
							<tr>
								<th>No.</th>
								<th>ID</th>	
								<th>Nama Pengirim</th>
								<th>Komentar</th>
								<th>Tanggal</th>
								<th>Opsi</th>
							</tr>
						</thead>
						<?php
						 	$tampil = mysqli_query($koneksi, "SELECT * FROM t_komentar LIMIT $start, $per_hal"); 
							while($data = mysqli_fetch_array($tampil)) {	
						?>
						<tr class="rem1">
							<td class="invert"><?php echo $no++; ?></td>
							<td class="invert"><?php echo $data['id_komentar']; ?></td>
							<td class="invert"><?php echo $data['nama_pengirim']; ?></td>
							<td class="invert"><?php echo $data['komentar']; ?></td>
							<td class="invert"><?php echo $data['tanggal']; ?></td>
							<td class="invert">
								<div class="rem">
									<div>	
						                <a href='deletecomment_process.php?id=<?php echo $data['id_komentar']; ?>' }">
						                	<img src="images/close_1.png" />
						                </a>
									</div>
								</div>
							</td>
						</tr>
						<?php
							}
						?>
						<?php
							if(	isset($_SESSION['administrator'])){
								echo '	';
							}
							else {
								echo '
									<tr><td colspan="6" align="center" style="background-color:#ffffff"> Data komentar kosong ! </td></tr></table>
								';
							}
						?>
					</table>
				</div>
			<nav class="numbering">
				<ul class="pagination paging">
					<li>
						<?php 
							for($page=1;$page<=$halaman;$page++){
								?>
								<li><a href="?page=<?php echo $page ?>"><?php echo $page ?></a></li>
								<?php
							}
						?>
					</li>
					<!--<li>
						<a href="?page=<?php echo $x++ ?>" aria-label="Next">
						<span aria-hidden="true">&raquo;</span>
						</a>
					</li>-->
					<br><br><br>
				</ul>
			</nav>		
		</div>
	<!-- //checkout -->

<?php
	include 'footer.php';
?>