JezK
Edit File: schoolmanagement1.php
<?php include('session_check.php'); include('header.php'); include('sa_operations.php'); $operation = new sa_operations(); $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; } </style> <script> function deleteschoolfrom(shreference) { if (confirm('Do you want to delete the school ?')) { $.post('regeneratelicensekey.php', { sc_id: shreference, type: 'd' }, function(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) { 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) { if (data == '1') { //alert('School Activated successfully'); location.reload(); } else { //alert('School Deactivated successfully'); 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=" glyphicon glyphicon-home" title="School Management" style="font-size: 20px;margin-left:-3px;"></i> School Management </div> <div class="col-md-2 text-center"> <button type="button" onClick="location.href='addschool.php'" class="btn btn-default" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;">Add School</button> </div> </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="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;">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 glyphicon glyphicon-ban-circle'; $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();"'; } 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="viewschooldetails.php?shlrid=' . $row[school_id] . '" onMouseOver="this.style.color=\'#01aee6\'" onMouseOut="this.style.color= \'#000000\' " style="color:#000000; text-decoration:underline;" >' . $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;">' . $row[school_phone] . '</td> <td class="center"> <a class="buttonn" href="editschool.php?shlid=' . $row[school_id] . '" style="margin:4px;"> <i class="glyphicon glyphicon-pencil" title="Edit" style="font-size: 14px;"></i> </a> <a class="buttonn" href="javascript:void(0);" onclick="ActivateandDeactivate(' . $row[school_id] . ',' . $sch_sts . ');" style="margin:4px;"> <i class="' . $c . '" title="' . $title . '" style="font-size: 14px;"></i> </a> <a class="buttonn" href="javascript:void(0);" ' . $regen . ' style="margin:4px;"> <i class="glyphicon glyphicon-registration-mark" title="Regenerate License" style="font-size: 12px;"></i> </a> <a class=" buttonn" href="javascript:void(0)" style="margin:4px;" onclick="return deleteschoolfrom(' . $row[school_id] . ')"> <i class=" glyphicon glyphicon-remove" title="Delete" style="font-size: 12px;"></i> </a> </td> </tr>'; $i++; } } ?> </tbody> </table> </div> </div> <script> $(document).ready(function() { $('#myTable').dataTable(); }); </script>