/
home
/
efamember
/
domains
/
efa-member.com
/
public_html
/
backoffice
/
up file
home
<?php include('header.php'); $secure = "cAh3DrJACzw4RbU"; $connection = connectDB($secure); $blog_id = $_GET['id']; // $key = getRandomID2(10, 'tbl_news_content', 'content_id'); $sql = "SELECT * FROM tbl_blog WHERE blog_id ='$blog_id' "; $rs = mysqli_query($connection, $sql) or die($connection->error); $row = mysqli_fetch_assoc($rs); ?> <style> .ui-helper-hidden-accessible{ display: none; } </style> <body class="top-navigation"> <div class="wrapper wrapper-content animated fadeInRight"> <!-- <div class="row white-bg page-heading"> <div class="col-lg-12"> <h2 class="text-navy">แก้ไข Blog</h2> <ol class="breadcrumb"> <li class="breadcrumb-item"> <a href="index.php">หน้าแรก</a> </li> <li class="breadcrumb-item"> <a href="blog_list.php">Blog</a> </li> <li class="breadcrumb-item active"> <strong><a href="gallery_setting.php?id=<?php echo $_GET["id"]; ?>">แก้ไข Blog</a></strong> </li> </ol> </div> </div> --> <!-- <form id="form_edit" method="post" enctype="multipart/form-data"> --> <input type="hidden" name="blog_id" id="blog_id" value="<?php echo $blog_id ?>"> <div class="row"> <div class="col-md-3 col-sm-12"> <a href="gallery_setting.php?id=<?php echo $blog_id ?>"> <div class="widget style1 navy-bg p-2"> <div class="row vertical-align text-center"> <div class="col-12"> <h3 class="font-bold mb-0">1. ข้อมูล Blog</h3> </div> </div> </div> </a> </div> <div class="col-md-3 col-sm-12"> <a href="gallery_content.php?id=<?php echo $blog_id ?>"> <div class="widget style1 p-2"> <div class="row vertical-align text-center text-dark"> <div class="col-12"> <h3 class="font-bold mb-0">2. เนื้อหา Blog</h3> </div> </div> </div> </a> </div> <div class="col-md-3 col-sm-12"> <a href="gallery_sort.php?id=<?php echo $blog_id ?>"> <div class="widget style1 p-2"> <div class="row vertical-align text-center text-dark"> <div class="col-12"> <h3 class="font-bold mb-0">3. จัดเรียงเนื้อหา</h3> </div> </div> </div> </a> </div> </div> <div class="row mt-3"> <div class="col-12"> <div id="Loading"> <div class="spiner-example"> <div class="sk-spinner sk-spinner-wave"> <div class="sk-rect1"></div> <div class="sk-rect2"></div> <div class="sk-rect3"></div> <div class="sk-rect4"></div> <div class="sk-rect5"></div> </div> </div> </div> <form id="edit01" method="post" enctype="multipart/form-data"> <div id="ShowForm"></div> </form> </div> </div> <!-- </form> --> </div> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-lg modal-dialog-centered"> <div class="modal-content animated fadeIn" id="loader_modal"> <div id="showModal"></div> </div> </div> </div> <div class="modal" id="subModal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content animated fadeIn"> <div id="showSubModal"></div> </div> </div> </div> <?php include('footer.php'); ?> <script> $(document).ready(function() { LoadData(); }); function LoadData() { let blog_id = $("#blog_id").val(); $.ajax({ type: 'POST', url: 'ajax/gallery_setting/form_blog_edit.php', data: { blog_id: blog_id, }, dataType: 'html', success: function(data) { $('#ShowForm').html(data); $('#Loading').hide(); //$(".wrapper-content").LoadingOverlay("hide", true); $('#description').summernote({ height: 200, toolbar: [ ['style', ['bold', 'italic', 'underline', 'clear']], ['font', ['strikethrough', 'superscript', 'subscript']], ['fontsize'], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph']], ['height', ['height']], ['insert', ['link', 'hr']] ], callbacks: { onPaste: function(e) { var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text'); e.preventDefault(); setTimeout(function() { document.execCommand('insertText', false, bufferText); }, 10); } } }); } }); } function ImageReadURL(input, value, show_position) { let fty = ["jpg", "jpeg", "png"]; let permiss = 0; let file_type = value.split('.'); file_type = file_type[file_type.length - 1]; if (jQuery.inArray(file_type, fty) !== -1) { let reader = new FileReader(); reader.onload = function(e) { $(show_position).attr('src', e.target.result); } reader.readAsDataURL(input.files[0]); } else if (value == "") { $(show_position).attr('src', '../../image/no-image.png'); $(input).val(""); } else { swal({ title: "เกิดข้อผิดพลาด!", text: "อัพโหลดได้เฉพาะไฟล์นามสกุล (.jpg .jpeg .png) เท่านั้น!", type: "warning" }); $(show_position).attr('src', '../../image/no-image.png'); $(input).val(""); return false; } } function VideoReadURL(input, value, show_position) { var fty = ["mp4"]; var permiss = 0; var file_type = value.split('.'); file_type = file_type[file_type.length - 1]; if (jQuery.inArray(file_type, fty) !== -1) { $(show_position).html(input.value.replace("C:\\fakepath\\", '')); } else if (value == "") { $(show_position).html("เลือกไฟล์..."); $(input).val(""); } else { swal({ title: "เกิดข้อผิดพลาด!", text: "อัพโหลดได้เฉพาะไฟล์นามสกุล (.mp4) เท่านั้น!", type: "warning" }); $(show_position).html("เลือกไฟล์..."); $(input).val(""); return false; } } function Submit_edit() { var formData = new FormData($("#edit01")[0]); var blog_id = $("#blog_id").val(); var blog_title = $("#blog_title").val(); var description = $("#description").val(); if (blog_title == "" || description == "") { swal({ title: 'เกิดข้อผิดพลาด', text: 'กรุณากรอกข้อมูลให้ครบถ้วน', type: 'error' }); return false; } swal({ title: 'กรุณายืนยันเพื่อทำรายการ', type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', cancelButtonText: 'ยกเลิก', confirmButtonText: 'ยืนยัน', closeOnConfirm: false }, function() { $.ajax({ type: 'POST', url: 'ajax/gallery_setting/update_blog.php', data: formData, processData: false, contentType: false, dataType: 'json', success: function(data) { if (data.result == 0) { swal({ title: "เกิดข้อผิดพลาด", text: "กรุณาลองใหม่", type: "error", }); } else if (data.result == 1) { swal({ title: "แจ้งเตือน", text: "แก้ไขข้อมูลสำเร็จ", type: "success", showConfirmButton: false }); setTimeout(function() { $('#myModal').modal('hide'); swal.close(); LoadData(); }, 2000); } else if (data.result == 2) { swal({ title: "ดำเนินการไม่สำเร็จ", text: "พบรหัสนี้ในระบบ!", type: "warning", showConfirmButton: true, }); } }, }) }); } function SetIFrame(value, x) { let content_yt_id = value.value; $('#iframe_' + x).attr('src', "https://www.youtube.com/embed/" + content_yt_id); } </script> </body> </html>