| Direktori : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/admin/ |
| Current File : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/admin/news.php |
<!doctype html>
<html lang="en">
<!-- head -->
<?php include 'head.php'; ?>
<?php include '../db/database.php';
include 'function_date.php';
?>
<body>
<div class="wrapper">
<!-- เมนูด้านซ้าย -->
<?php include 'leftside.php'; ?>
<div class="main-panel">
<!-- ส่วนหัว -->
<?php include 'header.php'; ?>
<div class="content">
<div class="container-fluid">
<div class="col-md-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="home.php">หน้าหลัก</a></li>
<li class="breadcrumb-item active" aria-current="page">จัดการข่าว</li>
</ol>
</nav>
<a href="addnews.php">
<button type="button" class="btn btn-primary"><i class="material-icons">person_add</i> เพิ่มข่าว</button>
</a>
<?php
$sql = "SELECT * FROM news INNER JOIN newstype ON news.newstype_id = newstype.newstype_id ORDER BY news_id DESC";
$result = mysqli_query($link, $sql);
?>
<div class="card">
<div class="card-header card-header-icon" data-background-color="rose">
<i class="material-icons">assignment_ind</i>
</div>
<h4 class="card-title">จัดการข่าว</h4>
<div class="card-content">
<div class="material-datatables">
<table id="datatables" class="table table-shopping table-no-bordered table-hover" cellspacing="0" width="100%" style="width:100%" >
<thead>
<tr>
<th class="text-center">ลำดับ</th>
<th>รูปภาพ</th>
<th>ประเภทข่าว</th>
<th>หัวข้อข่าว</th>
<th>วันที่</th>
<th>สถานะ</th>
<th class="text-right">จัดการ</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
while ($row = mysqli_fetch_array($result)) { ?>
<tr>
<?php
if ($row['news_status'] == 0){
$status = 'แสดงหน้าหลัก';
}else{
$status = 'ไม่แสดงหน้าหลัก';
}
?>
<?php
$date = $row['new_date'];
$show_date = displaydate($date);
?>
<td class="text-center"><?php echo $i; ?></td>
<td>
<div class="img-container">
<a data-lity href="images/<?php echo $row['news_images']; ?>" target="_blank">
<img src="images/<?php echo $row['news_images']; ?>" alt="...">
</a>
</div>
</td>
<td><?php echo $row['newstype_detail']; ?> </td>
<td><?php echo $row['news_topic']; ?> </td>
<td><?php echo $show_date; ?></td>
<td> <?php echo $status ?></td>
<td class="td-actions text-right">
<a href="../news_details.php?news_id=<?php echo $row['news_id']; ?>" target="_blank" title="เรียกดูข้อมูล" type="button" rel="tooltip" class="btn btn-primary btn-round">
<i class="material-icons">pageview</i>
</a>
<a href="frm_editnews.php?news_id=<?php echo $row['news_id']; ?>" title="แก้ไขข้อมูล" type="button" rel="tooltip" class="btn btn-success btn-round">
<i class="material-icons">edit</i>
</a>
<button id="<?php echo $row['news_id']; ?>" title="ลบข้อมูล" rel="tooltip" class="btn btn-danger btn-round">
<i class="material-icons">close</i>
</button >
</td>
</tr>
<?php $i++; } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- footer1 -->
<?php include 'footer1.php'; ?>
</div>
</div>
<!-- footer2 -->
<?php include 'footer2.php'; ?>
<script src="assets/js/jquery.datatables.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#datatables').DataTable({
"pagingType": "full_numbers",
"lengthMenu": [
[200, 25, 50, -1],
[200, 25, 50, "All"]
],
responsive: true,
language: {
search: "",
searchPlaceholder: "ค้นหาข้อมูล",
"sInfo": "แสดง _START_ ถึง _END_ จาก _PAGES_ แถว",
"semptyTable": "ไม่มีข้อมูลในตาราง",
"sLengthMenu": "แสดง _MENU_ แถว",
"sLoadingRecords": "กำลังโหลดข้อมูล...",
"sProcessing": "กำลังดำเนินการ...",
"sSearch": "ค้นหา: ",
"sZeroRecords": "ไม่พบข้อมูล",
"sInfoEmpty": "แสดง 0 ถึง 0 จาก 0 แถว",
"sInfoFiltered": "(กรองข้อมูล _MAX_ ทุกแถว)",
"sInfoPostFix": "",
"sInfoThousands": ",",
"paginate": {
"sPrevious": "ก่อนหน้า",
"sNext": "ถัดไป",
"sLast": "หน้าสุดท้าย",
"sFirst": "หน้าแรก"
},
"oAria": {
"sSortAscending": ": เปิดใช้งานการเรียงข้อมูลจากน้อยไปมาก",
"sSortDescending": ": เปิดใช้งานการเรียงข้อมูลจากมากไปน้อย"
}
}
});
var table = $('#datatables').DataTable();
$('.card .material-datatables label').addClass('form-group');
});
</script>
<script>
$(document).ready(function(){
$(".btn-danger").on("click",function(e) {
//delete confirm
var uid = $(this).attr('id');
swal({
title: "คุณแน่ใจหรือไม่ว่าต้องการลบข้อมูล?",
text: "คุณจะไม่สามารถกู้คืนข้อมูลนี้ได้อีก!",
type: "warning",
showCancelButton: true,
confirmButtonColor: '#d33',
confirmButtonText: "ตกลง, ลบข้อมูล!",
cancelButtonText: "ยกเลิก..",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm) {
if (isConfirm) {
$.get("del_news.php", {id : uid})
.done(function (data) {
if (data.status === "success") {
$.smkAlert({text: data.message, type: data.status});
} else {
$.smkAlert({text: data.message, type: data.status});
}
location.reload();
});
} else {
swal("ยกเลิก", "ข้อมูลของคุณยังไม่ถูกลบ :)", "error");
}
});
e.preventDefault();
});
});
</script>
<!-- Mirrored from demos.creative-tim.com/material-dashboard-pro/examples/dashboard.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 20 Mar 2017 21:32:16 GMT -->
</html>