JezK
Edit File: academicyear_management.php
<?php session_start(); include('session_check.php'); include('adm_operations.php'); $operations=new adm_operations(); include('school_timeout.php'); if(isset($_GET['ac_id']) && $_GET['act']=='delete') { $delete_call=$operations->deleteacademicyear($_GET['ac_id']); if($delete_call=='cannot') { echo "<script>alert('You can not delete it as some data is associated with this Academic Year');</script>"; echo "<script>location.replace('academicyear_management.php');</script>"; } else { if($_GET['ac_id']==$_SESSION['child']['current_academic_id']) { unset($_SESSION['child']['current_academic_id']); unset($_SESSION['child']['section_id_licence']); unset($_SESSION['child']['stu_class_id_licence']); unset($_SESSION['child']['cur_year_name']); if($_GET['ac_id']==$_SESSION['child']['choosen_academic_id']) { unset($_SESSION['child']['choosen_academic_id']); unset($_SESSION['child']['choosen_year_name']); } } else if($_GET['ac_id']==$_SESSION['child']['choosen_academic_id']) { unset($_SESSION['child']['choosen_academic_id']); unset($_SESSION['child']['choosen_year_name']); unset($_SESSION['child']['section_id_licence']); unset($_SESSION['child']['stu_class_id_licence']); if($_GET['ac_id']==$_SESSION['child']['current_academic_id']) { unset($_SESSION['child']['current_academic_id']); unset($_SESSION['child']['cur_year_name']); } } //echo "<script>alert('Successfully deleted');</script>"; header('Location:academicyear_management.php'); } } if(isset($_GET['acd_id'])) { $inlimit=$operations->chosenislessthannow($_GET['acd_id']); if($inlimit=='yes') { $cur_year=$operations->getacademicyearNameByacademicId($_GET['acd_id']); $_SESSION['child']['choosen_academic_id']=$_GET['acd_id']; $_SESSION['child']['choosen_year_name']=$cur_year['academic_name']; unset($_SESSION['child']['section_id_licence']); unset($_SESSION['child']['stu_class_id_licence']); /*if($_SESSION['child']['current_academic_id']=='Not defined' || $_SESSION['child']['current_academic_id']=='') { $_SESSION['child']['current_academic_id']=$_SESSION['child']['choosen_academic_id']; $_SESSION['child']['cur_year_name']=$_SESSION['child']['choosen_year_name']; }*/ } else { echo "<script>alert('Future Academic Year can not be chosen');</script>"; } } $records=$operations->getAllAcademicYearsofme($_SESSION['child']['log_school_id']); $k=1; include('yearmanager.php'); include("header.php"); ?> <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-left:10px;"> <div class="col-md-9 text-left" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:24px; "> <i class=" glyphicon glyphicon-calendar" title =" School management" style="font-size: 20px;margin: 0px 0px 0px -15px;"></i> Academic Year Management </div> <div class="col-md-3 text-center"> <button type="button" onClick="location.href='add_academicyear.php'" class="btn btn-default" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;"> Add Academic Year </button> </div> </div> <div class="row" style="margin-top:20px; font-family:Arial, Helvetica, sans-serif;font-style:normal;font-size:13px;"> <div class="col-md-3"> <div class="col-md-8 text-right" > <b style="color:#666666;">Current Academic Year</b> </div> <div class="col-md-4 text-left"> <?php echo $_SESSION['child']['cur_year_name'];?> </div> </div> <div class="col-md-3"> <div class="col-md-8 text-right"> <b style="color:#666666;">Chosen Academic Year</b> </div> <div class="col-md-4 text-left"> <?php if(isset($_SESSION['child']['choosen_academic_id'])) echo $_SESSION['child']['choosen_year_name']; else echo $_SESSION['child']['cur_year_name']; ?> </div> </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;"> <table id="myTable" class="table table-condensed table-hover" style="margin-top:-10px;"> <thead> <tr class="info"> <th class="col-md-1 text-center">Sl.No</th> <th>Academic Year</th> <th>Start Date</th> <th>End Date</th> <th>Actions</th> </tr> </thead> <tbody> <?php if($records!=ERR213) foreach($records as $row) { echo ' <tr> <td class="col-sm-1 text-center" style=" font-size:14px;">'.$k.'</td> <td style=" font-size:14px;">'.$row[academic_name].'</td> <td style=" font-size:14px;">'.str_replace('-','/',date('d-m-Y',strtotime($row[academic_startdate]))).'</td> <td style="font-size:14px;"> '.str_replace('-','/',date('d-m-Y',strtotime($row[academic_enddate]))).'</td> <td class="center"> <a class=" buttonn" href="edit_academicyear.php?ac_id='.$row[academic_id].'" style="margin:4px;"> <i class="glyphicon glyphicon-pencil" title ="Edit" style="font-size: 14px; color:#01aee6;"></i> </a> <a class=" buttonn" href="academicyear_management.php?ac_id='.$row[academic_id].'&act=delete" style="margin:4px;" onclick="return confirm(\'Do you want to delete this Academic Year ?\')"> <i class=" glyphicon glyphicon-remove" title="Delete" style="font-size: 14px; color:#01aee6;"></i> </a> <a class=" buttonn" href="academicyear_management.php?acd_id='.$row[academic_id].'" style="margin:4px;" onclick="return confirm(\'Do you want to choose this Academic Year as your Chosen Academic Year ?\')"> <i class=" glyphicon glyphicon-folder-open" title="Choose as Academic Year" style="font-size: 14px;color:#01aee6;"></i> </a> </td> </tr>'; $k++; } ?> </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> $(document).ready(function() { $('#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: 'Academic Year Management', exportOptions: { columns: [ 0, 1, 2, 3 ] } }, { extend: 'pdfHtml5', title:'<?php echo $_SESSION['child']['school_name']?>', message: 'Academic Year Management', exportOptions: { columns: [ 0, 1, 2, 3 ] } }, { extend: 'excelHtml5', title:'<?php echo $_SESSION['child']['school_name']?>', exportOptions: { columns: [ 0, 1, 2, 3 ] } } ] } ); } ); </script> </body> </html>