123 lines
3.9 KiB
PHP
123 lines
3.9 KiB
PHP
<?php
|
|
include('config/koneksi.php');
|
|
|
|
// Ambil data artikel
|
|
$query = "SELECT * FROM tb_artikel";
|
|
$result = mysqli_query($koneksi, $query);
|
|
|
|
if (!$result) {
|
|
die("Kueri Error: " . mysqli_error($koneksi));
|
|
}
|
|
|
|
$rows = [];
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
$rows[] = $row;
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>Admin - Tambah Artikel</title>
|
|
<link href="assets/css/yeti-bootstrap.min.css" rel="stylesheet"/>
|
|
<link href="assets/css/general.css" rel="stylesheet"/>
|
|
<link href="assets/css/select2.min.css" rel="stylesheet"/>
|
|
<script src="assets/js/jquery.min.js"></script>
|
|
<script src="assets/js/bootstrap.min.js"></script>
|
|
<script src="assets/js/select2.min.js"></script>
|
|
<style type="text/css">
|
|
.hi{
|
|
background-image: linear-gradient(rgba(0, 0, 0, 0.5),rgba(0, 0, 0, 0.5)), url('vitaminbg.png');
|
|
background-size: cover;
|
|
background-position: center center;
|
|
background-repeat: no-repeat;
|
|
background-attachment: fixed;
|
|
}
|
|
.dark{
|
|
background-color: #000;
|
|
color: #000;
|
|
}
|
|
.page-header{
|
|
color: #fff;
|
|
}
|
|
.latar{
|
|
background-color: #636e72;
|
|
}
|
|
.tambah{
|
|
background-color: #353b48;
|
|
}
|
|
.tambah:hover{
|
|
background-color: #718093;
|
|
color: #fff;
|
|
}
|
|
.edit{
|
|
background-color: #2f3640;
|
|
}
|
|
.edit:hover{
|
|
background-color: #718093;
|
|
color: #fff;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="dark hi">
|
|
<div class="page-header">
|
|
<h1 style="color: #fff;" align="center"><b>Artikel</b></h1>
|
|
</div>
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading" align="right">
|
|
<form class="form-inline">
|
|
<input type="hidden" name="m" value="data_artikel" />
|
|
<div class="form-group">
|
|
<input class="form-control" type="text" placeholder="Pencarian. . ." name="q" value="<?=@$_GET['q']?>" />
|
|
</div>
|
|
<div class="form-group">
|
|
<button class="btn tambah"><span class="glyphicon glyphicon-search"></span></button>
|
|
</div>
|
|
<span class="pull-left">
|
|
<div class="form-group">
|
|
<a class="btn tambah" href="?m=artikel_tambah"><span class="glyphicon glyphicon-plus"></span> Tambah Artikel</a>
|
|
</div></span>
|
|
</form>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-hover table-striped">
|
|
<thead><tr>
|
|
<th>ID</th>
|
|
<th>Judul</th>
|
|
<th>Konten</th>
|
|
<th>Tanggal</th>
|
|
<th>Aksi</th>
|
|
</tr></thead>
|
|
<?php if (!empty($rows)): ?>
|
|
<?php
|
|
$no=0;
|
|
foreach($rows as $row): ?>
|
|
<tr>
|
|
<td><?=$row['id_artikel'] ?></td>
|
|
<td><?=$row['judul']?></td>
|
|
<td><?=$row['konten']?></td>
|
|
<td><?=$row['tanggal']?></td>
|
|
<td class="nw">
|
|
<a class="btn btn-xs edit" href="?m=artikel_ubah&ID=<?=$row['id_artikel']?>"><span class="glyphicon glyphicon-pencil"></span></a>
|
|
<a class="btn btn-xs edit" href="aksi.php?act=artikel_hapus&ID=<?=$row['id_artikel']?>" onclick="return confirm('Hapus artikel?')"><span class="glyphicon glyphicon-trash"></span></a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php else: ?>
|
|
<tr>
|
|
<td colspan="5" align="center">Tidak ada data artikel</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|