<title>Banner</title>
<div id="pagetitle">BANNER</div>
<div id="batascontent" class="clearfix">
	<?php if ($udt['admincat_id'] != "1") {} else { ?>
		<div id="tomboltambah">
			<a href="?m=banner_input" class="addbutton">+ BANNER</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></th>
					<th>BANNER</th>
					<th>BANNER KATEGORI</th>
					<th></th>
					<th>ID</th>
				</tr>
			</thead>
			<tbody>
				<?php
					$nomor = 1;
					$id = mysqli_real_escape_string($koneksi, $_GET['id']);
					$db = mysqli_query($koneksi, "SELECT * FROM cmas_banner WHERE bannerkat_id='$id' ORDER BY bannerkat_nama DESC");
					while($dt = mysqli_fetch_array($db)){
					
					if ($dt['banner_status'] == "Non-Aktif") {
						$banner_status = "<img src='assets/images/icons/icon_no.png' width='20' title='$dt[banner_status]'>";
					} else {
						$banner_status = "<img src='assets/images/icons/icon_yes.png' width='20' title='$dt[banner_status]'>";
					}
					
					if ($dt['banner_imageid'] == 0) {
						$banner_image = "<img src='assets/images/noimage.jpg' width='50' alt='$dt[banner_judul]' title='$dt[banner_judul]'>";
					} else {
						$banner_image = "<img src='assets/images/banner/$dt[banner_image]' width='50' alt='$dt[banner_judul]' title='$dt[banner_judul]'>";
					}
				?>
					<tr>
						<td align="center" width="1%">
							<?php echo $nomor; ?>
						</td>
						<td align="center" width="1%">
							<a href="?m=banner_edit&id=<?php echo $dt['banner_id']; ?>">
								<?php echo $banner_image; ?>
							</a>
						</td>
						<td>
							<a href="?m=banner_edit&id=<?php echo $dt['banner_id']; ?>">
								<?php echo $dt['banner_judul']; ?>
							</a>
						</td>
						<td>
							<?php echo $dt['bannerkat_nama']; ?>
						</td>
						<?php if ($udt['admincat_id'] == "1") { ?>
							<td width="8%">
								<a href="?m=banner_updatestatus&id=<?php echo $dt['banner_id']; ?>">
									<?php echo $banner_status;?>
								</a>
								<a href="?m=banner_edit&id=<?php echo $dt['banner_id']; ?>">
									<img src="assets/images/icons/icon_edit.png" width="20" title="Edit Data">
								</a>
								<a href="?m=banner_hapus&id=<?php echo $dt['banner_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 width="5%">
								<a href="?m=banner_updatestatus&id=<?php echo $dt['banner_id']; ?>">
									<?php echo $banner_status;?>
								</a>
								<a href="?m=banner_edit&id=<?php echo $dt['banner_id']; ?>">
									<img src="assets/images/icons/icon_edit.png" width="20" title="Edit Data">
								</a>
							</td>
						<?php } ?>
						<td width="1%">
							<?php echo $dt['banner_id']; ?>
						</td>
					</tr>
				<?php $nomor++; } ?>
			</tbody>
		</table>
	</div>
</div>