JezK
Edit File: schooladmin_usermanagement.php
<?php session_start(); include("adm_operations.php"); if ($_SESSION['child']['current_academic_id'] != $_SESSION['child']['choosen_academic_id']) { echo "<script>alert('Users can not be managed for past Academic Years');</script>"; echo "<script>location.replace('academicyear_management.php');</script>"; } $operations = new adm_operations(); $rows = $operations->getallmyschoolstaff($_SESSION['child']['log_school_id'], $_SESSION['child']['choosen_academic_id']); include("header.php"); ?> <style> #nav { margin: auto; width: 638px !important; padding-left: 0; padding-right: 0; list-style: none; background: #18b88d; } #nav li { display: inline-block; margin: 0 auto; text-align: center; } #nav li a { display: inline-block; padding: 7px 0; text-align: center; text-decoration: none; color: #FFFFFF; margin: auto; } #nav li:hover, li:active { background: rgb(54, 120, 102); width: 90px; } #nav li.selected { background: rgb(54, 120, 102); } select { width: 62px !important; background-color: #FFF; border: 1px solid #CCC; } .table-condensed>thead>tr>th, .table-condensed>tbody>tr>th, .table-condensed>tfoot>tr>th, .table-condensed>thead>tr>td, .table-condensed>tbody>tr>td, .table-condensed>tfoot>tr>td { padding: 3px; } </style> <body style="overflow-x: hidden;"> <div class="row" style="margin-top: 30px;"> <div class="col-md-9 text-start" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:24px;"> <i class="fa fa-user" title="User management" style="font-size: 20px;margin: 0px 0px 0px 19px;"></i> User Management </div> <div class="col-md-3 text-center"> <button type="button" onClick="location.href='add_user.php'" class="btn btn-outline-secondary" style="font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;">Add/Update User</button> </div> </div> <br> <div class="menuu"> <ul id="nav" class="margn_auto"> <li class="selected" style="border-right:1px solid #FFFFFF;width:214px; text-align:center;margin-left:-3px;font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"> <a href="schooladmin_usermanagement.php"><img src="images/user_school-admin-white.png" title="Users for School Admin" style="margin-right:5px;" />Users for School Admin</a> </li> <li style=" border-right:1px solid #FFFFFF;width:215px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"> <a href="teacherapp_usermanagement.php"><img src="images/user_teacher-app-white.png" title="Users for Teacher App" style="margin-right:5px;" />Users for Teacher App</a> </li> <li style="width:210px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"> <a href="driverapp_usermanagement.php"><img src="images/user_driver-app-white.png" title="Users for Driver App" style="margin-right:5px;" />Users for Driver App</a> </li> </ul> </div> <div class="row" style="margin-left:10px;margin-right:10px;"> <div class="col-md-12 centered" style="font-family: Arial, Helvetica, sans-serif;margin-top:30px;"> <table id="myTable" class="table table-condensed table-hover" style="margin-top:-10px;"> <thead> <tr class="info"> <th class="col-md-1 text-center" style="width:3%!important;">Sl.No</th> <th style="width:15%!important;">Staff Name</th> <th style="width:15%!important;">Email</th> <th style="width:15%!important;">Phone Number</th> <th style="width:15%!important;">Privileges</th> <th style="width:15%!important;">Staff Type</th> <th style="width:15%!important;">Status</th> <th style="width:5%!important;" class="text-center">Action</th> </tr> </thead> <tbody > <?php $x = 1; if ($rows != 'not') foreach ($rows as $record) { $mypre = ''; $stype = ''; if ($record['privileges'] != '') { $xplod = explode(',', trim($record['privileges'], ',')); if (count($xplod)) { if (in_array(1, $xplod)) { $mypre = '<span>Attendance</span><br>'; } if (in_array(2, $xplod)) { $mypre .= '<span>Diary</span><br>'; } if (in_array(3, $xplod)) { $mypre .= '<span>Notice Board</span><br>'; } if (in_array(4, $xplod)) { $mypre .= '<span>Examination</span><br>'; } if (in_array(5, $xplod)) { $mypre .= '<span>Transport</span><br>'; } if (in_array(6, $xplod)) { $mypre .= '<span>Fee</span><br>'; } } } switch ($record['staff_type']) { case 1: $stype = 'Teacher'; break; case 2: $stype = 'Driver'; break; case 3: $stype = 'Admin Staff'; break; case 4: $stype = 'Maid'; break; case 5: $stype = 'Others'; break; } if ($record['school_admin_access'] == '1') { $sts = 'Active'; $deact = 0; $asts = '<i class="fa-solid fa-ban" title="Deactivate" style="font-size: 13px; color:#ff0000;"></i>'; } else if ($record['school_admin_access'] == '2') { $sts = 'Inactive'; $deact = 1; $asts = '<i class="fa-solid fa-circle-check" title ="Activate" style="font-size: 13px; color:#0F9B0C!important;"></i>'; } else { $sts = 'Deactivated '; $deact = 1; $asts = '<i class="fa-solid fa-circle-check" title ="Activate" style="font-size: 13px; color:#0F9B0C!important;"></i>'; } echo ' <tr> <td class="col-sm-1 text-center" style=" font-size:14px; ">' . $x . '</td> <td style=" font-size:14px;">' . $record[staff_name] . '</td> <td style=" font-size:14px; ">' . $record[staff_email] . '</td> <td style=" font-size:14px; ">' . $record[staff_mobile] . '</td> <td style=" font-size:14px; "> ' . $mypre . ' </td> <td>' . $stype . '</td> <td style=" font-size:14px; ">' . $sts . '</td> <td class="text-center"><a href="javascript:void(0)" onclick="activeNdeactive(' . $record[staff_id] . ',' . $deact . ')">' . $asts . '</a></td> </tr>'; $x++; } ?> </tbody> </table> </div> </div> <script type="text/javascript" language="javascript" src="Excel/media/js/jquery.js"></script> <script type="text/javascript" language="javascript" src="Excel/media/js/jquery.dataTables.js"></script> <script type="text/javascript" language="javascript" src="Excel/js/dataTables.tableTools.js"></script> <script type="text/javascript" language="javascript" src="Excel/examples/resources/syntax/shCore.js"></script> <script type="text/javascript" language="javascript" src="Excel/examples/resources/demo.js"></script> <script type="text/javascript" language="javascript" class="init"></script> <script> $(document).ready(function() { $('#myTable').dataTable({ "pageLength": 100, stateSave: true }); }); function activeNdeactive(reference, state) { if (state == 1) { if (confirm("Do you want to activate the User ?")) { $.post('ajax_posts.php', { stfid: reference, sts: state, acs: 'adm' }, function(data) { window.location.href = "schooladmin_usermanagement.php"; }); } } else { if (confirm("Do you want to deactivate the User ?")) { $.post('ajax_posts.php', { stfid: reference, sts: state, acs: 'adm' }, function(data) { window.location.href = "schooladmin_usermanagement.php"; }); } } } </script> </body> </html>