JezK
Edit File: license_data.php
<?php //~ ini_set('display_errors', 1); //~ ini_set('display_startup_errors', 1); //~ error_reporting(E_ALL); if (session_id() == "") { session_start(); } include_once("school_admin_access.php"); include_once("school_admin_student.php"); include_once("encription_key.php"); //~ print_r($_SESSION); $admin = new adminaccess(); $student = new studentacess(); $class_id = $_REQUEST['classid']; //~ echo $class_id; //~ exit; $section_id = $_REQUEST['sec_id']; $school_id = $_SESSION['child']['log_school_id']; $_SESSION['child']['section_id_licence'] = $section_id; //~ echo $section_id; //~ exit; $_SESSION['child']['stu_class_id_licence'] = $class_id; //$acadamic_year_details =$admin->get_acadamic_year($school_id); //$academic_id = $acadamic_year_details['academic_id']; $academic_id = $_SESSION['child']['current_academic_id']; $choosen_acc_id = $_SESSION['child']['choosen_academic_id']; $details_class = $admin->get_classes_byschool($school_id); $sections = $admin->get_sections_all(); $student_details = $admin->students_data_licence($class_id, $section_id, $school_id, $choosen_acc_id); $license_details = $student->students_license_data($school_id); //echo count($license_details); $school_licene_count = $admin->check_license_count($school_id); //~ print_r( $school_licene_count); //~ exit; $distribute_licene_count = $admin->check_distributelicense_count($school_id, $choosen_acc_id); $licencecount = '0'; if ($school_licene_count) { foreach ($school_licene_count as $key => $val) { $licencecount = $licencecount + $key; } //~ print_r($val); //~ exit; } //echo $license_details['21']['license_key']; //echo "<pre>"; //print_r($license_details); ?> <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: 2px; } </style> <table id="myTable" class="table table-condensed table-hover" style="margin-top:-40px; font-family:Arial, Helvetica, sans-serif;font-style:normal;font-size:13px;"> <thead> <tr class="info"> <th class="no-sort col-md-1 text-center"> <input type="checkbox" id="select-all" name="select-all" onclick="selct_all(this)" style="margin-top:-2px;margin-left:-17px;"> Sl.No </th> <th>Student Roll Number</th> <th>Student Name</th> <th>License Key</th> <th>Class</th> <th>Section</th> <th>Status</th> <th>Email Status</th> <th>Actions</th> </tr> </thead> <tbody> <?php $studentids = ''; if ($student_details) { $i = 1; foreach ($student_details as $key => $val) { $studentids .= "," . $key; $studentids = ltrim($studentids, ','); $studentids = rtrim($studentids, ','); //~ print_r($license_details[$val['student_id']]); //~ exit; //if($license_details[$val['student_id']]['license_status'] == "1" && $val['status'] == '1'){ ?> <tr> <td class="col-sm-1 text-center" style="font-family:Arial, Helvetica, sans-serif;font-style:normal;font-size:13px;padding-top:12px;"> <?php if (isset($license_details[$val['student_id']]) && $license_details[$val['student_id']]['license_status'] == '1') { $status = "Active"; } else if (isset($license_details[$val['student_id']]) && $license_details[$val['student_id']]['license_status'] == '0') { $status = "Deactivated"; } else { $status = "Inactive"; } if (isset($license_details[$val['student_id']]) && $license_details[$val['student_id']]) { $studen_id = $val['student_id']; } else { $studen_id = '00'; } /*if($license_details[$val['student_id']]['license_key']) { $dis = "disabled=disabled"; } else { $dis = "enabled=enabled"; } */ ?> <label class="checkbox-inline" style="display:flex"> <input type="checkbox" class="checkbox1" onclick="test(this.value,'<?= $val['student_id'] ?>','<?= $status ?>','<?= $val['student_email_send_status'] ?>')" name="student_ids_data[]" id="student_ids_data<?= $val['student_id'] ?>" value="<?= $studen_id ?>" style="margin-top:3px;"> <span><?= $i ?></span> <input type="hidden" class="checkbox1" name="student_ids_data_values[]" id="student_ids_data_value<?= $val['student_id'] ?>" value="<?= $val['student_id'] ?>" style="margin-top:3px;"> <input type="hidden" class="checkbox1" name="student_ids_data_status[]" id="student_ids_data_status<?= $val['student_id'] ?>" value="<?= $status ?>" style="margin-top:3px;"> <input type="hidden" class="checkbox1" name="student_ids_data_mail[]" id="student_ids_data_mail<?= $val['student_id'] ?>" value="<?= $val['student_email_send_status'] ?>" style="margin-top:3px;"> </label> </td> <td style=" padding-top:12px;" class="col-sm-2 text-center lice_details"><?= $val['student_rollno'] ?></td> <td style=" padding-top:12px;" class="lice_details"><?= $val['student_firstname'] . " " . $val['student_lastname'] ?></td> <td style=" padding-top:12px;" class="lice_details"><?= (isset($license_details[$val['student_id']]) && $license_details[$val['student_id']]['license_key']) ? $license_details[$val['student_id']]['license_key'] : '' ?></td> <td style=" padding-top:12px;" class="lice_details"><?= $details_class[$val['class_id']]['class_name'] ?></td> <td style=" padding-top:12px;" class="lice_details"><?= $sections[$val['section_id']]['section_name'] ?></td> <td style=" padding-top:12px;" class="lice_details"><?= $status ?></td> <?php if (isset($license_details[$val['student_id']]) && !$license_details[$val['student_id']]['license_key']) { $disbled = "disabled=disabled"; } else { $disbled = ""; } ?> <?php if ($val['student_email_send_status'] == '0') { ?> <td> <p style="color:#FF0000; padding-top:12px;">Not Sent</p> </td> <?php } else { ?> <td> <p style="color:#008000; padding-top:12px; ">Sent</p> </td> <?php } ?> <?php if (isset($license_details[$val['student_id']]) && $license_details[$val['student_id']]['license_status'] == '0') { ?> <td><button style="margin-top: 9px; font-family: Arial, Helvetica, sans-serif; font-size: 14px; padding: 4px 10px;" type="button" class="btn " onclick="status_change(<?= $val['student_id'] ?>,1)" id="licence_activate" name="licence_activate" class="button lice_details_but" <?= $disbled ?>>Activate</button></td> <?php } else { ?> <td><button style="margin-top: 9px; font-family: Arial, Helvetica, sans-serif; font-size: 14px; padding: 4px 10px;" type="button" class="btn " onclick="status_change(<?= $val['student_id'] ?>,0)" id="licence_deactivate" name="licence_deactivate" class="button lice_details_but" <?= $disbled ?>>Deactivate</button></td> <?php } ?> <!-- width:90px;margin-top:3px;height:30px; --> </tr> <?php $i++; //} } ?> </tbody> <input type="hidden" name="students_data" id="students_data" value=""> <input type="hidden" name="studentids" id="studentids" value="<?= $studentids ?>"> <input type="hidden" name="students_data_val" id="students_data_val" value=""> <input type="hidden" name="students_data_sta" id="students_data_sta" value=""> <input type="hidden" name="students_data_mail" id="students_data_mail" value=""> <input type="hidden" name="total_licences" id="total_licences" value="<?= $licencecount ?>"> <input type="hidden" name="distribute_licences" id="distribute_licences" value="<?= $distribute_licene_count['distributedcount'] ?>"> </table> <?php } ?> <script> $(document).ready(function() { $("#student_ids_data").click(function() { if (1 == 1) { alert('test'); } }); }); </script>