EVOLUTION-NINJA
Edit File: user_subject_wise_test.php
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <title>AMCAD Mocktest</title> <link rel="stylesheet" type="text/css" href="<?php echo base_url('public/assets/css/mock_test.css'); ?>" /> <link rel="stylesheet" type="text/css" href="<?php echo base_url('public/assets/css/bootstrap.min.css'); ?>" /> <link rel="stylesheet" type="text/css" href="<?php echo base_url('public/assets/css/font-awesome.min.css'); ?>" /> <link href='http://fonts.googleapis.com/css?family=Lato:400,700' rel='stylesheet' type='text/css'> <link rel='shortcut icon' type='image/x-icon' href="<?php echo base_url('public/assets/images/favicon.png'); ?>" /> <script type="text/javascript" src="<?php echo base_url('public/assets/js/jquery-3.3.1.min.js'); ?>"></script> <script type="text/javascript" src="<?php echo base_url('public/assets/js/bootstrap.min.js'); ?>"></script> <link rel="stylesheet" href="<?php echo base_url('public/assets/toastr/toastr.min.css'); ?>"> <script type="text/javascript" src="<?php echo base_url('public/assets/toastr/toastr.min.js'); ?>"></script> <script type="text/javascript" src="<?php echo base_url('public/assets/js/jquery.countdownTimer.js'); ?>"></script> <link rel="stylesheet" type="text/css" href="<?php echo base_url('public/assets/css/jquery.countdownTimer.css'); ?>" /> </head> <body> <header> <?php $uri_id = service('uri')->getSegment(3); ?> <div class="container-fluid"> <input type="hidden" value="<?= service('uri')->getSegment(3) ?>" class="uri_sub_domain_id" /> <input type="hidden" value="<?= service('uri')->getSegment(2) ?>" class="mapping_id" /> <input type="hidden" value="<?= service('uri')->getSegment(4) ?>" class="mocktest_id" /> <div class="col-sm-2"> <a class="logo-lg"><img src="<?php echo base_url('public/assets/images/Logo_AMCAD.png'); ?>" class="img-responsive"></a> </div> <div class="col-sm-7 header_right"> <ul> <li><?php echo $course_title; ?></li> <li>|</li> <li>MockTest</li> </ul> </div> <div class="col-sm-3 header_right_div"> <ul> <li class="instruction"><a href="" data-toggle="modal" data-target="#test_instructions"><i class="fa fa-info-circle" aria-hidden="true"></i> Instructions</a></li> <li> <div id="hms_timer"></div> </li> <input type="hidden" class="timer" value="<?php echo $total_subject_wise_questions->total_time; ?>" /> </ul> </div> </div><!-- container----> </header> <section class="anewer_question_middle"> <div class="container-fluid"> <div class="col-sm-5 col-md-4 col-lg-3 anewer_question_middle_left"> <?php $i = 1; foreach ($questions as $value) { ?> <ul class="row"> <li class="anewer_question_no"><a href="javascript:void(0)" class="mark_later_qus mark_later<?php echo $value['question_id']; ?>" id="<?php echo $value['question_id']; ?>" <?php foreach ($mark_number as $vals) { if ($value['question_id'] == $vals->question_id) { ?> style="background-color:yellow;" <?php } } ?>> <input type="hidden" id="chapter_id" value="<?php echo $value['chapter_id']; ?>"> <input type="hidden" id="quest_num<?php echo $value['question_id']; ?>" value="<?php echo $i; ?>"> <span class="no_sl" id="<?php echo $i; ?>"><?php echo $i; ?><?php echo "."; ?> </span> </a></li> <?php if (!empty($value['ans1'])) { ?> <li><label class="round mark_checked1<?php echo $value['question_id']; ?>" <?php foreach ($mark_for_later as $val) { if ($value['question_id'] == $val->question_id) { ?> style="background: #337ab7; color: white; border: 1px solid white;" <?php } } ?>> A </label> <input type="hidden" class="ans1" value="1"> </li> <?php } else { ?> <?php } ?> <?php if (!empty($value['ans2'])) { ?> <li><label class="round mark_checked2<?php echo $value['question_id']; ?>" <?php foreach ($mark_for_later as $val) { if ($value['question_id'] == $val->question_id) { ?> style="background: #337ab7; color: white; border: 1px solid white;" <?php } } ?>> B </label> <input type="hidden" class="ans2" value="2"> </li> <?php } else { ?> <?php } ?> <?php if (!empty($value['ans3'])) { ?> <li><label class="round mark_checked3<?php echo $value['question_id']; ?>" <?php foreach ($mark_for_later as $val) { if ($value['question_id'] == $val->question_id) { ?> style="background: #337ab7; color: white; border: 1px solid white;" <?php } } ?>> C </label> <input type="hidden" class="ans3" value="3"> </li> <?php } else { ?> <?php } ?> <?php if (!empty($value['ans4'])) { ?> <li><label class="round mark_checked4<?php echo $value['question_id']; ?>" <?php foreach ($mark_for_later as $val) { if ($value['question_id'] == $val->question_id) { ?> style="background: #337ab7; color: white; border: 1px solid white;" <?php } } ?>> D </label> <input type="hidden" class="ans4" value="4"> </li> <?php } ?> </ul> <?php $i++; } ?> </div><!-- col-sm-3------------------------------------------------------> <div class="col-sm-7 col-md-8 col-lg-9 blink_text"></div> <div class="col-sm-7 col-md-8 col-lg-9"> <div class="anewer_question_middle_right" id="append_next_question"> <?php $j = 1; foreach ($limitation_questions as $value) { ?> <input type="hidden" class="question_number" value="<?php echo $j; ?>"> <!--<h4><span><?php echo $j; ?><?php echo "."; ?> <input type="text" value="<?php echo $value['questions']; ?>" style="border: none; width: 95%;"/></span> </h4>--> <!--<h4><span><?php echo $j; ?><?php echo "."; ?> <input class="" style="border: none; width: 95%;" type="text" value="<?php echo $value['questions']; ?>"/> </span></h4>--> <div class="row"> <pre><code> <input type="hidden" name="question_number" id="question_number" value="<?php echo $j; ?>"/> <?php echo $j; ?><?php echo "."; ?> <?php echo $value['questions']; ?> </code></pre> </div> <input type="hidden" id="question_id" value="<?php echo $value['question_id']; ?>"> <input type="hidden" id="sub_domain_id" value="<?php echo $value['sub_domain_id']; ?>"> <section id="first" class="section question_option"> <?php if (!empty($value['ans1'])) { ?> <div class="qustion_option"> <input type="radio" name="ans" id="radio-1" value="1" class="question_answer"> <label for="radio-1" class="question_answer_radio"><span class="radio question_radio"><span class="abcd">A</span> <input type="hidden" class="ans" name="answer" value="1"> <pre><code><?php echo $value['ans1']; ?></code></pre> </span></label> <!--- <div class="azz"> <label for="radio-1" class="question_answer_radio"><span class="radio"><span class="abcd">A</span> <input type="hidden" class="ans" name="answer" value="1" ></label> </div> <div class="bzz"> <pre><code><?php echo $value['ans1']; ?></code></pre></span> </div>----> </div> <?php } else { ?> <?php } ?> <?php if (!empty($value['ans2'])) { ?> <div class="qustion_option"> <input type="radio" name="ans" id="radio-2" value="2" class="question_answer"> <label for="radio-2" class="question_answer_radio"><span class="radio question_radio"><span class="abcd">B</span> <input type="hidden" class="ans" name="answer" value="2"> <pre><code><?php echo $value['ans2']; ?></code></pre> </span></label> </div> <?php } else { ?> <?php } ?> <?php if (!empty($value['ans3'])) { ?> <div class="qustion_option"> <input type="radio" name="ans" id="radio-3" value="3" class="question_answer"> <label for="radio-3" class="question_answer_radio"><span class="radio question_radio"><span class="abcd">C</span> <input type="hidden" class="ans" name="answer" value="3"> <pre><code><?php echo $value['ans3']; ?></code></pre> </span></label> </div> <?php } else { ?> <?php } ?> <?php if (!empty($value['ans4'])) { ?> <div class="qustion_option"> <input type="radio" name="ans" id="radio-4" value="4" class="question_answer"> <label for="radio-4" class="question_answer_radio"><span class="radio question_radio"><span class="abcd">D</span> <input type="hidden" class="ans" name="answer" value="4"> <pre><code><?php echo $value['ans4']; ?></code></pre> </span></label> </div> <?php } else { ?> <?php } ?> </section> <?php $j++; } ?> </div> </div><!-- col-sm-9----> </div><!-- container----> </section> <!------------------------------------- middle Work END ------------------------------------------------> <footer> <div class="container-fluid"> <input type="hidden" name="mark_value" id="mark_value" value="0"> <div class="col-sm-5"> <button type="button" class="btn btn-success buttonsri" id="marked_question"><i class="fa fa-check-circle-o" aria-hidden="true"></i> Marked Questions</button> <button type="button" class="btn btn-success buttonsri" id="mark_for_later"><input type="hidden" id="question_id" value="<?php echo $value['question_id']; ?>"><i class="fa fa-check-circle-o" aria-hidden="true"></i> Mark for later </button> <button type="button" class="btn btn-success buttonsri" id="preview_question"> <i class="fa fa-angle-double-left" aria-hidden="true"></i> Previous </button> </div> <div class="col-sm-3 footer_middle_qes"> <?php $c = 1; $tot = $total_subject_wise_questions; ?> <p>Question <span style="color:#4cae4c;"><input type="text" class="q_ids" value="<?php echo $c; ?>" style="border:none;background-color: #efefec;width: 30px;" disabled /></span> of <span><?php echo $total_subject_wise_questions->number_of_questions; ?></span></p> <input type="hidden" class="q_id" value="<?php echo $total_subject_wise_questions->number_of_questions; ?>" /> </div> <div class="col-sm-4"> <button type="button" class="btn btn-success buttonsri" data-toggle="modal" data-target="#finish_this_test"> Finish this Test</button> <button type="button" class="btn btn-success buttonsri" id="next_question"> Next <i class="fa fa-angle-double-right" aria-hidden="true"></i> </button> </div> </div><!-- container----> </footer> <!---- finish Button Popup ----------------------------------------------------------> <!-- Modal --> <div class="modal fade" id="finish_this_test" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="exampleModalLabel">Are you sure you want to finish this Test?</h4> <!--<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="text-align:right;">--> <!-- <span aria-hidden="true">×</span>--> <!--</button>--> </div> <div class="modal-footer"> <button type="button" class="btn btn-success" onclick="finish(<?php echo $uri_id; ?>);">Yes, I'm done with this Test</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </div> </div> </div> </div> <!-- Modal1 --> <div class="modal fade" id="test_instructions" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <div class="welcome_middle_one_middle"> <h4>Welcome to Online Test - 1</h4> <?php if (empty($chapter)) { ?> <p>* This is a Mock Test of <?php echo $subject->sub_domain; ?> online Course which contains <?php echo $total_subject_wise_questions->number_of_questions; ?> multiple choice questions. <?php } else { ?> <p>* This is a Mock Test of <?php echo $chapter->chapter_name; ?> online Course which contains <?php echo $total_subject_wise_questions->number_of_questions; ?> multiple choice questions. <?php } ?> <?php if (empty($total_chapter_question_timings)) { ?> <?php $chapter_total_time = $total_subject_wise_questions->total_time; ?> <p>* Test duration is <?php echo $chapter_total_time; ?> minutes. <?php } else { ?> <?php $subject_total_time = $total_subject_wise_questions->total_time;; ?> <p>* Test duration is <?php echo $subject_total_time ?> minutes. <?php } ?> <!-- <p>* Test duration is 6 in total(72 seconds per question).</p>--> <p>* There is no negative marking.</p> <p>* If you are unsure about the answer, you have an option 'Mark For Later' which marks that question to review and you can answer whenever before finishing the test.</p> <!-- <p>* Simply mark the question for the later and review at the end of the exam.</p> --> <p>* On clicking the questions on the left side of the screen it will be redirected to the particular question.</p> <p>* Marked for later questions will be highlighted in green color among the questions on left side of the screen.</p> <p>* Write down the formulas, mindmaps, brain dump and any other notes you may need to refer during the test.</p> <div class="label_mark_final"> <div class="radio"> <label class="round_final mark_checked1147"></label> <label>Mark For Later</label> </div> <!--- <div class="radio"> <label><input type="radio" name="optradio">Attempted</label> </div>----> </div> </div> <div class=""> <?php foreach ($details as $det) { ?> <input type="hidden" value="<?php echo $det->selected_type; ?>" class="type_value" /> <input type="hidden" value="<?php echo $det->subject_id; ?>" class="sub_val" /> <input type="hidden" value="<?php echo $det->chapter_id; ?>" class="chapter_val" /> <?php } ?> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </div> </div> </div> </div> <!-- Modal --> <div class="modal fade" id="marked_question_modal" role="dialog"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Marked Questions</h4> </div> <div class="modal-body"> <div id="marked_question_div"></div> </div> </div> </div> </div> </body> </html> <script> $(document).ready(function() { var q_id = $('.q_id').val(); if (q_id == 1) { $('#next_question').hide(); $('#preview_question').hide(); } var f_id = 0; var footer_qid = f_id + 1; var s = $('.q_ids').val(footer_qid); $('#preview_question').hide(); var i = 1; $(document).on('click', '#mark_for_later', function() { $(this).attr('disabled', 'disabled'); var val = $('#question_id').val(); var question_number = $("#question_number").val(); var val1 = $('.mark_as_value').val(); document.getElementById('mark_value').value = ++i; $.ajax({ type: 'POST', url: '<?php echo site_url('mark_as_later_subject') ?>', data: { qid: val, question_number: question_number }, success: function(response) { // response=jQuery.parseJSON(response); if (response.result == 1) { toastr["success"](response.message); var qid = $('.mark_later' + val).css('background-color', '#00ff00'); var qid = $('.mark_later' + val).css('border-radius', '50%'); var qid = $('.mark_later' + val).css('padding', '5px'); $('#preview_question').show(); var mapping_id = $('.mapping_id').val(); var qid = $('#question_id').val(); var cid = $('#sub_domain_id').val(); var ans = $('input[name=ans]:checked').val(); var mvalue = $('#mark_value').val(); $("#next_question").removeAttr('disabled'); $("#mark_for_later").removeAttr('disabled'); // $.ajax({ // type:'POST', // url:'<?php //echo site_url('next_question_subject_wise') ?>', // data:{'qid':qid,'cid':cid,'ans':ans,'mvalue':mvalue,'mapping_id':mapping_id}, // success:function(response){ // // response=jQuery.parseJSON(response); // if(response.result==1) // { // $("#next_question").removeAttr('disabled'); // qid = response.message.qid; // sub_domain_id = response.message.sub_domain_id; // questions = response.message.questions; // ans1 = response.message.ans1; // ans2 = response.message.ans2; // ans3 = response.message.ans3; // ans4 = response.message.ans4; // ans = response.message.ans; // cans = response.message.correct_answer; // var a = $('.question_number').val(); // var b = 1; // var id = parseInt(a) + parseInt(b); // var q_id = $('.q_id').val(); // if(q_id == id) // { // $('#next_question').hide(); // } // var s = $('.q_ids').val(); // var fo_id = parseInt(s)+1; // var footer_qid = $('.q_ids').val(fo_id); // var html=''; // html +='<input type="hidden" class="question_number" value='+id+'>'; // /* html +='<h4><span>'+id+''+'.'+' </span><input type="text" value="'+ questions +'" style="border: none; width: 95%;"/></h4>';*/ // html +=' <div class="row"><pre><code>'+id+''+'.'+' '+ questions +'</code></pre></div>'; // html +='<input type="hidden" id="question_id" value='+qid+'>'; // html +='<input type="hidden" id="sub_domain_id" value='+sub_domain_id+'>'; // html +='<section id="first" class="section question_option">'; // if(ans1 != "") // { // html +='<div class="qustion_option">'; // html +='<input type="radio" name="ans" id="radio-1" class="ans1" value="1">'; // html +='<label for="radio-1" class="question_answer_radio"><span class="radio"><span class="abcd">A</span><pre><code> '+ ans1 +'</code></pre></span></label>'; // html +='</div>'; // } // else // { // } // if(ans2 != "") // { // html +='<div class="qustion_option">'; // html +='<input type="radio" name="ans" id="radio-2" class="ans2" value="2">'; // html +='<label for="radio-2" class="question_answer_radio"><span class="radio"><span class="abcd">B</span><pre><code> '+ ans2 +'</code></pre></span></label>'; // html +='</div>'; // } // else // { // } // if(ans3 != "") // { // html +='<div class="qustion_option">'; // html +='<input type="radio" name="ans" id="radio-3" class="ans3" value="3">'; // html +='<label for="radio-3" class="question_answer_radio"><span class="radio"><span class="abcd">C</span><pre><code> '+ ans3 +'</code></pre></span></label>'; // html +='</div>'; // } // else // { // } // if(ans4 != "") // { // html +='<div class="qustion_option">'; // html +='<input type="radio" name="ans" id="radio-4" class="ans4" value="4">'; // html +='<label for="radio-4" class="question_answer_radio"><span class="radio"><span class="abcd">D</span><pre><code> '+ ans4 +'</code></pre></span></label>'; // html +='</div>'; // } // else // { // } // html +='</section>'; // $('#append_next_question').html(html); // if(cans == '1'){ // $(".ans1").attr( 'checked', true ); // }else if(cans == '2'){ // $(".ans2").attr( 'checked', true ); // }else if(cans == '3'){ // $(".ans3").attr( 'checked', true ); // }else if(cans == '4'){ // $(".ans4").attr( 'checked', true ); // } // } // else // { // toastr["error"](response.message); // } // } // }); } else { toastr["error"](response.message); $("#next_question").removeAttr('disabled'); $("#mark_for_later").removeAttr('disabled'); var qid = $('.mark_later' + val).css('background-color', ''); } } }); }); $("#next_question").click(function() { $('#preview_question').show(); var mapping_id = $('.mapping_id').val(); var qid = $('#question_id').val(); var cid = $('#sub_domain_id').val(); var ans = $('input[name=ans]:checked').val(); var mvalue = $('#mark_value').val(); var question_number = $(".question_number").val(); $("#next_question").attr('disabled', 'disabled'); $.ajax({ type: 'POST', url: '<?php echo site_url('next_question_subject_wise') ?>', data: { 'qid': qid, 'cid': cid, 'ans': ans, 'mvalue': mvalue, 'mapping_id': mapping_id, 'question_number': question_number }, success: function(response) { // response=jQuery.parseJSON(response); if (response.result == 1) { $("#next_question").removeAttr('disabled'); qid = response.message.qid; sub_domain_id = response.message.sub_domain_id; questions = response.message.questions; ans1 = response.message.ans1; ans2 = response.message.ans2; ans3 = response.message.ans3; ans4 = response.message.ans4; ans = response.message.ans; cans = response.message.correct_answer; var a = $('.question_number').val(); var b = 1; var id = parseInt(a) + parseInt(b); var q_id = $('.q_id').val(); if (q_id == id) { $('#next_question').hide(); } var s = $('.q_ids').val(); var fo_id = parseInt(s) + 1; var footer_qid = $('.q_ids').val(fo_id); var html = ''; html += '<input type="hidden" class="question_number" value=' + id + '>'; /* html +='<h4><span>'+id+''+'.'+' </span><input type="text" value="'+ questions +'" style="border: none; width: 95%;"/></h4>';*/ html += ' <div class="row"><pre><code><input type="hidden" name="question_number" id="question_number" value="' + id + '"/>' + id + '' + '.' + ' ' + questions + '</code></pre></div>'; html += '<input type="hidden" id="question_id" value=' + qid + '>'; html += '<input type="hidden" id="sub_domain_id" value=' + sub_domain_id + '>'; html += '<section id="first" class="section question_option">'; if (ans1 != "") { html += '<div class="qustion_option">'; html += '<input type="radio" name="ans" id="radio-1" class="ans1" value="1">'; html += '<label for="radio-1" class="question_answer_radio"><span class="radio"><span class="abcd">A</span><pre><code> ' + ans1 + '</code></pre></span></label>'; html += '</div>'; } else { } if (ans2 != "") { html += '<div class="qustion_option">'; html += '<input type="radio" name="ans" id="radio-2" class="ans2" value="2">'; html += '<label for="radio-2" class="question_answer_radio"><span class="radio"><span class="abcd">B</span><pre><code> ' + ans2 + '</code></pre></span></label>'; html += '</div>'; } else { } if (ans3 != "") { html += '<div class="qustion_option">'; html += '<input type="radio" name="ans" id="radio-3" class="ans3" value="3">'; html += '<label for="radio-3" class="question_answer_radio"><span class="radio"><span class="abcd">C</span><pre><code> ' + ans3 + '</code></pre></span></label>'; html += '</div>'; } else { } if (ans4 != "") { html += '<div class="qustion_option">'; html += '<input type="radio" name="ans" id="radio-4" class="ans4" value="4">'; html += '<label for="radio-4" class="question_answer_radio"><span class="radio"><span class="abcd">D</span><pre><code> ' + ans4 + '</code></pre></span></label>'; html += '</div>'; } else { } html += '</section>'; $('#append_next_question').html(html); if (cans == '1') { $(".ans1").attr('checked', true); } else if (cans == '2') { $(".ans2").attr('checked', true); } else if (cans == '3') { $(".ans3").attr('checked', true); } else if (cans == '4') { $(".ans4").attr('checked', true); } } else { toastr["error"](response.message); } } }); }); $('#preview_question').click(function() { $('#next_question').show(); var mapping_id = $('.mapping_id').val(); var qid = $('#question_id').val(); var cid = $('#sub_domain_id').val(); $("#preview_question").attr('disabled', 'disabled'); $.ajax({ type: 'POST', url: '<?php echo site_url('previous_question_subject_wise') ?>', data: { 'qid': qid, 'cid': cid, 'mapping_id': mapping_id }, success: function(response) { // response=jQuery.parseJSON(response); if (response.result == 1) { $("#preview_question").removeAttr('disabled'); var qid = response.message.qid; var sub_domain_id = response.message.sub_domain_id; var questions = response.message.questions; var ans1 = response.message.ans1; var ans2 = response.message.ans2; var ans3 = response.message.ans3; var ans4 = response.message.ans4; var ans = response.message.ans; var cans = response.message.correct_answer; var a = $('.question_number').val(); var b = 1; var id = parseInt(a) - parseInt(b); if (id == 1) { $('#preview_question').hide(); } var s = $('.q_ids').val(); var fo_id = parseInt(s) - 1; var footer_qid = $('.q_ids').val(fo_id); var html = ''; html += '<input type="hidden" class="question_number" value=' + id + '>'; /* html +='<h4><span>'+id+''+'.'+' </span><input type="text" value="'+ questions +'" style="border: none; width: 95%;"/></h4>';*/ html += ' <div class="row"><pre><code><input type="hidden" name="question_number" id="question_number" value="' + id + '"/>' + id + '' + '.' + ' ' + questions + '</code></pre></div>'; html += '<input type="hidden" id="question_id" value=' + qid + '>'; html += '<input type="hidden" id="sub_domain_id" value=' + sub_domain_id + '>'; html += '<section id="first" class="section question_option">'; if (ans1 != "") { html += '<div class="qustion_option">'; html += '<input type="radio" name="ans" id="radio-1" class="ans1" value="1">'; html += '<label for="radio-1"><span class="radio"><span class="abcd">A</span><pre><code> ' + ans1 + '</code></pre></span></label>'; html += '</div>'; } else { } if (ans2 != "") { html += '<div class="qustion_option">'; html += '<input type="radio" name="ans" id="radio-2" class="ans2" value="2">'; html += '<label for="radio-2"><span class="radio"><span class="abcd">B</span><pre><code> ' + ans2 + '</code></pre></span></label>'; html += '</div>'; } else { } if (ans3 != "") { html += '<div class="qustion_option">'; html += '<input type="radio" name="ans" id="radio-3" class="ans3" value="3">'; html += '<label for="radio-3"><span class="radio"><span class="abcd">C</span><pre><code> ' + ans3 + '</code></pre></span></label>'; html += '</div>'; } else { } if (ans4 != "") { html += '<div class="qustion_option">'; html += '<input type="radio" name="ans" id="radio-4" class="ans4" value="4">'; html += '<label for="radio-4"><span class="radio"><span class="abcd">D</span><pre><code> ' + ans4 + '</code></pre></span></label>'; html += '</div>'; } else { } html += '</section>'; $('#append_next_question').html(html); if (cans == '1') { $(".ans1").attr('checked', true); } else if (cans == '2') { $(".ans2").attr('checked', true); } else if (cans == '3') { $(".ans3").attr('checked', true); } else if (cans == '4') { $(".ans4").attr('checked', true); } } else { toastr["error"](response.message); } } }); }); $('.mark_later_qus').click(function() { $('#preview_question').show(); var qid = $(this).attr('id'); var cid = $('#chapter_id').val(); var sid = $('#sub_domain_id').val(); var no_sl = $('#quest_num' + qid).val(); var tot_quests = $('.q_id').val(); $.ajax({ type: 'POST', url: '<?php echo site_url('mark_later_qus_subject') ?>', data: { 'qid': qid, 'cid': cid, 'sid': sid }, success: function(response) { // response=jQuery.parseJSON(response); if (response.result == 1) { var qid = response.message.qid; var chapter_id = response.message.chapter_id; var sub_domain_id = response.message.sub_domain_id; var questions = response.message.questions; var ans1 = response.message.ans1; var ans2 = response.message.ans2; var ans3 = response.message.ans3; var ans4 = response.message.ans4; var ans = response.message.ans; var cans = response.message.correct_answer; /*var a = $('.question_number').val(); var b = 1; var id = parseInt(a) + parseInt(b);*/ var a = $('.question_number').val(); var b = 1; var id = parseInt(a) + parseInt(b); var footer_qid = $('.q_ids').val(no_sl); if (no_sl == 1) { $('#preview_question').hide(); } else { $('#preview_question').show(); } if (no_sl == tot_quests) { $('#next_question').hide(); } else { $('#next_question').show(); } var html = ''; html += '<input type="hidden" class="question_number" value=' + no_sl + '>'; /* html +='<h4><span>'+no_sl+' </span><input type="text" value="'+ questions +'" style="border: none; width: 95%;"/></h4>';*/ html += ' <div class="row"><pre><code>' + no_sl + '' + '.' + ' ' + questions + '</code></pre></div>'; html += '<input type="hidden" id="question_id" value=' + qid + '>'; html += '<input type="hidden" id="chapter_id" value=' + chapter_id + '>'; html += '<input type="hidden" id="sub_domain_id" value=' + sub_domain_id + '>'; html += '<section id="first" class="section question_option">'; if (ans1 != "") { html += '<div class="qustion_option">'; html += '<input type="radio" name="ans" id="radio-1" class="ans1" value="1">'; html += '<label for="radio-1"><span class="radio"><span class="abcd">A</span><pre><code> ' + ans1 + '</code></pre></span></label>'; html += '</div>'; } else { } if (ans2 != "") { html += '<div class="qustion_option">'; html += '<input type="radio" name="ans" id="radio-2" class="ans2" value="2">'; html += '<label for="radio-2"><span class="radio"><span class="abcd">B</span><pre><code> ' + ans2 + '</code></pre></span></label>'; html += '</div>'; } else { } if (ans3 != "") { html += '<div class="qustion_option">'; html += '<input type="radio" name="ans" id="radio-3" class="ans3" value="3">'; html += '<label for="radio-3"><span class="radio"><span class="abcd">C</span><pre><code> ' + ans3 + '</code></pre></span></label>'; html += '</div>'; } else { } if (ans4 != "") { html += '<div class="qustion_option">'; html += '<input type="radio" name="ans" id="radio-4" class="ans4" value="4">'; html += '<label for="radio-4"><span class="radio"><span class="abcd">D</span><pre><code> ' + ans4 + '</code></pre></span></label>'; html += '</div>'; } else { } html += '</section>'; $('#append_next_question').html(html); if (cans == '1') { $(".ans1").attr('checked', true); } else if (cans == '2') { $(".ans2").attr('checked', true); } else if (cans == '3') { $(".ans3").attr('checked', true); } else if (cans == '4') { $(".ans4").attr('checked', true); } } else { toastr["error"](response.message); } } }); }); }); $(document).on('change', '.qustion_option', function() { var qid = $('#question_id').val(); var cid = $('#sub_domain_id').val(); var ans = $('input[name=ans]:checked').val(); var mvalue = $('#mark_value').val(); //$('.mark_checked'+qid).attr( 'checked', true ); var ans1 = $('.ans1').val(); var ans2 = $('.ans2').val(); var ans3 = $('.ans3').val(); var ans4 = $('.ans4').val(); if (ans == ans1) { $('.mark_checked1' + qid).css({ "background-color": "#337ab7", "color": "white", "border": "1px solid white" }); $('.mark_checked2' + qid).css({ "background-color": "", "color": "black", "border": "1px solid white" }); $('.mark_checked3' + qid).css({ "background-color": "", "color": "black", "border": "1px solid white" }); $('.mark_checked4' + qid).css({ "background-color": "", "color": "black", "border": "1px solid white" }); } else if (ans == ans2) { $('.mark_checked1' + qid).css({ "background-color": "", "color": "black", "border": "1px solid white" }); $('.mark_checked2' + qid).css({ "background-color": "#337ab7", "color": "white", "border": "1px solid white" }); $('.mark_checked3' + qid).css({ "background-color": "", "color": "black", "border": "1px solid white" }); $('.mark_checked4' + qid).css({ "background-color": "", "color": "black", "border": "1px solid white" }); } else if (ans == ans3) { $('.mark_checked1' + qid).css({ "background-color": "", "color": "black", "border": "1px solid white" }); $('.mark_checked2' + qid).css({ "background-color": "", "color": "black", "border": "1px solid white" }); $('.mark_checked3' + qid).css({ "background-color": "#337ab7", "color": "white", "border": "1px solid white" }); $('.mark_checked4' + qid).css({ "background-color": "", "color": "black", "border": "1px solid white" }); } else if (ans == ans4) { $('.mark_checked1' + qid).css({ "background-color": "", "color": "black", "border": "1px solid white" }); $('.mark_checked2' + qid).css({ "background-color": "", "color": "black", "border": "1px solid white" }); $('.mark_checked3' + qid).css({ "background-color": "", "color": "black", "border": "1px solid white" }); $('.mark_checked4' + qid).css({ "background-color": "#337ab7", "color": "white", "border": "1px solid white" }); } $('.mark_later' + qid).css('background-color', ''); $.ajax({ type: 'POST', url: '<?php echo site_url('insert_subject_wise_answers') ?>', data: { 'qid': qid, 'cid': cid, 'ans': ans, 'mvalue': mvalue }, success: function(response) { } }); }); function finish(str) { var subject_id = str; $.ajax({ type: 'POST', url: '<?php echo site_url('insert_unattended_subject_wise_answers') ?>', data: { 'subject_id': subject_id }, success: function(response) { window.location.href = "<?php echo site_url('online_test_result_subject_wise'); ?>/<?= service('uri')->getSegment(2) ?>/<?= service('uri')->getSegment(3) ?>/<?= service('uri')->getSegment(4) ?>"; } }); } function instruction(str) { window.location.href = "<?php echo site_url('test-welcome-page'); ?>/" + str; } </script> <script> $(function() { var a = $('.timer').val(); //a = a.replace('00:', ''); var strarray = a.split(':'); var sub_domain_id = $('.uri_sub_domain_id').val(); var mocktest_id = $('.mocktest_id').val(); var mapping_id = '<?= service('uri')->getSegment(4) ?>'; //alert(chapter_id); $('#hms_timer').countdowntimer({ hours: strarray[0], minutes: strarray[1], seconds: strarray[2], size: "lg", pauseButton: "pauseBtnhms", stopButton: "stopBtnhms" }); var sec = 60; var hour = parseInt(strarray[0]) * parseInt(sec) * parseInt(sec); var min = parseInt(strarray[1]) * parseInt(sec); var time = parseInt(hour) + parseInt(min); var final_timeout = parseInt(time) * 1000; //alert(final_timeout); setTimeout(function() { window.location = "<?php echo site_url("online_test_result_subject_wise"); ?>/" + mapping_id + "/" + sub_domain_id + "/" + mocktest_id; }, final_timeout); }); $(document).on('click', '#marked_question', function() { var val = $('#question_id').val(); var val1 = $('.mark_as_value').val(); $.ajax({ type: 'POST', url: '<?php echo site_url('get-marked-questions') ?>', data: { qid: val }, success: function(response) { // response=jQuery.parseJSON(response); if (response.result == 1) { var questions = ''; var sl = 1; $.each(response.message, function(key, val) { questions += '<p>' + val.question_number + '. ' + val.questions + '</p>'; sl++; }); $("#marked_question_div").html(questions); $("#marked_question_modal").modal("show"); } else { } } }); }); </script> <script type="text/javascript"> $(document).ready(function() { setInterval(TimeLeft, 1000); //TimeLeft(); function TimeLeft() { var hms = $("#hms_timer").text(); if (hms < '00:10:00') { $(".blink_text").html('<h5 style="color:red;">Remaining time left is ' + hms + '</h5>'); } else { $(".blink_text").empty(); } } }); </script> <style type="text/css"> .modal-dialog { margin: 60px auto; } .instruction { cursor: pointer; } .round { width: 30px; height: 30px; border: 1px solid silver; text-align: center; line-height: 25px; border-radius: 50px; margin-top: -10px; margin-bottom: 0 !important; } .actives_round { background: #337ab7; color: white; border: 1px solid white; } .question_answer_radio { width: 100%; } pre { background-color: transparent !important; border: 1px solid transparent !important; font-size: 15px !important; } pre code { white-space: pre-line; text-align: justify; line-height: 1.8; } .question_option pre { padding: 0px; margin: 0 0 0px; font-weight: initial; } .checkbox, .radio { /*display: flex !important;*/ align-items: center !important; } @media only screen and (min-width:320px) and (max-width:640px) { .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 { position: initial !important; } } .round_final { width: 30px; height: 30px; border: 1px solid silver; text-align: center; line-height: 25px; border-radius: 50px; margin-top: -10px; margin-bottom: 0 !important; background-color: #00ff00; vertical-align: middle; } .label_mark_finals label { vertical-align: middle; } .logo-lg img { width: 52%; margin-left: 25px; } .header_links ul { padding-top: 1%; } </style>