<div class="panel panel-default">
<div class="panel-heading">
<font size="+3">Artikel</font>
<a href="index.php?page=artikel_add" class="btn btn-success no_radius pull-right">Tambah</a>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Edit</th>
<th>Date</th>
<th>Title</th>
<th>FB</th>
<th>Form</th>
<th>Delete</th>
<th>Active</th>
<th>Set As Default</th>
</tr>
</thead>
<tbody>
<?php
if (isset($_GET["act"]))
{
if ($_GET["act"]=="del")
{
$sql=mysql_query("delete from artikel where id='".$_GET['id']."'");
if (file_exists("../thumbnails/".$_GET["lg"].".jpg"))
{
unlink("../thumbnails/".$_GET["lg"].".jpg");
}
if (file_exists("../thumbnails/".$_GET["lg"].".jpg"))
{
unlink("../uploaded_images/".$_GET["lg"].".jpg");
}
}
else if ($_GET["act"]=="akt")
{
$sql=mysql_query("update artikel set active='".$_GET['active']."' where id='".$_GET['id']."'");
}
else if ($_GET["act"]=="stat")
{
$sqlU=mysql_query("update artikel set status='0' where status='1'");
$sql=mysql_query("update artikel set status='".$_GET['status']."' where id='".$_GET['id']."'");
}
else if ($_GET["act"]=="fb")
{
$sql=mysql_query("update artikel set fb='".$_GET['fb']."' where id='".$_GET['id']."'");
}
else if ($_GET["act"]=="form")
{
$sql=mysql_query("update artikel set form='".$_GET['form']."' where id='".$_GET['id']."'");
}
}
$sql=mysql_query("select * from artikel order by id desc");
while($data=mysql_fetch_array($sql))
{
?>
<tr>
<td><a href="index.php?page=artikel_edit&id=<?php echo $data['id']; ?>"><i class="fa fa-pencil-square-o fa-2x"></i></a></td>
<td><?php echo date('j F Y',$data['date']); ?></td>
<td><?php echo $data['title']; ?></td>
<td><a href="index.php?page=artikel&act=fb&id=<?php echo $data['id']; ?>&fb=<?php echo ($data['fb']==0?1:0); ?>"><img src="../images/active_<?php echo $data['fb']; ?>.gif"></a></td>
<td><a href="index.php?page=artikel&act=form&id=<?php echo $data['id']; ?>&form=<?php echo ($data['form']==0?1:0); ?>"><img src="../images/active_<?php echo $data['form']; ?>.gif"></a></td>
<td><a href="index.php?page=artikel&act=del&id=<?php echo $data['id']; ?>&lg=<?php echo $data['logo']; ?>"><i class="fa fa-eraser fa-2x"></i></a></td>
<td><a href="index.php?page=artikel&act=akt&id=<?php echo $data['id']; ?>&active=<?php echo ($data['active']==0?1:0); ?>"><img src="../images/active_<?php echo $data['active']; ?>.gif"></a></td>
<td><a href="index.php?page=artikel&act=stat&id=<?php echo $data['id']; ?>&status=<?php echo ($data['status']==0?1:0); ?>"><img src="../images/active_<?php echo $data['status']; ?>.gif"></a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>