JezK
Edit File: nonteaching.php
<?php session_start(); include("session_check.php"); include("header.php"); include_once("encription_key.php"); include_once("adm_operations2.php"); $admin=new adm_operations2(); $encry=new Encryption(); $school_id = $_SESSION['child']['log_school_id']; $acadamic_id = $_SESSION['child']['choosen_academic_id']; $nonteach_staff = $admin->details_nonteach_staff($school_id,$acadamic_id); // if($nonteach_staff){ // foreach ($nonteach_staff as $key => $val) { // print_r($key); // print_r($val['staff_name']); // } // } if($_GET['act']=='del' && isset($_GET['nt_id'])) { $del=$admin->deletenonteachstaff($_GET['nt_id']); if($del=='RE') { echo "<script>alert('You can not delete it as there is some data associated with this Non Teaching Staff');</script>"; } else { echo "<script>location.replace('nonteaching.php')</script>"; } } ?> <style> select { width: 62px !important; background-color: #FFF; border: 1px solid #CCC; } </style> <body style="overflow-x: hidden;"> <div class="row" style="margin-top: 30px;margin-top:30px;"> <div class="col-md-5 text-left" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:24px; margin-left:42px;"> <i class=" glyphicon glyphicon-tags" title ="Non Teaching Staff" style="font-size: 20px;margin: 0px 0px 0px -12px;"></i> Non Teaching Staff </div> <div class="col-md-6 text-center"> <button type="button" onClick="location.href='add_nonteaching.php'" class="btn btn-default" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;"> Add Staff </button> <button type="button" onClick="location.href='excel_templates/Staff_upload_excel.xls'" class="btn btn-default" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;"> Download Excel </button> <button type="button" onClick="location.href='nonteach_upload.php'" class="btn btn-default" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;"> Upload Excel </button> </div> </div> <div class="row" style="margin-left:10px;margin-right:10px; margin-top:30px;"> <div class="col-md-12 centered" style="font-family: Arial, Helvetica, sans-serif;"> <table id="myTable" class="table table-condensed table-hover" style="margin-top:20px;"> <thead> <tr class="info"> <th class="col-md-1 text-center">Sl.No</th> <th>Name</th> <th>Email</th> <th>Phone Number</th> <th>Driver License Number</th> <th>Type</th> <th>Actions</th> </tr> </thead> <tbody> <?php $i = 1; if($nonteach_staff): foreach($nonteach_staff as $key => $val): ?> <tr> <td class="col-sm-1 text-center" style=" font-size:14px;"><?=$i?></td> <td style=" font-size:14px;"><?=$val['staff_name']?></td> <td style=" font-size:14px;"><?=$val['staff_email']?></td> <td style=" font-size:14px;"><?=$val['staff_mobile']?></td> <td style="font-size:14px;"> <?=$val['staff_driving_license']?></td> <? if($val['staff_type'] == 2 ) $type = "Driver"; else if($val['staff_type']==3) $type = "Admin Staff"; else if($val['staff_type']==4) $type="Maid"; else if($val['staff_type']==5) $type="Others"; ?> <td style="font-size:14px;"><?=$type?></td> <td class="center"> <a class=" buttonn" href="edit_nonteaching.php?id=<?=$val['staff_id'];?>" style="margin:4px;"> <i class="glyphicon glyphicon-pencil" title ="Edit" style="font-size: 14px; color:#01aee6;"></i> </a> <a class=" buttonn" href="nonteaching.php?act=del&nt_id=<?=$val['staff_id']?>" onclick="return confirm('Do you want to Delete the Staff ?');" style="margin:4px;"> <i class=" glyphicon glyphicon-remove" title="Delete" style="font-size: 14px; color:#01aee6;"></i> </a> </td> </tr> <?php $i++; endforeach; endif; ?> </tbody> </table> </div> </div> <script src="//code.jquery.com/jquery-1.12.0.min.js"></script> <script src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/buttons/1.1.2/js/dataTables.buttons.min.js"></script> <script src="//cdn.datatables.net/buttons/1.1.2/js/buttons.print.min.js"></script> <script src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script> <script src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script> <script src="//cdn.datatables.net/buttons/1.1.2/js/buttons.html5.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script> <script type="text/javascript" language="javascript" class="init"> $(document).ready(function() { /*$('#myTable').DataTable({ "pageLength":100, stateSave: true, dom: 'T<"clear">lfrtip', "oLanguage": { "sSearch": "" }, tableTools: { "aButtons": [ { "sExtends": "xls", "mColumns": [0, 1, 2, 3, 4, 5] }, { "sExtends": "pdf", "sPdfOrientation": "landscape", "mColumns": [0, 1, 2, 3, 4, 5] }, { "sExtends": "print", "mColumns": [0, 1, 2, 3, 4, 5] } ] } }); $('div.dataTables_filter input').attr('placeholder', 'Search'); */ $('#myTable').DataTable( { dom: 'B<"clear">lfrtip', "iDisplayLength": 100, stateSave: true, buttons: [ { extend: 'print', title: '<center><h3><?php echo $_SESSION['child']['school_name']?></h3></center>', message: 'Non Teaching Staff<br>Academic Year:<?php echo $_SESSION[child][choosen_year_name]?><br>', exportOptions: { columns: [ 0, 1, 2, 3, 4, 5 ] } }, { extend: 'pdfHtml5', title:'<?php echo $_SESSION['child']['school_name']?>', message: 'Non Teaching Staff\nAcademic Year:<?php echo $_SESSION[child][choosen_year_name]?>\n', exportOptions: { columns: [ 0, 1, 2, 3, 4, 5 ] } }, { extend: 'excelHtml5', title:'<?php echo $_SESSION['child']['school_name']?>', exportOptions: { columns: [ 0, 1, 2, 3, 4, 5 ] } } ] } ); }); </script> <script> function deletestaff(id) { if (confirm("Are You sure want to delete this staff ?")) { $.ajax({ url: "ajaxcalls.php", type:"POST", data:"mode="+"delete_staff"+"&id="+id, success: function(result) { if(result == "ERR203") { location.replace('nonteaching.php?cresult=ERR203'); } else { location.replace('nonteaching.php?cresult=ERR205'); } }, error : function(e) { } }); } } </script> </body> </html>