PATH:
home2
/
pbkvidya
/
public_html
/
admin
/
Editing: view_notifications.php
<?php include_once('connect.php'); session_start(); // Check if the user is logged in if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) { echo "<script type='text/javascript'>window.location.href = 'index.php';</script>"; // Redirect to login page exit(); } include_once('head.php'); ?> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script type="text/javascript" language="javascript" > $(document).ready(function() { var dataTable = $('#notification-grid').DataTable( { "processing": true, "serverSide": true, "ajax":{ url :"view_data.php", // json datasource type: "post", // method , by default get data: {id: 'notification'}, error: function(){ // error handling $(".notification-grid-error").html(""); $("#notification-grid").append('<tbody class="notification-grid-error"><tr><th colspan="3">No data found in the server</th></tr></tbody>'); $("#notification-grid_processing").css("display","none"); } } } ); } ); </script> </head> <main id="main" class="main"> <div class="pagetitle"> <nav> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="index.html">Home</a></li> <li class="breadcrumb-item active">View News & Events</li> </ol> </nav> </div><!-- End Page Title --> <section class="section"> <div class="row"> <div class="col-lg-11"> <div class="card"> <div class="card-body"> <div class="row mb-3 bord-bottom" > <div class="col-lg-5"><h5 class="card-title">View All News & Events</h5></div> <div class="col-lg-5"><h5 class="card-title title-right"><a href="add_notification.php" class="btn btn-secondary">Add News & Events</a></h5></div> </div> <div class="sb2-2-1"> <div class="inn-title pt-20 "> <h4></h4> <p></p> </div > <div class="bor "> <table id="notification-grid" cellpadding="0" cellspacing="0" border="0" class="display" width="100%"> <thead> <tr> <th>Sl No.</th> <!-- <th>notification Title</th> --> <th>Notification Name</th> <th>Notification Link</th> <th>Edit</th> <th>Delete</th> </tr> </thead> </table> </div> </div> </div> </div> </div> </div> </section> <!-- Delete Modal HTML --> <div id="myModal" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <form> <div class="modal-header"> <h4 class="modal-title">Delete News & Events</h4> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body"> <input type="hidden" id="id_d" name="id" class="form-control"> <p>Are you sure you want to delete these Records?</p> <p class="text-warning"><small>This action cannot be undone.</small></p> </div> <div class="modal-footer"> <input type="hidden" value="delnotification" name="type"> <input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel"> <button type="button" class="btn btn-danger" id="delete" name="delete">Delete</button> </div> </form> </div> </div> </div> <!--delete modal ends--> </main><!-- End #main --> <?php include_once('footer.php'); ?> <!-- Ajax--> <script type="text/javascript"> $(document).on("click", ".delete", function() { var id=$(this).attr("data-id"); $('#id_d').val(id); }); $("#delete").click(function() { $.ajax({ url: "delete_data.php", type: "POST", cache: false, data:{ type:'delnotification', id: $("#id_d").val() }, success: function(dataResult){ alert("News & Events deleted"); $("#"+dataResult).remove(); location.reload(); } }); }); $("#file").change(function() { var file = this.files[0]; var fileType = file.type; var match = ['application/pdf', 'application/msword', 'application/vnd.ms-office', 'image/jpeg', 'image/png', 'image/jpg']; if(!((fileType == match[0]) || (fileType == match[1]) || (fileType == match[2]) || (fileType == match[3]) || (fileType == match[4]) || (fileType == match[5]))){ alert('Sorry, only PDF, DOC, JPG, JPEG, & PNG files are allowed to upload.'); $("#file").val(''); return false; } }); </script> <script type="text/javascript"> function goBack() { window.history.back(); } </script>
SAVE
CANCEL