| Server IP : 27.254.96.235 / Your IP : 216.73.216.44 Web Server : Apache/2 System : Linux cs95 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64 User : piboonsa ( 1055) PHP Version : 8.0.30 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/piboonsa/domains/piboonsawasdee.ac.th/public_html/backend/ |
Upload File : |
<?php
include("passlog.inc.php");
include("lib/config.php");
include("lib/page.inc.php");
?>
<!DOCTYPE HTML>
<html>
<head>
<?php include("top.inc.php");?>
</head>
<body class="theme-blue">
<?php
include("head.inc.php");
include("leftside.inc.php");
?>
<div class="content">
<div class="header">
<h1 class="page-title">วารสารโรงเรียน</h1>
</div>
<div class="main-content">
<div class="btn-toolbar list-toolbar">
<button class="btn btn-primary" onClick="location.href='add_journal.php'"><i class="fa fa-plus"></i> เพิ่ม</button>
<div class="btn-group"></div>
</div>
<table class="table">
<thead>
<tr>
<th>#</th>
<th>หัวข้อ</th>
<th style="width: 5em;"></th>
</tr>
</thead>
<tbody>
<?php
$query = $db->query("SELECT * FROM journal ORDER BY id DESC");
$Num_Rows = $db->getcountrow($query);
if($Num_Rows == 0){
?>
<tr>
<td colspan="3" align="center" class="red">ไม่พบข้อมูล</td>
</tr>
<?php
}else{
$Per_Page = 20; // Per Page
$Page = $_GET["Page"];
if(!$_GET["Page"]){
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page){
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0){
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$query = $db->query("SELECT * FROM journal ORDER BY id DESC LIMIT $Page_Start , $Per_Page");
$no = ($Page-1) * $Per_Page;
while($rs = $db->getresult($query)){
$no++;
$bg = "";
$mark = "fa fa-check";
if($rs['status'] == "no"){
$bg = "#ffdddd";
$mark = "fa fa-close";
}
?>
<tr bgcolor="<?=$bg?>">
<td><?=$no?></td>
<td><a href="add_journal.php?id=<?=$rs['id']?>&Page=<?=$Page?>"><?=htmlspecialchars_decode($rs['topic'], ENT_QUOTES)?></a></td>
<td>
<a href="set_status.php?id=<?=$rs['id']?>&Page=<?=$Page?>&mode=journal"><i class="<?=$mark?>"></i></a>
<a href="add_journal.php?id=<?=$rs['id']?>&Page=<?=$Page?>"><i class="fa fa-pencil"></i></a>
<a href="#myModal<?=$rs['id']?>" role="button" data-toggle="modal"><i class="fa fa-trash-o"></i></a>
</td>
</tr>
<div class="modal small fade" id="myModal<?=$rs['id']?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">ยืนยันการลบข้อมูล</h3>
</div>
<div class="modal-body">
<p class="error-text"><i class="fa fa-warning modal-icon"></i>
คุณแน่ใจว่าต้องการลบข้อมูลนี้?
</p>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">ยกเลิก</button>
<button class="btn btn-danger" data-dismiss="modal" onClick="location.href='del_journal.php?id=<?=$rs['id']?>&Page=<?=$Page?>'">ลบ</button>
</div>
</div>
</div>
</div>
<?php
}
}
?>
</tbody>
</table>
<?php
if($Num_Rows != 0){
$pages = new Paginator;
$pages->items_total = $Num_Rows;
$pages->mid_range = 10;
$pages->current_page = $Page;
$pages->default_ipp = $Per_Page;
$pages->url_next = $_SERVER["PHP_SELF"]."?QueryString=value&Page=";
$pages->paginate();
echo '<ul class="pagination">'.
$pages->display_pages().
'</ul>';
}
?>
<?php include("foot.inc.php");?>
</div>
</div>
</body>
</html>