Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
home
/
thebestprx
/
public_html
/
admin
/
news
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/thebestprx/public_html/admin/news/category.php
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <? include("../include/title.php"); include("../include/chksession.php"); include("../include/connect.php"); ?> <link href="../css/style.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="../css/bootstrap-theme.css"/> <link rel="stylesheet" type="text/css" href="../css/bootstrap.css"/> <link rel="stylesheet" type="text/css" href="../css/font-awesome.css"> <link rel="stylesheet" type="text/css" href="../css/component.css"/> <script type="text/javascript" src="../js/jquery-1.8.3.js"></script> <script type="text/javascript" src="../js/bootstrap.js"></script> <script src="../js/jquery.easing.1.3.js"></script> <script type="text/javascript" src="../js/modernizr.custom.js"></script> <script src="../js/jquery-ui-1.9.2.custom.js"></script> <script> $(function(){ //Show // Hide WIDGET $('.show-hide-widget').click(function(){ var widgetInbox = $(this).parents('.widget-tool').siblings('.widget-inbox'); if(widgetInbox.css('display')=='block') { widgetInbox.hide(); $(this).removeClass('fa-caret-up').addClass('fa-caret-down'); } else { widgetInbox.show(); $(this).removeClass('fa-caret-down').addClass('fa-caret-up'); } }); //CHECK ALL PRODUCR $('#all-record').click(function(){ var checkBox = $('input[type=checkbox]'); var recordRow = $('.record-list').find('tr').not('tr:first'); if($(this).is(":checked") == true ) { checkBox.prop( "checked",true ); recordRow.addClass('warning'); } else { checkBox.prop( "checked",false ); recordRow.removeClass('warning'); } }); //CHECK PRODUCR LIST $('input[type=checkbox]').not('#all-record').change(function(){ var recordRow = $(this).parents('tr'); if($(this).is(":checked") == true ) recordRow.addClass('warning'); else recordRow.removeClass('warning'); }); //SAVE RECORD $('.bt-add').click(function(){ if($('input[name="cate_name"]').val()=="") { $('input[name="cate_name"]').focus(); return false; } $('#form1').submit(); }); //DELETE RECORD $(".del-cate").click(function(){ if( confirm('หากต้องการลบ กรุณายืนยันอีกครั้ง')==false ) { return false; } var $chkdel = $(".chk_del"); data = ""; $chkdel.each(function(index, value){ if ($(this).is(":checked")) { data += $(this).attr("data-id") + "," ; } }); console.log(data); if (data != ''){ $.ajax({ type: "POST", url:"fn_news.php", data: {del:data, action:"del-cate"}, dataType: "json", success: function(data){ if (data.stat == 1) { alert(data.txt); location.reload(); } else alert(data.txt); } }); } return false; }); $('.sort_input').blur(function(){ var no = $(this).val(); var id = $(this).parent().prev().find('.chk_del').attr("data-id"); $.ajax({ type: "POST", url:"fn_news.php", data: {id:id, action:"edit-cate", no:no}, dataType: "json", success: function(data){ if (data.stat == 1) { alert(data.txt); location.reload(); } else alert(data.txt); } }); }); $('#editNameModal').on('show.bs.modal', function (event) { var button = $(event.relatedTarget) var id = button.data('id') var name = button.data('name') var modal = $(this) /* modal.find('.modal-title').text('New message to ' + recipient)*/ modal.find('.modal-body input[name="cate_name"]').val(name) modal.find('.modal-body input[name="id"]').val(id) }) }); </script> </head> <body> <div id="header" class="row"> <div class="col-xs-12 col-sm-6 col-md-6"> <? $current_page=4; include("../include/header-left-menu.inc.php"); $id=$_GET['id']; ?> </div> </div> <div class="h20"></div> <div id="main-content" class="page-product"> <div class="title">หมวดหมู่ข่าวสาร</div> <ol class="breadcrumb margin0"> <li><i class="fa-home"></i> <a href="<?=$server_name?>/dashboard.php">หน้าหลัก</a></li> <li><i class="fa-newspaper-o"></i> <a href="<?=$server_name?>/news/list.php">ระบบข่าวสาร</a></li> <li class="active"><i class="fa-cube"></i> หมวดหมู่หลัก</li> </ol> <div class="col-xs-12 col-sm-12 col-md-5 col-lg-5"> <div class="widget-box-blue"> <div class="widget-title"><i class="fa-cube"></i> เพิ่มชื่อหมวดหมู่หลัก</div> <ul class="widget-tool navbar-right"> <li><i class="fa-caret-up show-hide-widget"></i></li> </ul> <div class="widget-inbox"> <form action="fn_news.php" method="post" id="form1"> <div class="form-box"> <div class="form-group"> <label class="control-labe">ชื่อหมวดหมู่หลัก </label> <input type="text" class="form-control" placeholder="" name="cate_name" value="<?=$cate_name?>"> </div> <input type="hidden" name="action" value="add-cate"/> <input type="hidden" name="id" value="<?=$id?>"/> <a href="#" class="bt-add">+ เพิ่ม</a> <div class="clearfix"></div> </div> </form> </div><!--widget-inbox--> </div><!--widget-box--> </div> <div class="col-xs-12 col-sm-12 col-md-7 col-lg-7"> <div class="widget-box-grey"> <div class="widget-title" lang="th"><i class="fa-list"></i> รายการหมวดหมู่ข่าวสาร</div> <ul class="widget-tool navbar-right"> <li><i class="fa-trash del-cate"></i></li> <li><i class="fa-caret-up show-hide-widget"></i></li> </ul> <div class="widget-inbox"> <div class="scroll-y"> <table class="table table-bordered record-list"> <tr> <th width="5%"><input type="checkbox" name="all-record" id="all-record" class="css-checkbox" /><label for="all-record" class="css-label"></label></th> <th width="10%">อันดับ</th> <th>ชื่อหมวดหมู่</th> <th width="20%">หมวดหมู่ย่อย</th> <th width="15%"><!--แก้ไข--><?=$main_admin['edit']?></th> </tr> <? $sql="SELECT *, IF(cate_sort=0,999999,cate_sort) AS sort FROM tb_news_cate where cate_main='0' ORDER BY sort"; $result=mysql_query($sql); $count=1; while($result && $r=mysql_fetch_array($result)) { $cate_id=sprintf("%d",$r['cate_id']); $cate_name=$r['cate_name']; $cate_sort=$r['cate_sort']; echo "<tr> <td><input type='checkbox' name='maincate-$count' id='maincate-$count' class='css-checkbox chk_del' data-id='$cate_id' /> <label for='maincate-$count' class='css-label'></label></td> <td align='center'><span class='sort_text hide'>$cate_sort</span><input class='sort_input form-control text-center' value='$cate_sort'/></td> <td><span class='name_text'><strong>$cate_name</strong></span><input class='name_input form-control hide' value='$cate_name'/></td> <td><a href='category_sub.php?id=$cate_id' class='save-edit'><i class='fa-pencil'></i> เพิ่มหมวดหมู่ย่อย</a></td> <td><a href='#' class='bt-edit' data-toggle='modal' data-target='#editNameModal' data-id='$cate_id' data-name='$cate_name'><i class='fa-pencil'></i> แก้ไข</a></td> </tr>"; $count++; } ?> </table> </div> </div><!--widget-inbox--> </div> </div> </div><!--main-content--> <!--/////-----Dialog Edit Name-----//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////---> <div class="modal fade" id="editNameModal" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="ModalLabel">แก้ไขชื่อหมวดหมู่</h4> </div> <form action="fn_news.php" method="post" id="Form1" enctype="multipart/form-data"> <div class="modal-body"> <div class="form-group"> <label for="recipient-name" class="control-label">ชื่อหมวดหมู่ :</label> <input type="text" class="form-control" id="recipient-name" name="cate_name"> <input type="hidden" class="form-control" name="id" > <input type="hidden" class="form-control" name="action" value="add-cate"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">ยกเลิก</button> <button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> บันทึก</button> </div> </form> </div> </div> </div> <!--//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////---> </body> </html>