EVOLUTION-NINJA
Edit File: user_reports.php
<?php echo view('includes/user_header'); ?> <link rel="stylesheet" href="<?php echo base_url('public/assets/datatables/jquery.dataTables.css'); ?>"> <div id="page-wrapper"> <div class="row"> <div class="col-lg-12"> <div class="page-header my_page_header"> <p></p> <!-- <p class="my_budge"> <i class="fa fa-home" aria-hidden="true"></i> > <i class="fa fa-book" aria-hidden="true"></i> > Dashboard</p> --> </div> </div> <!-- /.col-lg-12 --> </div> <a href="javascript:history.back()" class="btn btn-primary" style="float: right;">Back</a> <br> <br> <input type="hidden" class="mapping_id" value="<?= current_url(true)->getSegment(3) ?>" /> <section class="welcome_middle_one"> <div class="instructor_table"> <table class="table table-bordered" id="myTable"> <thead class="thead-dark" style="background: #468662 ;"> <tr> <th scope="col" class="text-center"> <font color="white"> Number of Test</font> </th> <th scope="col" class="text-center"> <font color="white"> View Reports</font> </th> </tr> </thead> <tbody id="view_reports"> </tbody> </table> </div><!-- row----> </section> </div> <script src="<?php echo base_url('public/assets/datatables/jquery.dataTables.js'); ?>"></script> <script> $(document).ready(function() { $('.chapyter_id_header').click(function() { var chapter_id = $(this).attr('id'); var mapping_id = $('.mapping_id').val(); $.ajax({ url: "<?php echo site_url('view_reports_chapter') ?>", type: "POST", data: { 'chapter_id': chapter_id }, async: false, success: function(response) { // response=jQuery.parseJSON(response); console.log(response); var content = ''; if (response.result == 1) { var i = 1; $.each(response.message, function(idx, vx) { content += '<tr>'; content += '<td align="center"> Practice Test ' + i + '</td>'; content += '<td align="center" class="view_report"><a href="<?php echo site_url('view_result_report'); ?>/' + mapping_id + '/' + vx.chapter_id + '/' + vx.test_id + '">View Reports</a></td>'; content += '</tr>'; i++; }); $('#myTable').DataTable().destroy(); $("#view_reports").html(content); $('#myTable').DataTable({ //"scrollX": true "order": [ [1, "asc"] ], bFilter: false, }); } else { $("#view_reports").empty(); toastr["error"](response.message); } } }); }); // $('.subject_id_header').click(function(){ // var subject_id = $(this).attr('id'); // var mapping_id = $('.mapping_id').val(); // $.ajax({ // url:"<?php //echo site_url('view_reports_subject') ?>", // type:"POST", // data:{'subject_id':subject_id}, // async:false, // success:function(response){ // response=jQuery.parseJSON(response); // console.log(response); // var content=''; // if(response.result==1) // { // var i=1; // $.each(response.message,function(idx,vx) // { // content+='<tr>'; // content+='<td align="center"> Mock Test '+i+'</td>'; // content+='<td align="center" class="view_report"><a href="<?php //echo site_url('view_result_report'); ?>/'+mapping_id+'/'+vx.subject_id+'/'+vx.test_id+'">View Reports</a></td>'; // content+='</tr>'; // i++; // }); // $('#myTable').DataTable().destroy(); // $("#view_reports").html(content); // $('#myTable').DataTable({ // //"scrollX": true // "order": [[ 1, "asc" ]] // }); // } // else // { // $("#view_reports").empty(); // toastr["error"](response.message); // } // } // }); // }); $('.subject_id_header').click(function() { //var subject_id = $(this).attr('id'); var mocktest_id = $(this).attr('id'); var mapping_id = $('.mapping_id').val(); $.ajax({ url: "<?php echo site_url('view_reports_subject') ?>", type: "POST", data: { 'mocktest_id': mocktest_id }, async: false, success: function(response) { // response=jQuery.parseJSON(response); console.log(response); var content = ''; if (response.result == 1) { var i = 1; $.each(response.message, function(idx, vx) { content += '<tr>'; content += '<td align="center"> Test ' + i + '</td>'; content += '<td align="center" class="view_report"><a href="<?php echo site_url('view_result_report'); ?>/' + mapping_id + '/' + vx.subject_id + '/' + vx.test_id + '">View Reports</a></td>'; content += '</tr>'; i++; }); $('#myTable').DataTable().destroy(); $("#view_reports").html(content); $('#myTable').DataTable({ //"scrollX": true "order": [ [1, "asc"] ], bFilter: false, }); } else { $("#view_reports").empty(); toastr["error"](response.message); } } }); }); $('#final_test').click(function() { $.ajax({ url: "<?php echo site_url('view-reports-final') ?>", type: "POST", success: function(response) { // response=jQuery.parseJSON(response); console.log(response); var content1 = ''; if (response.result == 1) { var i = 1; content1 += '<tr>'; content1 += '<td align="center"> Test ' + i + '</td>'; content1 += '<td align="center" class="view_report"><a href="<?php echo site_url('finaltest-result-report'); ?>/' + 195 + '/' + response.data.subject_id + '/' + response.data.test_id + '">View Reports</a></td>'; content1 += '</tr>'; $('#myTable').DataTable().destroy(); $("#view_reports").html(content1); } else { $("#view_reports").empty(); toastr["error"](response.message); } } }); }); }); </script> <script> $(".radio2").hide(); $("#chapterwise").click(function() { $(".radio2").show(); }); $("#subjectwise").click(function() { $(".radio2").hide(); $(".radio1").show(); }); function previous() { var mapping_id = $('.mapping_id').val(); window.location.href = "<?php echo site_url('added-course-details'); ?>/" + mapping_id; } </script> <script type="text/javascript"> function view_report(svt) { //alert(svt); var chapter_id = document.getElementById('chapter_id' + svt).value; var test_id = document.getElementById('test_id' + svt).value; $.ajax({ url: "<?php echo site_url('view_reports') ?>", type: "POST", data: { 'chapter_id': chapter_id, 'test_id': test_id }, async: false, success: function(response) { // response=jQuery.parseJSON(response); console.log(response); if (response.result == 1) { chapter_id = response.message.chapter_id; test_id = response.message.test_id; window.location.href = "<?php echo site_url('view_result_report'); ?>/" + chapter_id + "/" + test_id; } else { toastr["error"](response.message); } } }); } </script> <style> .chapterwise { margin-left: 10% !important; } .radio1 { text-align: center; } .radio2 { margin-left: 52.5%; } .next_btn { margin-top: 5%; } </style> <?php echo view('includes/user_footer'); ?>