EVOLUTION-NINJA
Edit File: user_course_details.php
<?php echo view('includes/user_header'); ?> <div id="page-wrapper" style="padding-top: 2%;padding-bottom: 2%;"> <input type="hidden" value="<?php echo $questions; ?>" class="questions" /> <input type="hidden" value="<?php echo $sub_domain_id; ?>" class="sub_domain_id" /> <input type="hidden" value="<?php echo $finals; ?>" class="check_final" /> <!-- /.row --> <div class="row user_head_tab_row"> <ul class="user_head_tab"> <li><a href="<?php echo site_url('/'); ?>"><i class="fa fa-home" aria-hidden="true"></i></a></li> <li> > </li> <li><a href=""><i class="fa fa-book" aria-hidden="true"></i></a></li> <li> / </li> <li><a href="#">Dashboard</a></li> </ul> </div> <div class="row my_header"> <div class="col-md-8"> <input type="hidden" value="<?php echo $mapping_id; ?>" class="mapping_id" /> <h3><i class="fa fa-signal" aria-hidden="true"></i> TESTS</h3> <div class=""> <table class="table"> <thead> <tr> <th style="width:40%;">Test Name</th> <th style="width:10%;">Score</th> <th style="width:40%;"></th> </tr> </thead> <tbody> <?php $i = 1; foreach ($mocktests as $mocktest) { ?> <tr> <td>Mock Test <?php echo $i; ?></td> <td><?php echo $mocktest['mocktest_score']; ?></td> <td> <button type="button" class="btn btn-primary chapter_id" id="<?php echo $mocktest['mocktest_id']; ?>"><i class="fa fa-hand-o-right" aria-hidden="true"></i> Start</button> <!-- <button type="button" class="btn btn-default chapter_review" id="" style="border: 2px solid #337ab7;"><i class="fa fa-file-text-o" aria-hidden="true"></i> Review</button> --> <button type="button" class="btn btn-primary mocktest_review" id="<?php echo $mocktest['mocktest_id']; ?>,<?php echo $i; ?>" value="<?php echo $i; ?>" style=""><i class="fa fa-file-text-o" aria-hidden="true"></i> Review</button> </td> </tr> <?php $i++; } ?> </tbody> </table> </div> <h3><i class="fa fa-signal" aria-hidden="true"></i> FINAL TEST</h3> <table class="table"> <thead> <tr> <th style="width:40%;">Test Name</th> <th style="width:10%;">Score</th> <th style="width:40%;"></th> </tr> </thead> <tbody> <tr> <td>Final Test</td> <td><?php echo $finals_score; ?></td> <?php if (isset($sub_domain) && is_array($sub_domain)) : ?> <?php foreach ($sub_domain as $sd) : ?> $val = $sd; <?php endforeach; ?> <?php endif; ?> <!-- <td><button type="button" class="btn btn-primary final_test" id="<?php //echo $val; ?>"><i class="fa fa-hand-o-right" aria-hidden="true"></i> Start</button></td> --> <td> <?php $val = 0; if (isset($sub_domain) && is_array($sub_domain) && count($sub_domain) > 0) { foreach ($sub_domain as $sd) { $val = $sd; } } ?> <!--<button type="button" class="btn btn-primary final_test" id="</?php echo $val; ?>">--> <!--<i class="fa fa-hand-o-right" aria-hidden="true"></i> Start--> <!--</button>--> </td> </tr> </tbody> </table> <h3><i class="fa fa-pencil-square-o" aria-hidden="true"></i> PRACTICE</h3> <div class="table-responsive"> <table class="table" style="border-radius: 5px;"> <thead> <tr> <th style="width:40%;">Chapter</th> <th style="width:10%;">Progress</th> <th style="width:40%;"></th> </tr> </thead> <tbody> <?php foreach ($chapter as $chapters) { ?> <tr> <td><?php echo $chapters['chapter_name']; ?></td> <td><?php echo $chapters['answers']; ?>/<?php echo $chapters['questions']; ?></td> <td> <?php if ($chapters['test_setting'] == 0) { ?> <h5 style="color: red;">Test Setting Not yet Done</h5> <?php } else if ($chapters['tot_questions'] != 0) { ?> <button type="button" class="btn btn-primary button" value="<?php echo $chapters['chapter_id']; ?>"><i class="fa fa-hand-o-right" aria-hidden="true"></i> Start Test</button> <?php } else { ?> <h5 style="color: red;">No Questions Available</h5> <?php } ?> </td> </tr> <?php } ?> </tbody> </table> </div> <h3><i class="fa fa-signal" aria-hidden="true"></i> ANALYSIS</h3> <div class="table-responsive analysis"> <table class="table"> <thead> <tr style="border:initial;"> <th style="border-bottom: initial;">Course</th> <th colspan="2" style="border-bottom: initial;text-align:center;">Progress</th> <th style="border-bottom: initial;text-align:center;">Correct</th> <!--<th style="border-bottom: initial;text-align:center;">Your Pace</th>--> <!--<th style="border-bottom: initial;text-align:center;">Group Pace</th>--> </tr> </thead> <tbody> <tr> <td style="border-bottom: 2px solid #ddd;border-top: initial;text-align:center;padding-top:0px;"><small></small></td> <td style="border-bottom: 2px solid #ddd;border-top: initial;text-align:center;padding-top:0px;"><small>Chapters</small></td> <td style="border-bottom: 2px solid #ddd;border-top: initial;text-align:center;padding-top:0px;"><small>Practice</small></td> <td style="border-bottom: 2px solid #ddd;border-top: initial;text-align:center;padding-top:0px;"><small>(in %)</small></td> <!--<td style="border-bottom: 2px solid #ddd;border-top: initial;text-align:center;padding-top:0px;"><small>(in days)</small></td>--> <!--<td style="border-bottom: 2px solid #ddd;border-top: initial;text-align:center;padding-top:0px;"><small>(in sec)</small></td>--> </tr> <?php foreach ($analysis_details as $ad) { ?> <tr> <td><?php echo $ad['sub_domain']; ?></td> <td style="text-align:center;"><?php echo $ad['chapter_name']; ?></td> <td style="text-align:center;"><?php echo $ad['attempts']; ?></td> <!--<td style="text-align:center;"></?php if ($ad['correct_answers'] != '0') {--> <!-- echo round(($ad['correct_answers'] / $ad['total_questions']) * 100);--> <!-- } else {--> <!-- echo '0';--> <!-- } ?></td>--> <td style="text-align:center;"> <?php if (!empty($ad['total_questions']) && $ad['total_questions'] != 0) { echo round(($ad['correct_answers'] / $ad['total_questions']) * 100); } else { echo '0'; } ?> </td> <!--<td style="text-align:center;"><?php //echo $ad['days']; ?></td>--> <!--<td style="text-align:center;">0</td>--> </tr> <?php } ?> </tbody> </table> </div> </div> <div class="col-md-4 healthcheck_div"> <!--<h3><i class="fa fa-user-md" aria-hidden="true"></i> HEALTH CHECK</h3>--> <div class="row side_circle" style="border-radius: 5px; margin-bottom: 45px;"> <div class="col-sm-6"> <?php if (!empty($performance['correct_answers'])) { ?> <div class="green_circle"> <?php $val = (($performance['correct_answers'] / $performance['total_questions']) * 100); if ($val > 100) { echo "100%"; } else { echo round(($performance['correct_answers'] / $performance['total_questions']) * 100) . "%"; } ?> </div> <?php } else { ?> <!--<div class="green_circle">--> <!-- 0%--> <!--</div>--> <!--<?php } ?>--> <!--<p>Performance</p>--> </div> <!--<div class="col-sm-6">--> <!-- <?php if (($progress['correct_answers'] != '0') && ($progress['total_questions'] != '0')) { ?>--> <!-- <input type="hidden" value="<?php echo round(($progress['correct_answers'] * 100) / $progress['total_questions']) ?>" class="progress_finals_show" />--> <!-- <input type="hidden" value="100" class="progress_finals_show"/>--> <!-- <div class="orange_circle">--> <!-- <?php echo round(($progress['correct_answers'] * 100) / $progress['total_questions']) . "%"; ?>--> <!-- </div>--> <!-- <?php } else { ?>--> <!-- <div class="orange_circle">--> <!-- 0%--> <!-- </div>--> <!--<?php } ?>--> <!--<p>Progress</p>--> <!--</div>--> </div> <!--<h3><i class="fa fa-briefcase" aria-hidden="true"></i> VALUE ADS</h3>--> <div class="row side_button" style="border-radius: 5px; margin-bottom: 45px;"> <!-- <button class="btn btn-primary btn-block">Tool kits - LSSBB</button> --> <button onclick="study_material();" class="btn btn-primary btn-block">STUDY MATERIAL</button> <button class="btn btn-primary btn-block"><a style="color: white;" href="<?php echo site_url('feedback'); ?>/<?= current_url(true)->getSegment(3) ?>">Feedback</a></button> </div> <h3><i class="fa fa-user" aria-hidden="true"></i> ACTIVITY</h3> <div class="row side_tabs" style="border-radius: 5px; margin-bottom: 45px;"> <ul class="nav nav-tabs"> <li class="active"><a data-toggle="tab" href="#home">Notes</a></li> </ul> <div class="tab-content"> <div id="home" class="tab-pane fade in active"> <p class="our_feedback"> <form id="land_owner" class="form-inline note_form" enctype="multipart/form-data"> <div class="row land_owner_a" style="margin-bottom: 2%"> <div class="form-group col-xs-10 col-sm-12 col-md-12 chapter_name"> <label class="col-sm-2 hidden-xs">Note</label> <textarea cols="36" rows="5" class="form-control col-sm-8" name="note" required="required"> </textarea> </div> </div> <!-- row 1--> <div class="row land_owner_a"> <div class="col-sm-4 col-md-4"></div> <div class="col-sm-4 col-md-4"> <button type="submit" class="btn btn-primary center-block submit">Submit</button> </div> <div class="col-sm-4 col-md-4"></div> </div> <!-- row 6--> </form> </p> <p class="our_feedback"> <a onclick="added_note();"> Notes History <i class="fa fa-search" aria-hidden="true"></i></a> </p> </div> <!--<div id="menu1" class="tab-pane fade">--> <!--</div>--> <div id="menu2" class="tab-pane fade"> <p class="our_feedback"> <a href="<?php echo site_url('feedback'); ?>/<?= current_url(true)->getSegment(4) ?>">Feedback <i class="fa fa-paper-plane" aria-hidden="true"></i></a> </p> </div> </div> </div> </div> <!-- /.col-lg-4 --> </div> <!-- /.row --> </div> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Add Feedback</h4> </div> <div class="modal-body"> <form id="land_owner" class="form-inline feedback_form" enctype="multipart/form-data"> <div class="row land_owner_a"> <div class="form-group col-xs-10 col-sm-12 col-md-10 chapter_name"> <label class="col-sm-4 hidden-xs">Faculty</label> <select class="form-control col-sm-8" name="faculty_id" style="width:61%; margin-bottom: 2%" required="required"> <option value="">Select</option> <?php foreach ($faculties as $faculty) { ?> <option value="<?php echo $faculty->login_id; ?>"><?php echo $faculty->fullname; ?></option> <?php } ?> </select> </div> </div> <div class="row land_owner_a" style="margin-bottom: 2%"> <div class="form-group col-xs-10 col-sm-12 col-md-10 chapter_name"> <label class="col-sm-4 hidden-xs">Feedback</label> <textarea cols="35" class="form-control col-sm-8" name="feedback" required="required"> </textarea> </div> </div> <!-- row 1--> <div class="row land_owner_a"> <div class="col-sm-4 col-md-4"></div> <div class="col-sm-4 col-md-4"> <button type="submit" class="btn btn-primary center-block submit">Submit</button> </div> <div class="col-sm-4 col-md-4"></div> </div> <!-- row 6--> </form> </div> </div> </div> </div> <div class="modal fade" id="note_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Add Note</h4> </div> <div class="modal-body"> <form id="land_owner" class="form-inline note_form" enctype="multipart/form-data"> <div class="row land_owner_a" style="margin-bottom: 2%"> <div class="form-group col-xs-10 col-sm-12 col-md-12 chapter_name"> <label class="col-sm-2 hidden-xs">Note</label> <textarea cols="40" rows="5" class="form-control col-sm-8" name="note" required="required"> </textarea> </div> </div> <!-- row 1--> <div class="row land_owner_a"> <div class="col-sm-4 col-md-4"></div> <div class="col-sm-4 col-md-4"> <button type="submit" class="btn btn-primary center-block submit">Submit</button> </div> <div class="col-sm-4 col-md-4"></div> </div> <!-- row 6--> </form> </div> </div> </div> </div> <div class="modal fade" id="added_note_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Added Note</h4> </div> <div class="modal-body my_header"> <form id="land_owner" class="form-inline feedback_form" enctype="multipart/form-data"> <div class="table-responsive"> <table class="table table-bordered" style="width:100%;"> <thead> <th style="width:15%;">Date</th> <th style="width:55%;">Note Added</th> <th style="width:15%;">Edit</th> <th style="width:15%;">Delete</th> </thead> <tbody> <?php foreach ($notes as $note) { ?> <tr> <td><?php echo date("d-m-Y", strtotime($note->created_at)); ?></td> <td style="text-align: justify;"><?php echo $note->notes; ?></td> <td><button type="button" class="btn btn-primary edit_note" onclick="edit_note(<?php echo $note->id; ?>);">Edit</button></td> <td><button type="button" class="btn btn-primary" onclick="delete_note(<?php echo $note->id; ?>);">Delete</button></td> </tr> <?php } ?> </tbody> </table> </div> </form> </div> </div> </div> </div> <div class="modal fade" id="update_note_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Update Note</h4> </div> <div class="modal-body"> <form id="land_owner" class="form-inline update_notes" enctype="multipart/form-data"> <input type="hidden" class="notes_id" name="notes_id" /> <div class="row land_owner_a" style="margin-bottom: 2%"> <div class="form-group col-xs-10 col-sm-12 col-md-12 chapter_name"> <label class="col-sm-2 hidden-xs">Note</label> <textarea cols="40" rows="5" class="form-control col-sm-8 added_note" name="added_note" required="required"></textarea> </div> </div> <!-- row 1--> <div class="row land_owner_a"> <div class="col-sm-4 col-md-4"></div> <div class="col-sm-4 col-md-4"> <button type="submit" class="btn btn-primary center-block update">Update</button> </div> <div class="col-sm-4 col-md-4"></div> </div> <!-- row 6--> </form> </div> </div> </div> </div> <!-- <div class="modal fade" id="study_material" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Study Material</h4> </div> <div class="modal-body"> <!--- <?php //$i = 0; //foreach ($mapping_subjects as $subjects) { ?> <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingOne<?php //echo 'study_material' . $i; ?>"> <h4 class="panel-title"> <a style="text-decoration: none" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne<?php //echo 'study_material' . $i; ?>" aria-expanded="true" aria-controls="collapseOne<?php //echo 'study_material' . $i; ?>"> <?php //echo $subjects['sub_domain']; ?> </a> </h4> </div> <div id="collapseOne<?php //echo 'study_material' . $i; ?>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne<?php //echo 'study_material' . $i; ?>"> <div class="panel-body"> <?php //$j = 0; //foreach ($subjects['subject_chapters'] as $chapters) { //if ($chapters->chapter_id != "" && $chapters->delete_status == "ACTIVE") { ?> <ul class="nav menu_link" id="side-menu"> <li> <a style="text-decoration: none" onclick="get_chapter_topics('<?php //echo $chapters->chapter_id; ?>'+','+'<?php //echo $j; ?>')"><?php //echo $chapters->chapter_name; ?></a> </li> </ul> <ul class="nav menu_link chapter_wise_materias<?php //echo $j; ?>" id="side-menu"> </ul> <?php //} //$j = $j + 1; //} ?> </div> </div> </div> <?php //$i = $i + 1; //} ?> </div>----> <!-- <div class="panel-group" id="accordion11"> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingOne1"> <h4 class="panel-title"> <a role="button" data-toggle="collapse" data-parent="#accordion111" href="#collapseOne1" aria-expanded="true" aria-controls="collapseOne1"> HTML </a> </h4> </div> <div id="collapseOne1" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne1"> <div class="panel-body sub_panel_body"> <li><a href=""><i class="fa fa-play-circle" aria-hidden="true"></i> How to get length of a string in C Language using strlen( ) with practical</a></li> </div> <div class="panel-body sub_panel_body"> <li><a href=""><i class="fa fa-play-circle" aria-hidden="true"></i> How to get length of a string in C Language using strlen( ) with practical</a></li> </div> <div class="panel-body "> <li class="sub_panel_body_study_li"><a style="background: transparent;box-shadow: 0px 0px 3px transparent !important;" href="<?php //echo base_url('end-module'); ?>/'+chapter_id+'"><i class="fa fa-question-circle" aria-hidden="true"></i> End Of Module Test</a></li> </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading" role="tab" id="headingTwo"> <h4 class="panel-title"> <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> HTML </a> </h4> </div> <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo"> <div class="panel-body sub_panel_body"> <li><a href=""><i class="fa fa-play-circle" aria-hidden="true"></i> test11</a></li> </div> <div class="panel-body sub_panel_body"> <li><a href=""><i class="fa fa-play-circle" aria-hidden="true"></i> test22</a></li> </div> <div class="panel-body sub_panel_body"> <li class="sub_panel_body_li"><a style="background: transparent;box-shadow: 0px 0px 3px transparent !important;" href="<?php //echo base_url('end-module'); ?>/'+chapter_id+'"><i class="fa fa-question-circle" aria-hidden="true"></i> End Of Module Test</a></li> </div> </div> </div> </div>--> </div> </div> </div> </div> <div class="modal fade" id="study_material" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Study Material</h4> </div> <div class="modal-body"> <?php $i = 0; foreach ($mapping_subjects as $subjects) { ?> <div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#collapsestudy<?php echo $i; ?>" aria-controls="collapsestudy<?php echo $i; ?>"><?php echo $subjects['sub_domain']; ?> </a> </h4> </div> <div id="collapsestudy<?php echo $i; ?>" aria-labelledby="headingOne<?php echo $i; ?>" class="panel-collapse collapse"> <?php $j = 0; foreach ($subjects['subject_chapters'] as $chapters) { if ($chapters->chapter_id != "" && $chapters->delete_status == "ACTIVE") { ?> <div class="panel-body sub_panel_body"> <li><i class="fa fa-play-circle" aria-hidden="true"></i> <a href="" data-toggle="collapse" data-parent="#accordion2" onclick="chapter_wise_materials('<?php echo $chapters->topic_id; ?>'+','+'<?= current_url(true)->getSegment(3) ?>')"><?php echo htmlspecialchars($chapters->topic_name); ?> </a></li> </div> <?php } $j = $j + 1; } if (count($subjects['subject_chapters']) > 0) { ?> <!--<div class="panel-body"> <li class="sub_panel_body_li"><i class="fa fa-question-circle" aria-hidden="true"></i> <a href="" data-toggle="collapse" onclick="end_module('<? //= current_url(true)->getSegment(2) ?>');" data-parent="#accordion2">End Of Module Test </a></li> </div>--> <?php } else { ?> <div class="panel-body panel-collapse"> <li class="sub_panel_body_li">Topics are not available</li> </div> <?php } ?> </div> </div> </div> <?php $i = $i + 1; } ?> </div> </div> </div> </div> <script> $('.button').click(function() { var selected_type = 'chapter_wise'; var chapter_id = $(this).val(); var sub_domain_id = $('.sub_domain_id').val(); var mapping_id = $('.mapping_id').val(); $.ajax({ url: "<?php echo site_url('check_approved_materials') ?>", type: "POST", data: { 'chapter_id': chapter_id, 'subject_id': sub_domain_id, 'mapping_id': mapping_id }, async: false, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { $.ajax({ url: "<?php echo site_url('subject_chapter_wise_questions') ?>", type: "POST", data: { 'selected_type': selected_type, 'subject': sub_domain_id, 'chapter': chapter_id }, async: false, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { toastr["success"]('You will be redirected to take test'); window.location.href = "<?php echo site_url('test-welcome-page'); ?>/" + mapping_id + "/" + sub_domain_id + "/" + chapter_id; } else { toastr["error"](response.message); } } }); } else { toastr["error"]("Materials not available for this chapter"); } } }); // window.location.href = "<?php //echo site_url('test-welcome-page'); ?>/"+mapping_id+"/"+sub_domain_id+"/"+chapter_id; //window.location.href = "<?php //echo base_url('test-welcome-page'); ?>/"+sub_domain_id; }); </script> <script type="text/javascript"> $(document).ready(function() { var check = $('.check_final').val(); var check_progress = $('.progress_finals_show').val(); if (check == 1) { $('.final_test').hide(); $('.chapter_id').prop('disabled', true); $('.button').prop('disabled', true); } else { $('.final_test').prop('disabled', false); } }); function study_material() { $("#study_material").modal("show"); } function fun_feedback() { $("#myModal").modal("show"); } $('.feedback_form').submit(function(e) { e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); $.ajax({ type: 'post', url: '<?php echo site_url("add_feedback") ?>/<?= current_url(true)->getSegment(4) ?>', data: formdata, contentType: false, processData: false, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { $("#myModal").modal("hide"); toastr["success"](response.message); $('.feedback_form')[0].reset(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else { toastr["error"](response.message); $(".submit").text("Update"); $(".submit").removeAttr('disabled'); } } }); }); </script> <script> $(document).ready(function() { // $('.chapter_id').on('click', function() { // var mocktestId = $(this).data('mocktest-id'); // var subDomainId = $('.sub_domain_id').val(); // var mappingId = $('.mapping_id').val(); // $.ajax({ // type: 'POST', // url: '<? //= site_url('check_approved_materials_for_mocktest'); ?>', // data: { // 'subject_id': subDomainId, // 'mapping_id': mappingId // }, // dataType: 'json', // success: function(response) { // if (response.result == 1) { // window.location.href = '<? //= site_url('mocktest-practice'); ?>/<? //= current_url(true)->getSegment(2) ?>/' + subDomainId + '/' +id; // } else { // toastr["error"]("Materials not available for this chapter"); // } // }, // error: function() { // toastr["error"]("Error in AJAX request"); // } // }); // }); $('.chapter_id').click(function() { var id = $(this).attr('id'); var chapter_id = 0; var sub_domain_id = $('.sub_domain_id').val(); var mapping_id = $('.mapping_id').val(); $.ajax({ url: "<?= site_url('check_approved_materials_for_mocktest') ?>", method: "POST", data: { 'subject_id': sub_domain_id, 'mapping_id': mapping_id }, dataType: 'json', // specify that the response should be parsed as JSON success: function(response) { console.log(response); if (response.result == 1) { var sub_domain_id = $('.sub_domain_id').val(); window.location.href = "<?= base_url('mocktest-practice') ?>/<?= current_url(true)->getSegment(4); ?>/" + sub_domain_id + "/" + id; } else { toastr["error"]("Materials not available for this chapter"); } }, error: function(xhr, status, error) { console.error(xhr.responseText); } }); }); $('.mocktest_review').click(function() { var mocktest_ids = $(this).attr('id'); var mocktest_id = mocktest_ids.split(',')[0]; var mocktest_sl_no = mocktest_ids.split(',')[1]; var sub_domain_id = $('.sub_domain_id').val(); window.location.href = "<?php echo site_url('added-course-details-review'); ?>/<?= current_url(true)->getSegment(4) ?>/" + mocktest_sl_no + "/" + mocktest_id; }); $('.final_test').click(function() { var questions = $('.questions').val(); if (questions == "0") { toastr["error"]("Questions Not yet added!"); } else { var mapping_id = $('.mapping_id').val(); var id = $(this).attr('id'); window.location.href = "<?php echo site_url('user-final-test'); ?>/<?= current_url(true)->getSegment(3); ?>/" + 15; } }); }); function added_note() { $("#note_modal").modal("show"); } $('.note_form').submit(function(e) { e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); $.ajax({ type: 'post', url: '<?php echo site_url("add_notes") ?>/<?= current_url(true)->getSegment(3) ?>', data: formdata, contentType: false, processData: false, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { $("#note_modal").modal("hide"); toastr["success"](response.message); $('.note_form')[0].reset(); location.reload(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else { toastr["error"](response.message); $(".submit").text("Update"); $(".submit").removeAttr('disabled'); } } }); }); function added_note() { $("#added_note_modal").modal("show"); } function edit_note(str) { var id = str; $.ajax({ type: 'post', url: '<?php echo site_url("get_notes"); ?>', data: { id: id }, async: false, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { $("#added_note_modal").modal("hide"); $("#update_note_modal").modal("show"); $('.notes_id').val(response.message.id); $('.added_note').val(response.message.notes); } } }); } $('.update_notes').submit(function(e) { e.preventDefault(); formdata = new FormData($(this)[0]); $(".update").attr('disabled', 'disabled'); $(".update").text("Updating..."); $.ajax({ type: 'post', url: '<?php echo site_url("update_notes") ?>', data: formdata, contentType: false, processData: false, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { $("#update_note_modal").modal("hide"); toastr["success"](response.message); location.reload(); $(".update").text("Update"); $(".update").removeAttr('disabled'); } else { toastr["error"](response.message); $(".update").text("Update"); $(".update").removeAttr('disabled'); } } }); }); function delete_note(str) { var id = str; $.ajax({ type: 'post', url: '<?php echo site_url("delete_notes"); ?>', data: { id: id }, async: false, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { location.reload(); toastr["success"](response.message); } else { toastr["error"](response.message); } } }); } function chapter_wise_materials(id, mapping_id) { var mapping_id = $('.mapping_id').val(); var type = 'post'; $.ajax({ type: type, url: "<?php echo site_url('get_chapter_material'); ?>", data: { id: id, mapping_id: mapping_id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { window.location.href = "<?php echo site_url('chapter-wise-topic-materials'); ?>/" +response.topic_id + "/" +response.mapping_id + ""; } else { toastr["error"](response.message); } } }); } function get_chapter_topics(id) { var s = id.split(','); var mapping_id = '<?= current_url(true)->getSegment(2) ?>'; var count = s[1]; var chapter_id = s[0]; var type = 'post'; $.ajax({ type: type, url: "<?php echo site_url('get_user_chapter_topics'); ?>", data: { id: id }, success: function(response) { // response = jQuery.parseJSON(response); console.log(response); if (response.result == 1) { var fields = ''; $.each(response.message, function(key, val) { fields += '<li>'; fields += '<a href="javascript:void(0);" onclick="chapter_wise_materials(' + val.topic_id + ',' + mapping_id + ')">' + val.topic_name + '</a>'; fields += '</li>'; }); fields += '<li><button onclick="end_module(' + chapter_id + ');">End module</button></li>'; $('.chapter_wise_materias' + count + '').html(fields); } } }); } </script> <?php echo view('includes/user_footer'); ?> <style> .user_head_tab_row{ margin-bottom: 3%; } #page-wrapper{ background-image: url('http://localhost/amcad/public/assets/website_assets/images/banner.png'); /* opacity: 0.5; */ background-size: cover; background-position: center; background-repeat: no-repeat; } .analysis { border: transparent; } .review { border: 2px solid #337ab7; padding: 2px 15px; border-radius: 4px; } .review:hover { text-decoration: none; } .table>tbody>tr>td, .table>tbody>tr>th { padding: 10px; } .table{ border-radius: 5px; } /*.final_test { background-color: #337ab7; border-color: #2e6da4; }*/ .sub_panel_body li { list-style-type: none; } .sub_panel_body_li { list-style-type: none; } .sub_panel_body_study_li { list-style-type: none; } .sub_panel_body_study_li a { text-decoration: none; background-color: grey !important; padding: 10px 20px; color: white; } .user_head_tab li { float: left; list-style-type: none; margin-right: 6px; } .user_head_tab li a:hover { text-decoration: none; } .green_circle { background: #8f8ecad9; border: 5px solid #ffffffad; } .table>tbody>tr>td { vertical-align: middle; } .modal-dialog { width: 80% !important; } @media only screen and (min-width:320px) and (max-width:640px) { .chapter_id { margin-bottom: 10px; } } @media only screen and (min-width:641px) and (max-width:991px) { .chapter_review { margin-top: 10px; } } @media only screen and (min-width:992px) and (max-width:1258px) { .chapter_review { margin-top: 10px; } } </style>