JezK
Edit File: schoolmanagement.php
<?php include('session_check.php'); include('header.php'); $schools = $operation->get_Allschoolformanage(); ?> <style> .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; } .red { color: #ff0000 !important; font-size: 12px; } .green { color: #0F9B0C !important; font-size: 12px; } #myTable_filter input { width: 200px; padding: 5px; border: 1px solid #ccc; border-radius: 5px; margin-bottom: 10px; } </style> <script> function deleteschoolfrom(shreference) { if (confirm('Do you want to delete the school ?')) { $.post('regeneratelicensekey.php', { sc_id: shreference, type: 'd' }, function(data) { // alert(data); if (data == 'AEBT') alert('You can not delete it as some data is associated with the School'); else { // alert('School deleted successfully'); window.location.href = "schoolmanagement.php"; } }); } } function generatekeytoschool(identity, sts) { if (confirm('Do you want to Regenerate the License Key for this School ?')) { if (!isNaN(identity) && identity != 0) { $.post('regeneratelicensekey.php', { sc_id: identity }, function(data) { //if(data=='1') //alert('Key generated and mail sent successfully'); }); } } } function ActivateandDeactivate(identity, status) { // alert(status); var s = 0; if (status == 1) s = "Activate"; else s = "Deactivate"; if (confirm('Do you want to ' + s + ' this School ?')) { if (!isNaN(identity) && identity != 0) { $.post('activeNinactive.php', { sc_id: identity, sts: status }, function(data) { // alert(data); if (data == 1) { location.reload(); } else { location.reload(); } }); } } } function showreason() { alert("School is Inactive. Hence License Regeneration can not be done."); } </script> <body style="overflow-x: hidden;"> <div class="row" style="margin-top: 30px;"> <div class="col-md-9 text-left" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:24px; margin-left:20px;"> <i class="fa-solid fa-house" title="School Management" style="font-size: 25px;"></i> School Management </div> <div class="col-md-2 text-center"> <button type="button" onClick="location.href='addschool.php'" class="btn btn-outline-secondary" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;">Add School</button> </div> </div> <div class="row overflow-x-auto" 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"> <thead> <tr class="info"> <th class="col-md-1 text-center" style="text-align:left;">Sl.No</th> <th style="text-align:left;">School Name</th> <th style="text-align:left;">School Email</th> <th style="text-align:left;">Modules Purchased</th> <th style="text-align:left;">School Phone</th> <th style="text-align:left;">Actions</th> </tr> </thead> <tbody> <?php $i = 1; if ($schools != 0) { foreach ($schools as $row) { if ($row['school_status'] == 1) { $title = 'Deactivate'; $sch_sts = 0; $c = 'red fa-solid fa-ban'; $regen = 'onclick="generatekeytoschool(' . $row['school_id'] . ',' . $row['school_status'] . ');"'; } else { $title = 'Activate'; $sch_sts = 1; $c = 'green fa-solid fa-circle-check'; $regen = 'onclick="showreason();"'; } $linfo = $operation->get_school_privileges($row['school_id']); $modprev = ''; $one = ""; $two = ""; $three = ""; $four = ""; $five = ""; $six = ""; if ($linfo['res'] != 0) { $mp_ids = array(); $mp_ids = $linfo['result']; for ($u = 0; $u < count($linfo['result']); $u++) { if ($mp_ids[$u] == 1) { $one = "<span>Attendance</span><br>"; } if ($mp_ids[$u] == 2) { $two = "<span>Diary</span><br> "; } if ($mp_ids[$u] == 3) { $three = "<span>Notice Board</span><br>"; } if ($mp_ids[$u] == 4) { $four = "<span>Examinations</span><br>"; } if ($mp_ids[$u] == 5) { $five = "<span>Transport</span><br>"; } if ($mp_ids[$u] == 6) { $six = "<span>Fee Payment</span>"; } } } echo ' <tr> <td class="col-sm-1 text-center" style="font-size:14px;text-align:left;">' . $i . '</td> <td style="font-size:14px;text-align:left;"><a href="#" onMouseOver="this.style.color=\'#01aee6\'" onMouseOut="this.style.color= \'#000000\' " style="color:#000000; text-decoration:none;" >' . $row['school_name'] . '</a></span></td> <td style=" font-size:14px;text-align:left;">' . $row['school_email'] . '</td> <td style=" font-size:14px;text-align:left;"> ' . $one . $two . $three . $four . $five . $six . ' </td> <td style="font-size:14px;text-align:left;">' . $row['school_phone'] . '</td> <td class="center"> <a class="buttonn" href="editschool.php?shlid=' . $row['school_id'] . '" style="margin:4px;text-decoration:none"> <i class="fa-solid fa-pencil" title="Edit" style="font-size: 13px;"></i> </a> <a class="buttonn" href="javascript:void(0);" onclick="ActivateandDeactivate(' . $row['school_id'] . ',' . $sch_sts . ');" style="margin:4px;text-decoration:none"> <i class="' . $c . '" title="' . $title . ' " style="font-size: 14px;"></i> </a> <a class="buttonn" href="javascript:void(0);" ' . $regen . ' style="margin:4px;text-decoration:none"> <i class="fa-solid fa-arrows-rotate" title="Refresh" style="font-size: 14px;"></i> </a> <a class=" buttonn" href="javascript:void(0)" style="margin-top:4px;text-decoration:none" onclick="return deleteschoolfrom(' . $row['school_id'] . ')"> <i class=" fa-solid fa-xmark" title="Delete" style="font-size: 14px;"></i> </a> </td> </tr>'; $i++; } } ?> </tbody> </table> </div> </div> <script> $(document).ready(function() { $('#myTable').dataTable(); }); </script>