JezK
Edit File: license_management.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; } .grey{ color:grey !important; font-size:12px; } </style> <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-bookmark" title ="License Management" style="font-size: 20px;"></i> License Management </div> <div class="col-md-2 text-center"> </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; font-style:normal;font-size:13px;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;">No.Of Licenses</th> <th style="text-align:left;">Date Of Purchase</th> <th style="text-align:left;">Date Of Expiry</th> <th style="text-align:left;">Status</th> <th style="text-align:left;">Validity</th> <th style="text-align:left;">Actions</th> </tr> </thead> <tbody> <?php if($schools) { foreach($schools as $row) { $i=1; $totlic=0; $lic_info=$operation->get_All_licensesOfschool($row['school_id']); if($lic_info!=0) foreach($lic_info as $lic) { $totlic+=$lic[license_count]; if($lic[license_status]==1) { $sym='<i class="red glyphicon glyphicon-ban-circle" title="Deactivate" style="font-size: 14px;"></i>'; $s='down'; $cmsg='onclick="return confirm(\'Do you want to Deactivate the License for this School ?\')"'; $lstate="Active"; } else { $sym='<i class="green glyphicon glyphicon-ok-circle" title="Activate" style="font-size: 14px;"></i>'; $s='up'; $cmsg='onclick="return confirm(\'Do you want to Activate the License for this School ?\')"'; $lstate="Deactivated"; } if($lic[license_valid_to] < date('Y-m-d')) { $disable="href='javascript:void(0);'"; $sym='<i class="grey glyphicon glyphicon-ban-circle" title="Deactivate" style="font-size: 14px;"></i>'; $cmsg=''; $lstate='Expired'; } else { $disable="href='deactive_licence.php?lcid=".$lic[school_license_id]."&state=".$s."' ".$cmsg; } $date1=date_create(date('Y-m-d')); $date2=date_create($lic[license_valid_to]); $diff=date_diff($date1,$date2); 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;">'.$row[school_name].'</td> <td style="font-size:14px;text-align:left;">'.$lic[license_count].'</td> <td style="font-size:14px;text-align:left;">'.date('d M Y',strtotime($lic[created_on])).'</td> <td style="font-size:14px;text-align:left;">'.date('d M Y',strtotime($lic[license_valid_to])).'</td> <td style="font-size:14px;text-align:left;">'.$lstate.'</td> <td style="font-size:14px;text-align:left;">'.$diff->format("%R%a days").'</td> <td class="center"> <a class=" buttonn" href="license_renewal.php?lcid='.$lic[school_license_id].'" style="margin:4px;"> <i class=" glyphicon glyphicon-registration-mark" title="Renewal" style="font-size: 14px;"></i> </a> <a class=" buttonn" '.$disable.' style="margin:4px;"> '.$sym.' </a> </td> </tr>'; $i++; } echo ' <tr> <td> </td> <td> </td> <td style=" font-size:14px;">Total Number Of Licenses : '.$totlic.'</td> <td style=" font-size:14px;">License Key : '.$row[school_license].'</td> <td> </td> <td> </td> <td style=" font-size:14px;"> <a href="add_license.php?schid='.$row[school_id].'" class="btn btn-default" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;">Add License</button> </td> <td> </td> </tr>'; } }?> </tbody> </table> </div> </div> <script> $(document).ready(function() { $('#myTable').DataTable( { dom: 'T<"clear">lfrtip', "bSort" : false, "pageLength":100, "oLanguage": { "sSearch": "" }, tableTools: { "aButtons": [ { "sExtends": "pdf", "sPdfOrientation": "landscape", "mColumns": [0, 1, 2, 3, 4] }, { "sExtends": "print" } ] } }); $('div.dataTables_filter input').attr('placeholder', 'Search'); } ); </script> </body> </html>