JezK
Edit File: marksof_student.php
<?php session_start(); include("menuheader.php"); if (!(in_array(4, $access) && in_array(4, $allow))) echo "<script>location.replace('dashboard.php');</script>"; include_once("school_admin_access_app.php"); $fun = new adminaccess(); $school_id = $_SESSION['child']['log_school_id']; //school_id $academic_id = $_SESSION['child']['choosen_academic_id']; // academic_year_id $user_id = $_SESSION['child']['auth_id']; //user_id $details = $fun->get_classes($school_id, $academic_id); $exam_names = $fun->exam_name_details($school_id, $academic_id); $sections = $fun->get_sections($_GET['classid'], $academic_id); $students = $fun->get_students2($_GET['classid'], $_GET['sec_id'], $school_id, $academic_id); if (isset($_GET['classid']) && isset($_GET['sec_id']) && isset($_GET['exname_id']) && isset($_GET['student_id'])) { $addmarks = $fun->add_students_marks($_GET['classid'], $_GET['sec_id'], $school_id, $academic_id, $_GET['exname_id'], $_GET['student_id']); $grad = $fun->getStudent_Grade($_GET['exname_id'], $_GET['student_id'], $academic_id); } if ($sections) { foreach ($sections as $row) { if ($_GET['sec_id'] == $row['section_id']) { $secs .= "<option value='{$row['section_id']}' selected>{$row['section_name']}</option>"; } else { $secs .= "<option value='{$row['section_id']}' >{$row['section_name']}</option>"; } } } if ($details) { foreach ($details as $row) { if ($_GET['classid'] == $row['class_id']) { $classes_list .= "<option value='{$row['class_id']}' selected>{$row['class_name']}</option>"; } else { $classes_list .= "<option value='{$row['class_id']}' >{$row['class_name']}</option>"; } } } if ($exam_names) { // print_r($exam_names);exit; foreach ($exam_names as $row) { if ($_GET['exname_id'] == $row['exam_id']) { $exmnamesss .= "<option value='{$row['exam_id']}' selected>{$row['exam_name']}</option>"; } else { $exmnamesss .= "<option value='{$row['exam_id']}' >{$row['exam_name']}</option>"; } } } if ($students) { foreach ($students as $row) { if ($_GET['student_id'] == $row['student_id']) { $students_list .= "<option value='{$row['student_id']}' selected>{$row['student_name']}</option>"; } else { $students_list .= "<option value='{$row['student_id']}' >{$row['student_name']}</option>"; } } } ?> <style> #nav { margin: auto; width: 751px !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-color: #0b287b; } .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; } select { width: 62px !important; background-color: #FFF; border: 1px solid #CCC; } </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;"><img src="images/exams-black.png" title=" Examinations" style="font-size: 24px;" /> Examinations </div> </div> <br> <div class="menuu d-flex"> <ul id="nav" class="margn_auto"> <li style="border-right:1px solid #FFFFFF;width:150px; text-align:center;margin-left:-3px;font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="examination_management.php"><img src="images/exam-nemes_white.png" title="Exam Names" style="margin-right:5px;" />Exam Names</a></li> <li style="border-right:1px solid #FFFFFF;width:150px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="exam_schedule.php"><img src="images/exam-schedule_white.png" title="Exam Schedule" style="margin-right:5px;" />Exam Schedule</a></li> <li class="selected" style="border-right:1px solid #FFFFFF; width:150px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="marksof_student.php"><img src="images/add-marks_white.png" title="Add Marks" style="margin-right:5px;" />Add Marks</a></li> <li style="border-right:1px solid #FFFFFF; width:150px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="addgrades_tostudent.php"><img src="images/set-grades_white.png" title="Set Grades/Ranks" style="margin-right:5px;" />Set Grades/Ranks</a></li> <li style="width:150px; text-align:center; margin-left:-3px; font-family:Arial, Helvetica, sans-serif;font-style:normal; font-size:14px;"><a href="Report_card.php"><img src="images/report-card_white.png" title="Report Card" style="margin-right:5px;" />Report Card</a></li> </ul> </div> <div class="row" style="margin-top: 20px;"> <div class="col-md-7 text-left" style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:20px; margin-left:20px;"> <img src="images/add-marks_Black.png" title=" Student Marks" style="font-size: 24px;" /> Student Marks </div> <div class="col-md-4 text-center d-flex"> <button type="button" onClick="location.href='marks_upload.php'" class="btn btn-outline-secondary" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;" data-bs-toggle="modal" data-bs-target="#pwd Modal"> Upload Marks </button> <button type="button" onClick="getrequiredfields()" class="btn btn-outline-secondary" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;" data-bs-toggle="modal" data-bs-target="#pwdModal"> Download Marks Template </button> </div> <form class="form-horizontal" style="margin-top:20px;"> <div class="box-body" style="background-color:#fff; padding: 10px; font-family:Arial, Helvetica, sans-serif; font-size:13px;"> <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; ">Exam Name</b><span style="color:#FF0000; margin:2px;">*</span> </div> <div class="col-md-7"> <select class="form-select" id="examnames" style="height:29px; width:295px!important;font-size:12px;" tabindex="2"> <option value='0' selected>Select Exam Name</option> <?php echo $exmnamesss; ?> </select> <!-- if there is an error--> <div class="col-md-10" id="err_examnames" style="color:#990000;"></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; ">Class</b><span style="color:#FF0000; margin:2px;">*</span> </div> <div class="col-md-7"> <select class="form-select" id="classes" style="height:29px; width:295px!important;font-size:12px;" tabindex="2"> <option value='0' selected>Select Class</option> <?php echo $classes_list; ?> </select> <!-- if there is an error--> <div class="col-md-10" id="err_classes" style="color:#990000;"></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" style="height:29px; width:295px!important;font-size:12px;" tabindex="2"> <option value='0' selected>Select Section</option> <?php echo $secs; ?> </select> <!-- if there is an error--> <div class="col-md-10" id="err_sections" style="color:#990000;"></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"> <select class="form-select" id="student" style="height:29px; width:295px!important;font-size:12px;" tabindex="2"> <option value='0' selected>Select Student</option> <?php echo $students_list; ?> </select> <!-- if there is an error--> <div class="col-md-10" id="err_student" style="color:#990000;"></div> <!--- end error--> </div> </div> </div> <!--<div class="clear"> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-4 col-md-offset-1 text-right"> <b style="color:#666666; ">Grade/Rank</b><span style="color:#FF0000; margin:2px;"></span> </div> <div class="col-md-7"> <input type="text" class="form-control" style="height:29px; width:295px!important;font-size:12px;" tabindex="2" readonly value="<?= $grad ?>"> <!-- if there is an error--> <div class="col-md-10" id="err_sections" style="color:#990000;"></div> <!--- end error-- </div> </div> </div>--> </div> </form> <div class="row"> <div class="d-md-flex ps-5 justify-content-end align-items-center"> <button type="button" onClick="location.href='updatestudent_marksinfo.php'" class="btn btn-outline-secondary" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;"> Update Marks Subject Wise </button> <button type="button" onClick="location.href='updatemarks_by_student.php'" class="btn btn-outline-secondary" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;"> Update Marks Student Wise </button> </div> <!-- <div class="col-md-9 text-right"> <button type="button" onClick="location.href='updatestudent_marksinfo.php'" class="btn btn-outline-secondary" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;"> Update Marks Subject Wise </button> </div> <div class="col-md-3 margin_left"> <button type="button" onClick="location.href='updatemarks_by_student.php'" class="btn btn-default" style="margin-right:20px;font-family: Arial, Helvetica, sans-serif; font-size:14px;padding:4px 10px;"> Update Marks Student Wise </button> </div> --> </div> <div class="row mt-3 ms-3"> <div class="col-md-3"><b>Student Name: </b><?= $addmarks[0][student_name] ?></div> <div class="col-md-3"><b>Roll Number: </b><?= $addmarks[0][student_rollno] ?></div> <div class="col-md-3"><b>Grade: </b><?= $grad ?></div> </div> <div class="row ps-5" style=""> <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">Sl.No</th> <th>Subject</th> <th>Total Marks</th> <th>Secured Marks</th> <th>Pass/Fail</th> <th>Actions</th> </tr> </thead> <tbody> <?php $class_ids = $_GET['classid']; $section_ids = $_GET['sec_id']; $exname_ids = $_GET['exname_id']; $student_id = $_GET['student_id']; if ($addmarks) { $i = 0; foreach ($addmarks as $row) { //$url = "edit_studentmarks.php?classid=".$class_ids."&sec_id=".$section_ids."&subject_id=".$row['subject_id']."&exname_id=".$exname_ids."&student_id=".$student_id; $url = "edit_studentmarks.php?marks_id=" . $row['student_marks_id'] . "&classid=" . $class_ids . "&sec_id=" . $section_ids . "&exname_id=" . $_GET['exname_id'] . "&student_id=" . $_GET['student_id']; $i++; ?> <tr> <td class="col-sm-1 text-center" style=" font-size:14px;"><?= $i ?></td> <td style=" font-size:14px;"><?= $row['subject_name'] ?></td> <td style=" font-size:14px;"><?= $row['total_marks'] ?></td> <td style=" font-size:14px;"><?= $row['marks_secured'] ?></td> <td style=" font-size:14px;"><?= $row['status'] ?></td> <td class="center"> <? if ($row['student_marks_id'] != 0) { ?> <a class=" buttonn" href="<?= $url; ?>" style="margin:4px;"> <i class=" fa-solid fa-pencil" title="Edit" style="font-size: 14px; color:#01aee6;"></i> </a> <a class=" buttonn" onclick="confirmDelete('<?php echo $row['timetable_id']; ?>','<?= $_GET['classid'] ?>','<?= $_GET['exname_id'] ?>','<?= $_GET['sec_id'] ?>','<?= $_GET['student_id'] ?>')" href="javascript:void(0)" style="margin:4px;"> <i class=" fa-solid fa-xmark" title="Delete" style="font-size: 14px; color:#01aee6;"></i> </a> <? } ?> </td> </tr> <?php } } ?> </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 type="text/javascript"> $(document).ready(function() { /* $('#myTable').DataTable({ "pageLength":100, stateSave: true, dom: 'T<"clear">lfrtip', "oLanguage": { "sSearch": "" }, tableTools: { "aButtons": [ { "sExtends": "xls", "mColumns": [0, 1, 2, 3, 4] }, { "sExtends": "pdf", "sPdfOrientation": "landscape", "mColumns": [0, 1, 2, 3, 4] }, { "sExtends": "print", "mColumns": [0, 1, 2, 3, 4] } ] } }); $('div.dataTables_filter input').attr('placeholder', 'Search'); */ var classname = $('#classes').find('option:selected').text(); var secname = $('#sections').find('option:selected').text(); var ndt = $('#examnames').find('option:selected').text(); var stdn = $('#student').find('option:selected').text(); $('#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: 'Exam Schedule<br>Academic Year:<?php echo $_SESSION[child][choosen_year_name] ?>   Class:' + classname + '   Section:' + secname + '   Exam Name:' + ndt + '    Student Name:' + stdn + '<br>', exportOptions: { columns: [0, 1, 2, 3, 4] } }, { extend: 'pdfHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', message: 'Exam Schedule\nAcademic Year:<?php echo $_SESSION[child][choosen_year_name] ?>\t Class:' + classname + '\tSection:' + secname + '\t Exam Name:' + ndt + '\t Student Name:' + stdn + '\n', exportOptions: { columns: [0, 1, 2, 3, 4] } }, { extend: 'excelHtml5', title: '<?php echo $_SESSION['child']['school_name'] ?>', exportOptions: { columns: [0, 1, 2, 3, 4] } } ] }); $("#classes").change(function() { $("#err_classes").text(""); if ($("#classes").val() == 0) { var section_option = '<option value="0">Select Section</option>'; $("#sections").html(section_option); $("#err_classes").text("Please select Class"); $("#err_classes").show(); return false; } else { var x = $(this).val(); $.ajax({ url: "ajaxcalls_app.php", type: "POST", data: "mode=" + "choose_class" + "&data=" + x, success: function(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() { $("#err_sections").text(""); if ($("#sections").val() == 0) { $("#err_sections").text("Please select Section"); $("#err_sections").show(); return false; } else { var cls = $("#classes").val(); var sec_id = $("#sections").val(); $.ajax({ url: "ajaxcalls_app.php", type: "POST", data: "mode=" + "students" + "&class_id=" + cls + "§ion_id=" + sec_id, success: function(result) { var result2 = eval("(" + result + ")"); var section_option = '<option value="0" selected="selected">Select Student</option>'; for (var i = 0; i < result2.length; i++) { section_option += '<option value="' + result2[i].student_id + '">' + result2[i].student_name + '</option>'; } $("#student").html(section_option); }, error: function(e) { } }); } }); $("#student").change(function() { $("#err_student").text(""); if ($("#student").val() == 0) { $("#err_student").text("Please select Student"); $("#err_student").show(); return false; } else if ($("#examnames").val() != 0 && $("#classes").val() != 0 && $("#sections").val() != 0 && $("#student").val() != 0) { var stdid = $("#student").val(); var cls = $("#classes").val(); var sec_id = $("#sections").val(); var ename = $("#examnames").val(); window.location.href = "marksof_student.php?classid=" + cls + "&exname_id=" + ename + "&sec_id=" + sec_id + "&student_id=" + stdid; } }); $("#examnames").change(function() { $("#err_examnames").text(""); if ($("#examnames").val() == 0) { $("#err_examnames").text("Please select Exam"); $("#err_examnames").show(); return false; } else if ($("#student").val() != 0 && $("#classes").val() != 0 && $("#sections").val() != 0 && $("#examnames").val() != 0) { var stdid = $("#student").val(); var cls = $("#classes").val(); var sec_id = $("#sections").val(); var ename = $("#examnames").val(); window.location.href = "marksof_student.php?classid=" + cls + "&exname_id=" + ename + "&sec_id=" + sec_id + "&student_id=" + stdid; } }); }); </script> <script> $(document).ready(function() { $('#myTable').dataTable(); }); function confirmDelete(markid, class_id, exam_id, sec_id, student_id) { var res = confirm("Do you want to delete this Marks ?"); if (res) { $.ajax({ url: "ajaxcalls_app.php", type: "POST", data: "mode=" + "delete_marks" + "&mark_id=" + markid, success: function(result) { //alert(result); if (result == 1) { //alert("Exam Name deleted successfully "); location.replace('marksof_student.php?classid=' + class_id + '&exname_id=' + exam_id + '&sec_id=' + sec_id + '&student_id=' + student_id); } }, error: function(e) { alert(e); } }); } } function getrequiredfields() { clsname = document.getElementById('classes').value; secname = document.getElementById('sections').value; examname = document.getElementById('examnames').value; $("#err_examnames").text(""); $("#err_classes").text(""); $("#err_sections").text(""); if (examname == '0') { $("#err_examnames").text("Please select Exam"); $("#err_examnames").show(); return false; } else if (clsname == '0') { $("#err_classes").text("Please select Class"); $("#err_classes").show(); return false; } else if (secname == '0') { $("#err_sections").text("Please select Section"); $("#err_sections").show(); return false; } else { window.location.href = "student_markstemplate.php?classname=" + clsname + '§ionname=' + secname + '&examname=' + examname; } } </script> </body> </html>