<title>Konten Kategori</title>
<div id="pagetitle">KONTEN KATEGORI</div>
<div id="batascontent" class="clearfix">
	<?php if ($udt['admincat_id'] != "1") {} else { ?>
		<div id="tomboltambah">
			<a href="?m=kontenkat_input" class="addbutton">+ KONTEN KATEGORI</a>
		</div>
	<?php } ?>
	<div id="tableres">
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="display" id="example">
			<thead>
				<tr align="left">
					<th>NO</th>
					<th>KONTEN KATEGORI</th>
					<th>KONTEN</th>
					<th></th>
					<th>ID</th>
				</tr>
			</thead>
			<tbody>
				<?php
					$nomor = 1;
					$db = mysqli_query($koneksi, "SELECT * FROM cmas_kontenkat ORDER BY kontenkat_id DESC");
					while($dt  = mysqli_fetch_array($db)) {
					
					if ($dt['kontenkat_status'] == "Non-Aktif") {
						$kontenkat_status = "<img src='assets/images/icons/icon_no.png' width='20' title='$dt[kontenkat_status]'>";
					} else {
						$kontenkat_status = "<img src='assets/images/icons/icon_yes.png' width='20' title='$dt[kontenkat_status]'>";
					}
				?>
					<tr>
						<td align="center" width="1%">
							<?php echo $nomor; ?>
						</td>
						<td align="left">
							<a href="?m=kontenkat_edit&id=<?php echo $dt['kontenkat_id']; ?>">
								<?php echo $dt["kontenkat_judul"]; ?>
							</a>
						</td>
						<td>
							<?php
								$bdb = mysqli_query($koneksi, "SELECT COUNT(konten_id) AS JumlahKonten FROM cmas_konten WHERE kontenkat_id='$dt[kontenkat_id]'");
								$bdt = mysqli_fetch_array($bdb);
							?>
							<a href="?m=konten_index">
								<?php echo $bdt["JumlahKonten"]; ?> Konten
							</a>
						</td>
						<?php if ($udt['admincat_id'] == "1") { ?>
							<td align="center" width="8%">
								<a href="?m=kontenkat_updatestatus&id=<?php echo $dt['kontenkat_id']; ?>">
									<?php echo $kontenkat_status; ?>
								</a>
								<a href="?m=kontenkat_edit&id=<?php echo $dt['kontenkat_id']; ?>">
									<img src="assets/images/icons/icon_edit.png" width="20" title="Edit Data">
								</a>
								<a href="?m=kontenkat_hapus&id=<?php echo $dt['kontenkat_id']; ?>" onclick="return confirm('DATA AKAN DIHAPUS, ANDA YAKIN?');">
									<img src="assets/images/icons/icon_delete.png" width="20" title="Hapus Data">
								</a>
							</td>
						<?php } else { ?>
							<td align="center" width="5%">
								<a href="?m=kontenkat_updatestatus&id=<?php echo $dt['kontenkat_id']; ?>">
									<?php echo $kontenkat_status; ?>
								</a>
								<a href="?m=kontenkat_edit&id=<?php echo $dt['kontenkat_id']; ?>">
									<img src="assets/images/icons/icon_edit.png" width="20" title="Edit Data">
								</a>
							</td>
						<?php } ?>
						<td align="center" width="1%">
							<?php echo $dt["kontenkat_id"]; ?>
						</td>
					</tr>
				<?php $nomor++; } ?> 
			</tbody>
		</table>
	</div>
</div>