JezK
Edit File: general_comments.php
<?php session_start(); include("menuheader.php"); if (!(in_array(2, $access) && in_array(2, $allow))) echo "<script>location.replace('dashboard.php');</script>"; include_once("school_admin_access.php"); include_once("school_admin_student.php"); $page = basename($_SERVER['PHP_SELF']); if ($page == "general_comments.php") { $menuclass = "selected"; } $admin = new adminaccess(); $student = new studentacess(); $sch_id = $_SESSION['child']['log_school_id']; $choosen_acc_id = $_SESSION['child']['choosen_academic_id']; $student_ids = $_SESSION['child']['studentids']; $dairy_class_ids = $_SESSION['child']['dairy_class_id']; //echo "<pre>"; //print_r($classname); //print_r($Sectionname); $gene_type = ''; //$gene_type = $_SESSION['child']['dairy_type_general']; if (isset($_SESSION['child']['dairy_type_general'])) { $gene_type = $_SESSION['child']['dairy_type_general']; } else { $gene_type = 'all'; } //print_r($_SESSION); $gene_names = $_SESSION['child']['general_names']; $details = $admin->get_classes_byschool_total($sch_id, $choosen_acc_id); //$section_byclass =$admin->get_section_byclass($details[0]['class_id']); if ($_SESSION['child']['dairy_class_id']) { // echo 'hii';exit; $section_byclass = $admin->get_sections_data_byclass($_SESSION['child']['dairy_class_id']); } if ($_SESSION['child']['dairy_date']) { $filldate = $_SESSION['child']['dairy_date']; } else { $filldate = date('d/m/Y'); } ?> <style> #nav { margin: auto; width: 427px !important; padding-left: 0; padding-right: 0; list-style: none; background: rgb(51, 93, 220) none repeat scroll 0% 0%; } #nav li { display: inline-block; margin: 0 auto; text-align: center; } #nav li a { display: inline-block; padding: 7px 0; text-align: center; text-decoration: none; color: #FFFFFF; margin: auto; } #nav li:hover, li:active { background-color: #0b287b; width: 90px; } #nav li.selected { background: #0b287b; } select { width: 62px !important; background-color: #FFF; border: 1px solid #CCC; } .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; } .multiselect { width: 290px; } .selectBox { position: relative; } .selectBox select { width: 100%; font-weight: bold; } .overSelect { position: absolute; left: 0; right: 0; top: 0; bottom: 0; } #checkboxes { display: none; border: 1px #dadada solid; } #checkboxes label { display: block; } #checkboxes label:hover { background-color: #0f2964; } </style> <script> var expanded = false; function showCheckboxes() { var checkboxes = document.getElementById("checkboxes"); if (!expanded) { checkboxes.style.display = "block"; expanded = true; } else { checkboxes.style.display = "none"; expanded = false; } } function check_all() { alert(); var classname = $('#classes').find('option:selected').text(); var secname = $('#sections').find('option:selected').text(); students_ids = document.getElementsByName('students_ids[]'); var names = document.getElementById('student_allnames_data').value; var temp = names; var temp1 = temp; var student_status = $('#student_status').val(); var acadamic_id = <?php echo $choosen_acc_id ?>; var class_id = $("#classes").val(); var sec_id = $("#sections").val(); var date_val = $("#date_dairy").val(); var school_id = $("#school_id").val(); var txt = ''; var student_all_ids = document.getElementById('student_all_ids').value if (document.getElementById("selectall").checked == true) { $(".checkbox1").prop("checked", true); for (var i = 0, n = students_ids.length; i < n; i++) { txt = txt + students_ids[i].value + "," // alert(txt); } if (student_all_ids.length == txt.length) { txt = "all"; } else { txt = txt; } //alert(txt); document.getElementById('student_ids_data').value = txt; //document.getElementById('student_ids_data').value = "all"; document.getElementById('student_status').value = "all"; document.getElementById('student_status_check').value = ""; document.getElementById('student_allnames_data').value = document.getElementById('student_names_data').value; students_data = '<option selected="selected" > All </option>'; $("#students").html(students_data); } else { $(".checkbox1").prop("checked", false); // alert('Please select any one of the student'); document.getElementById('student_ids_data').value = ''; document.getElementById('gene_names').value = ''; document.getElementById('students_edit').value = 0; document.getElementById('student_status').value = ""; document.getElementById('student_status_check').value = "1"; document.getElementById('student_allnames_data').value = ''; students_data = '<option selected="selected" > Select Students </option>'; $("#students").html(students_data); } var stuids = document.getElementById('student_ids_data').value; // alert(stuids); $.post("dairy_data.php", { classid: class_id, sec_id: sec_id, dairy_date: date_val, dairy_type: 2, stuids: stuids }, function(data) { document.getElementById("dairy_data").innerHTML = data; $('#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: 'General comments <br>Academic Year:<?php echo $_SESSION[child][choosen_year_name] ?> ClassName:' + classname + ' Sectionname:' + secname + '<br>', exportOptions: { columns: [0, 1, 2] } }, { extend: 'pdfHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', message: 'General comments \nAcademic Year:<?php echo $_SESSION[child][choosen_year_name] ?>\tClassName:' + classname + '\tSectionname:' + secname + '\n', exportOptions: { columns: [0, 1, 2] } }, { extend: 'excelHtml5', exportOptions: { columns: [0, 1, 2] } } ] }); }); } function check_single(val, name) { var classname = $('#classes').find('option:selected').text(); var secname = $('#sections').find('option:selected').text(); document.getElementById('student_status').value = "singles"; var student_status = $('#student_status').val(); var student_status_check = $('#student_status_check').val(); var acadamic_id = <?php echo $choosen_acc_id ?>; var stu_ids = '<?php echo $student_ids ?>'; var class_id = $("#classes").val(); var sec_id = $("#sections").val(); var date_val = $("#date_dairy").val(); var school_id = $("#school_id").val(); //var gene_names ='<?php echo $gene_names ?>'; var gene_names = $("#gene_names").val(); var dairy_class_ids = '<?php echo $dairy_class_ids ?>'; var students_data = ''; var ids = document.getElementById('student_ids_data').value; var temp = document.getElementById('student_all_ids').value; var ids_gen = document.getElementById('student_ids_data1').value; var names = document.getElementById('student_allnames_data').value; var select_names = document.getElementById('student_names_data').value; if (student_status_check == "1") { document.getElementById('student_status_check').value = ""; } if (document.getElementById("student_id" + val).checked == false) { var temp_value = ''; if (student_status == "all") { var temp_value = "1"; } //document.getElementById('student_ids_data').value = ''; //document.getElementById('student_ids_data').value = temp; if (student_status != "" && temp_value != '1') { names = names.replace(name, ""); names = names.replace(",,", ","); if (ids == "all") { ids = temp; } else { ids = ids; } //ids = ids .replace(val,""); //ids = ids; } else if (temp_value == '1') { temp = temp.replace(/^,/g, ''); temp = temp.replace(/,$/g, ''); ids = temp; // alert(ids); } else { ids = ids_gen; gene_names = gene_names.replace(name, ""); names = gene_names.replace(",,", ","); } ids = ids.replace(val, ""); ids = ids.replace(",,", ","); // names = names .replace(name,""); // names = names .replace(",,",","); } else { var students_edit = document.getElementById('students_edit').value; if (student_status == "all" || student_status == "" || students_edit == 0) { names = gene_names; ids = ids_gen; students_edit = document.getElementById('students_edit').value = '1'; } else if (student_status_check == '1') { names = ''; ids = ''; } else if (students_edit == 1) { names = names; ids = ids; } else { //alert(names); names = names.replace(name, ""); names = names; ids = ids; } ids = ids.replace(/^,/g, ''); ids = ids.replace(/,$/g, ''); ids = ids.replace('all', ''); ids += "," + val; names += "," + name; } temp = temp.replace(/^,/g, ''); temp = temp.replace(/,$/g, ''); $(".checkboxall").prop("checked", false); document.getElementById('student_ids_data').value = ids; if (names.indexOf(',') == 0) { names = names.substring(1); } // names=names.substring(1); names = names.replace(/^,/g, ''); names = names.replace(/,$/g, ''); ids = ids.replace(/^,/g, ''); ids = ids.replace(/,$/g, ''); ids = ids.replace(",,", ","); select_names = select_names.replace(/^,/g, ''); select_names = select_names.replace(/,$/g, ''); document.getElementById('student_allnames_data').value = names; if (ids.length == temp.length) { ids = "all"; } if (ids == ",") { ids = ''; } $.post("dairy_data.php", { classid: class_id, sec_id: sec_id, dairy_date: date_val, dairy_type: 2, stuids: ids }, function(data) { if (dairy_class_ids != '') { if (names == '') { students_data = '<option selected="selected" > Select Students </option>'; $("#students").html(students_data); } if (select_names.length == names.length) { students_data = '<option selected="selected" > All </option>'; $("#students").html(students_data); // $(".checkboxall").prop("checked", true); } } else { if (temp.length == ids.length || ids == "all") { students_data = '<option selected="selected" > All </option>'; $("#students").html(students_data); $(".checkboxall").prop("checked", true); } } document.getElementById("dairy_data").innerHTML = data; $('#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: 'General comments <br>Academic Year:' + classname + ' ClassName:<?php echo $_SESSION[child][classname] ?> Sectionname:' + secname + '<br>', exportOptions: { columns: [0, 1, 2] } }, { extend: 'pdfHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', message: 'General comments \nAcademic Year:' + classname + '\t ClassName:<?php echo $_SESSION[child][general_classname] ?>\tSectionname:' + secname + '\n', exportOptions: { columns: [0, 1, 2] } }, { extend: 'excelHtml5', exportOptions: { columns: [0, 1, 2] } } ] }); }); } </script> <body> <div class="row" style="margin-top: 30px;"> <div class="d-sm-flex justify-content-between"> <div class=" text-md-start" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:24px; margin-left:20px;"> <img src="images/general-comments_black.png" title="General Comments" style="font-size: 24px;" /> General Comments </div> <div class=" text-center"> <button type="button" onClick="location.href='update_general_comments.php'" class="btn btn-outline-secondary" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;"> Add/Update General Comments </button> </div> </div> </div> <br> <div class="menuu"> <ul id="nav" class="margin_auto"> <li class="" style="width:214px; text-align:center;margin-left:-3px;font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="diary_management.php"><img src="images/hom-work_white.png" title="Home Work" style="margin-right:5px;" />Home Work</a></li> <li class="<?= $menuclass ?>" style=" width:215px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="#"> <a href="general_comments.php"> <img src="images/general-comments_white.png" onClick="location.href='update_general_comments.php'" title="General Comments" style="margin-right:5px;" />General Comments</a></li> </ul> </div> <form class="form-horizontal" style="margin-top:30px;"> <div class="box-body" style="background-color:#fff; padding: 10px; font-family:Arial, Helvetica, sans-serif; font-size:13px; "> <div style="padding-left: 3.5rem;"> <div class=""> <div class="form-group row col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-4 col-md-offset-1 text-md-end"><b style="color:#666666; ">Class</b><span style="color:#FF0000; margin:2px;">*</span> </div> <div class="col-md-7"> <select class="form-select" id="classes" name="classes" style="height:29px; width:295px!important;font-size:12px;" tabindex="2"> <option selected="selected" value=''>Select Class</option> <?php foreach ($details as $key => $row) { if ($row['class_id'] == $_SESSION['child']['dairy_class_id']) { $selected = "selected=selected"; } else { $selected = ""; } echo "<option value='{$row['class_id']}'{$selected}>{$row['class_name']}</option>"; } ?> </select> <!-- if there is an error--> <div class="col-md-7" id="err_class" style="color:#990000;display:none;">Please choose class</div> <!--- end error--> </div> </div> </div> <div class=""> <div class="form-group row col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-4 col-md-offset-1 text-md-end"><b style="color:#666666; ">Section</b><span style="color:#FF0000; margin:2px;">*</span> </div> <div class="col-md-7"> <select class="form-select" id="sections" name="sections" style="height:29px; width:295px!important;font-size:12px;" tabindex="2"> <option selected="selected" value=' '>Select Section</option> <?php foreach ($section_byclass as $key => $row) { if ($row['section_id'] == $_SESSION['child']['dairy_section_id']) { $selected = "selected=selected"; } else { $selected = ""; } echo "<option value='{$row['section_id']}'{$selected}>{$row['section_name']}</option>"; } ?> </select> <!-- if there is an error--> <div class="col-md-7" id="err_section" style="color:#990000;display:none;">Please Enter Section</div> <!--- end error--> </div> </div> </div> <div class=""> <div class="form-group row col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-4 col-md-offset-1 text-md-end"><b style="color:#666666; ">Student</b><span style="color:#FF0000; margin:2px;"></span> </div> <div class="col-md-7"> <div class="multiselect"> <div class="selectBox" onclick="showCheckboxes()"> <select class="form-select" id="students" name="students" style="height:29px; width:295px!important;font-size:12px;" tabindex="2"> <option selected="selected" value=''>Select Students</option> </select> <div class="overSelect"></div> </div> <div id="checkboxes"> </div> </div> <!-- if there is an error--> <div class="col-md-7" id="err_student" style="color:#990000;display:none;">Please Enter Student</div> <!--- end error--> </div> </div> </div> <div class="class"> <div class="form-group row col-md-6" style="margin-bottom:1.0%; clear:both;"> <div class="col-md-4 col-md-offset-1 text-md-end"><b style="color:#666666;">Date</b><span style="color:#FF0000; margin:2px; ">*</span> </div> <div class="col-md-7 "> <div class="input-group date" id="datetimepicker"> <input type="text" tabindex="5" class="form-control" id="date_dairy" name="date_dairy" value="<?= $filldate ?>"> <span class="input-group-append"> <span class="input-group-text bg-light d-block" > <i class="fa fa-calendar-days"></i> </span> </span> </div> <!-- <div id="datetimepicker" class="input-append date d-flex"> <input type="text" class="form-control" id="date_dairy" name="date_dairy" style="height:30px; width:268px;font-size:13px;" tabindex="5" value="<?= $filldate ?>"> </input> <span class="add-on" style="height:30px;font-size:20px"> <i class="fa-solid fa-calendar"></i> </span> </div> --> </div> </div> <?php if ($student_ids) { $stu_ids = $student_ids; } else { $stu_ids = "all"; } ?> <input type="hidden" name="school_id" id="school_id" value="<?= $sch_id ?>"> <input type="hidden" name="student_all_ids" id="student_all_ids" value=""> <input type="hidden" name="student_ids_data" id="student_ids_data" value="<?= $stu_ids ?>"> <input type="hidden" name="student_ids_data1" id="student_ids_data1" value="<?= $student_ids ?>"> <input type="hidden" name="student_allnames_data" id="student_allnames_data" value=""> <input type="hidden" name="student_names_data" id="student_names_data" value=""> <input type="hidden" name="student_status_check" id="student_status_check" value=""> <input type="hidden" name="student_status" id="student_status" value=""> <input type="hidden" name="action" id="action" value=""> <input type="hidden" name="gene_names" id="gene_names" value="<?= $gene_names ?>"> <input type="hidden" name="students_edit" id="students_edit" value="0"> </div> </div> </form> <div class="row" style="margin-left:10px;margin-right:10px;"> <div id="dairy_data" class="col-md-12 centered" style="font-family: Arial, Helvetica, sans-serif;margin-top:30px;"> </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 type="text/javascript" language="javascript" class="init"> $(window).click(function(e) { var student = $('#students').val(); var student_status = $('#student_status').val(); var student_names = $('#student_allnames_data').val(); var student_names_data = $('#student_names_data').val(); var student_all_ids = $('#student_all_ids').val(); var ids = document.getElementById('student_ids_data').value; if (student_status != '' && student_status != 'all') { student_names = student_names.replace(",,", ","); student_names = student_names.replace(/^,/g, ''); student_names = student_names.replace(/,$/g, ''); ids = ids.replace(/^,/g, ''); ids = ids.replace(/,$/g, ''); student_all_ids = student_all_ids.replace(/^,/g, ''); student_all_ids = student_all_ids.replace(/,$/g, ''); if (student_names_data.length == student_names.length && student_names != '') { students_data = '<option selected="selected" > All </option>'; $("#students").html(students_data); $(".checkboxall").prop("checked", true); // document.getElementById('student_ids_data').value = "all"; } else if (student_names == '') { students_data = '<option selected="selected" > Select Students </option>'; $("#students").html(students_data); } else { students_data = '<option selected="selected" > ' + student_names + ' </option>'; $("#students").html(students_data); } } }); $(document).ready(function() { var classname = $('#classes').find('option:selected').text(); var secname = $('#sections').find('option:selected').text(); var acadamic_id = <?php echo $choosen_acc_id ?>; var genc_type = '<?php echo $gene_type ?>'; // var gene_names ='<?php echo $gene_names ?>'; var gene_names = $("#gene_names").val(); var stu_ids = '<?php echo $student_ids ?>'; //alert(genc_type); var sess_stuids = $("#student_ids_data1").val(); var class_id = $("#classes").val(); var sec_id = $("#sections").val(); var date_val = $("#date_dairy").val(); var school_id = $("#school_id").val(); var stuids = document.getElementById('student_ids_data').value; var check = ''; $.ajax({ url: "ajaxcalls.php", type: "POST", data: "mode=" + "choose_subject_dairy" + "&school_id=" + school_id + "&class_id=" + class_id + "&sec_id=" + sec_id + "&acadamic_id=" + acadamic_id, success: function(result) { var arr = result.split('@'); var result2 = eval("(" + arr[0] + ")"); var result_stu = eval("(" + arr[1] + ")"); var students_ids = ''; students_names = ''; if (result_stu == null) { students_data = '<option selected="selected" > Select Students </option>'; $("#students").html(students_data); document.getElementById('checkboxes').innerHTML = ''; } else { var check_all = 'checked=checked'; if (genc_type == "all") { var check_all = 'checked=checked'; } else { var check_all = ''; } var students_data = '<input type="checkbox" class="checkboxall" ' + check_all + ' name="selectall" id="selectall" onclick="check_all()" > All <br>'; for (var j = 0; j < result_stu.length; j++) { n = stuids.indexOf(result_stu[j].student_id); if (n != "-1" || genc_type == "all") { check = 'checked=checked'; var type = '0'; } else { check = ''; var type = '1'; } var fullname = result_stu[j].student_firstname + ' ' + result_stu[j].student_lastname; students_data += '<label for="one"><input type="checkbox" onclick="check_single(this.value,\'' + fullname + '\')" class="checkbox1" value="' + result_stu[j].student_id + '" ' + check + ' name="students_ids[]" id="student_id' + result_stu[j].student_id + '" style="margin-top:-2px;"/ >' + result_stu[j].student_firstname + ' ' + result_stu[j].student_lastname + '</label>'; students_ids += result_stu[j].student_id + ","; students_names += fullname + ","; } students_names = students_names.replace(/^,/g, ''); students_names = students_names.replace(/,$/g, ''); gene_names = gene_names.replace(/^,/g, ''); gene_names = gene_names.replace(/,$/g, ''); document.getElementById('checkboxes').innerHTML = students_data; //document.getElementById('student_ids_data').value = students_ids; document.getElementById('student_ids_data').value = students_ids; document.getElementById('student_all_ids').value = students_ids; document.getElementById('student_allnames_data').value = students_names; document.getElementById('student_names_data').value = students_names; if (type != '1') { document.getElementById('student_status').value = "all"; students_data = '<option selected="selected" > All </option>'; $("#students").html(students_data); } if (genc_type == "singles") { students_data = '<option selected="selected" >' + gene_names + '</option>'; $("#students").html(students_data); } if (stu_ids) { document.getElementById('student_ids_data').value = stu_ids; } else { document.getElementById('student_ids_data').value = students_ids; } if (stuids != '') { students_ids = stuids; } } $.post("dairy_data.php", { classid: class_id, sec_id: sec_id, dairy_date: date_val, dairy_type: 2, stuids: students_ids }, function(data) { document.getElementById("dairy_data").innerHTML = data; /* $('#myTable').DataTable({ columnDefs: [ { orderable: false, targets: [0] } ], "pageLength":100, stateSave: true, dom: 'T<"clear">lfrtip', "oLanguage": { "sSearch": "" }, tableTools: { "aButtons": [ { "sExtends": "xls", "mColumns": [0, 1, 2, 3, 4, 5,6,7,8] }, { "sExtends": "pdf", "sPdfOrientation": "landscape", "mColumns": [0, 1, 2, 3, 4, 5,6,7,8] }, { "sExtends": "print", "mColumns": [0, 1, 2, 3, 4, 5,6,7,8] } ] } }); $('div.dataTables_filter input').attr('placeholder', 'Search');*/ $('#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: 'General comments <br>Academic Year:<?php echo $_SESSION[child][choosen_year_name] ?> ClassName:' + classname + ' Sectionname:' + secname + '<br>', exportOptions: { columns: [0, 1, 2] } }, { extend: 'pdfHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', message: 'General comments \nAcademic Year:<?php echo $_SESSION[child][choosen_year_name] ?>\tClassName:' + classname + '\tSectionname:' + secname + '\n', exportOptions: { columns: [0, 1, 2] } }, { extend: 'excelHtml5', exportOptions: { columns: [0, 1, 2] } } ] }); }); } }); $("#classes").change(function() { $('#err_class').hide(); $('#err_section').hide(); if ($(this).val() == 0) { $('#err_class').show(); var section_option = '<option value="0">Select Section</option>'; $("#sections").html(section_option); return false; } else { var x = $(this).val(); var acadamic_id = <?php echo $choosen_acc_id ?>; $.ajax({ url: "ajaxcalls.php", type: "POST", data: "mode=" + "choose_class_dairy" + "&data=" + x + "&acadamic_id=" + acadamic_id, success: function(result) { //alert(result); var result2 = eval("(" + result + ")"); var section_option = '<option value="0">Select Section</option>'; for (var i = 0; i < result2.length; i++) { section_option += '<option value="' + result2[i].section_id + '">' + result2[i].section_name + '</option>'; } $("#sections").html(section_option); }, error: function(e) { } }); } }); }); $("#sections").change(function() { var classname = $('#classes').find('option:selected').text(); var secname = $('#sections').find('option:selected').text(); var acadamic_id = <?php echo $choosen_acc_id ?>; if ($("#classes").val() == 0) { //alert("Choose Class"); $('#err_class').show(); return false; } else { if ($("#sections").val() == 0) { //alert("Choose Sections"); $('#err_section').show(); return false; } else { var class_id = $("#classes").val(); var sec_id = $("#sections").val(); var date_val = $("#date_dairy").val(); var school_id = $("#school_id").val(); document.getElementById('action').value = "1"; $.ajax({ url: "ajaxcalls.php", type: "POST", data: "mode=" + "choose_subject_dairy" + "&school_id=" + school_id + "&class_id=" + class_id + "&sec_id=" + sec_id + "&acadamic_id=" + acadamic_id, success: function(result) { var arr = result.split('@'); var result2 = eval("(" + arr[0] + ")"); var result_stu = eval("(" + arr[1] + ")"); var students_ids = ''; var students_names = ''; if (result_stu == null) { students_data = '<option selected="selected" > Select Students </option>'; $("#students").html(students_data); document.getElementById('checkboxes').innerHTML = ''; } else { var students_data = '<input type="checkbox" class="checkboxall" name="selectall" id="selectall" onclick="check_all()" checked="checked"> All <br>'; for (var j = 0; j < result_stu.length; j++) { var fullname = result_stu[j].student_firstname + ' ' + result_stu[j].student_lastname; students_data += '<label for="one"><input type="checkbox" onclick="check_single(this.value,\'' + fullname + '\')" class="checkbox1" checked="checked" value="' + result_stu[j].student_id + '" name="students_ids[]" id="student_id' + result_stu[j].student_id + '" style="margin-top:-2px;"/ >' + result_stu[j].student_firstname + ' ' + result_stu[j].student_lastname + '</label>'; students_ids += "," + result_stu[j].student_id; students_names += "," + fullname; } students_names = students_names.replace(/^,/g, ''); students_names = students_names.replace(/,$/g, ''); document.getElementById('checkboxes').innerHTML = students_data; document.getElementById('student_ids_data').value = students_ids; document.getElementById('student_all_ids').value = students_ids; document.getElementById('student_allnames_data').value = students_names; } } }); document.getElementById('student_status').value = "all"; students_data = '<option selected="selected" > All </option>'; $("#students").html(students_data); var stuids = document.getElementById('student_ids_data').value; $.post("dairy_data.php", { classid: class_id, sec_id: sec_id, dairy_date: date_val, dairy_type: 2, stuids: stuids }, function(data) { document.getElementById("dairy_data").innerHTML = data; $('#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: 'General comments <br>Academic Year:<?php echo $_SESSION[child][choosen_year_name] ?> ClassName:' + classname + ' Sectionname:' + secname + '<br>', exportOptions: { columns: [0, 1, 2] } }, { extend: 'pdfHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', message: 'General comments <br>Academic Year:<?php echo $_SESSION[child][choosen_year_name] ?>\tClassName:' + classname + '\tSectionname:' + secname + '\n', exportOptions: { columns: [0, 1, 2] } }, { extend: 'excelHtml5', exportOptions: { columns: [0, 1, 2] } } ] }); }); } } }); </script> <!--<script type="text/javascript" src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js"> </script> <script type="text/javascript" src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.pt-BR.js"> </script>--> <script type="text/javascript" src="js/bootstrap-datetimepicker.js" charset="UTF-8"></script> <script type="text/javascript" src="js/bootstrap-datetimepicker.fr.js" charset="UTF-8"></script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-datepicker@1.9.0/dist/css/bootstrap-datepicker.min.css"> <!-- JavaScript --> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script> <script type="text/javascript"> $('#datetimepicker').datepicker({ format: 'dd/mm/yyyy', minView: 2, pickTime: false, autoclose: true, todayBtn: true, todayHighlight: true, pickTime: false }).on('changeDate', function() { var classname = $('#classes').find('option:selected').text(); var secname = $('#sections').find('option:selected').text(); $(this).datepicker('hide'); var class_id = $("#classes").val(); var sec_id = $("#sections").val(); var date_val = $("#date_dairy").val(); var stuids = document.getElementById('student_ids_data').value; var stuids_all = document.getElementById('student_all_ids').value; stuids_all = stuids_all.replace(/^,/g, ''); stuids_all = stuids_all.replace(/,$/g, ''); stuids = stuids.replace(/^,/g, ''); stuids = stuids.replace(/,$/g, ''); if (stuids_all.length == stuids.length) { stuids_val = "all"; } else { stuids_val = stuids; } //alert(stuids); $.post("dairy_data.php", { classid: class_id, sec_id: sec_id, dairy_date: date_val, dairy_type: 2, stuids: stuids_val }, function(data) { document.getElementById("dairy_data").innerHTML = data; /* $('#myTable').DataTable({ columnDefs: [ { orderable: false, targets: [0] } ], "pageLength":100, stateSave: true, dom: 'T<"clear">lfrtip', "oLanguage": { "sSearch": "" }, tableTools: { "aButtons": [ { "sExtends": "xls", "mColumns": [0, 1, 2] }, { "sExtends": "pdf", "sPdfOrientation": "landscape", "mColumns": [0, 1, 2] }, { "sExtends": "print", "mColumns": [0, 1, 2] } ] } }); $('div.dataTables_filter input').attr('placeholder', 'Search');*/ $('#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: 'General comments <br>Academic Year:<?php echo $_SESSION[child][choosen_year_name] ?> ClassName:' + classname + ' Sectionname:' + secname + '<br>', exportOptions: { columns: [0, 1, 2] } }, { extend: 'pdfHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', message: 'General comments <br>Academic Year:<?php echo $_SESSION[child][choosen_year_name] ?>\tClassName:' + classname + '\tSectionname:' + secname + '\n', exportOptions: { columns: [0, 1, 2] } }, { extend: 'excelHtml5', exportOptions: { columns: [0, 1, 2] } } ] }); }); }); </script> <script type="text/javascript"> $('#datetimepicker1').datetimepicker({ format: 'dd/MM/yyyy', pickTime: false }).on('changeDate', function() { $(this).datetimepicker('hide'); }); </script> <script> </script> </body> </html>