ok
Direktori : /home2/selectio/public_html/tnpsctestbatch.com/quiz/ |
Current File : /home2/selectio/public_html/tnpsctestbatch.com/quiz/mock-exam.php |
<?php include "header.php"; if(isset($_SESSION['user_exam'])){ $session_id = $_SESSION['user_exam']['id']; } $payment_questions ="2"; if(isset($_GET['payment_questions'])){ $payment_questions = $_GET['payment_questions']; $payment_questions = $payment_questions+1 ; } else{ if(isset($_GET['payments_ids'])){ $payment_questions = $_GET['payments_ids']; $payment_questions = $payment_questions+1 ; } } ?> <style> .form_header_content h2 { font-size: 1.8125rem; background: -webkit-linear-gradient(#36d0dc, #5a87e5); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; } .count_box { display: none !important; } .img-thumbnail { padding: 0.25rem; background-color: #fff; border: 1px solid #dee2e6; border-radius: 0.25rem; max-width: 100%; height: 332px; width: auto; } .multisteps_form { width:100%; border-radius: 20px; background-image:none; background-color: #011f41; min-height: auto; } h1 { color: white; font-size: 24px; } .form_items li { width: 100%; color: #000a38; font-size: 1.3125rem; padding: 10px; background-color: #fbfbfb; margin-top: 1.25rem; cursor: pointer; -webkit-transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out; } .form_items li:after { display:none; content: ""; width: 1.875rem; height: 1.875rem; top: 50%; left: 14px; -webkit-transform: translateY(-50%); transform: translateY(-50%); position: absolute; border-radius: 100%; border: 2px solid #e2e2e2; background: -webkit-gradient(linear, left top, left bottom, from(#38cedc), to(#5784dd)); background: linear-gradient(#38cedc, #5784dd); } .form_items li label { margin-left: -46px; cursor: pointer; line-height: 20px; } .form_items li.active:before { display: none; } .skippedquiz{ position: absolute; top: 32%; left: 85%; transform: translate(-50%, -50%); width: 285px; height: auto; background-color: white; border-radius: 10px; box-shadow: 0 7px 30px rgba(62, 9, 11, .3); } .skipped_number{ padding: 17px; margin-top: 10px; background-color: orange; color: white; font-weight: 800; } .right_number{ padding: 17px; margin-top: 10px; background-color: blue; color: white; font-weight: 800; } .wrong_number{ padding: 17px; margin-top: 10px; background-color: blue; color: white; font-weight: 800; } .default_number{ padding: 17px; margin-top: 10px; background-color: black; color: white; font-weight: 800; } .comment-text-sm{ color:white; } .bg-white{ background-color: black !important; } .commented-user{ color:white; } .mt-2 { padding-left: 29px; padding-top: 14px padding-bottom: 14px } </style> <style> @media (max-width: 576px){ form#subject_questions_1 { /*padding-top: 250px;*/ } form#subject_questions_1 { margin-top: -20px !important; } .skippedquiz { position: absolute; top: 74%; left: 50%; transform: translate(-50%, -50%); width: 285px; height: auto; background-color: white; border-radius: 10px; box-shadow: 0 7px 30px rgba(62, 9, 11, .3); } .question_number { color: #ffffff; font-size: 1.0625rem; font-weight: 700; margin-right: 8.176rem; } h1.question_title.px-5.py-3.animate__animated.animate__fadeInRight.animate_25ms { text-align: left; } .col-md-1 { width: 20% !important; } .col-md-11 { width: 80%; padding-left: 30px; text-align: justify !important; } .d-flex.flex-column.col-md-12 { margin-top: 80%; } a.f_btn.active.text-uppercase.rounded-pill.text-white { font-size: 18px; } .form_btn.py-5.text-center { padding-top: 20px !important; padding-bottom: 0px !important; } .collapse.show { margin-bottom: 200px !important; padding-bottom: 0px !important; } .next_form{ display:inline-block; } .next_form2{ display:none; } .form_btn.py-5.text-center.next_form { padding-top: 0px !important; padding-bottom: 10px !important; width: 90%; font-size: 10px; } /*.form_items li label {*/ /* margin-left: 0px;*/ /*}*/ h1.question_title.px-5.py-3.animate__animated.animate__fadeInRight.animate_25ms { padding: 0px !important; padding-left: 10px !important; font-size: 20px; line-height: 25px; } .form_items.ps-5 { padding-left: 10px !important; } .col-md-11 { width: 80%; padding-left: 20px; text-align: left !important; } li.animate__animated.animate__fadeInRight { width: 120%; padding-left: 50px !important; } .tcenter { text-align: center !important; } a.btn.btn-primary { margin-left: 120px; margin-bottom: 20px; } } </style> <?php $test_type = $_GET['exam_id']; setcookie("exam_type", $test_type, time() + 2 * 24 * 60 * 60, '/', 'tnpsctestbatch.com' ); $user_id = ""; $exam_session_id=""; if(isset($_SESSION['user_exam'])){ $exam_session_id = $_SESSION['user_exam']['id']; }else{ if(isset($_COOKIE['users_id'])){ $exam_session_id = $_COOKIE['users_id']; } } if(isset($_SESSION['user_exam'])) { /* echo ("<script LANGUAGE='JavaScript'> window.alert('Please Login'); window.location.href='https://tnpsctestbatch.com/login.php'; </script>"); exit;*/ $user_id = $_SESSION['user_exam']['id']; } $date = date('Y-m-d'); $quiz_titile=""; if($_GET['exam_id']==1){ $quiz_titile="<span>TNPC Group 1</span>"; }else if($_GET['exam_id']==2){ $quiz_titile="<span>TNPC Group 2/2A</span>"; }else{ $quiz_titile="<span>TNPC Group 4</span>"; } ?> <div class="container"> <div class="row"> <div class="col-md-9" > <?php // open page first working this Query start here $first_sql = $pdo->prepare("SELECT tbl_mock_test.* FROM tbl_mock_test WHERE tbl_mock_test.mock_test_type=? ORDER BY tbl_mock_test.id DESC LIMIT 1"); $first_sql->execute(array($_GET['exam_id'])); $first_result = $first_sql->fetchAll(PDO::FETCH_ASSOC); $first_total=$first_sql->rowCount(); // open page first working this Query End here if($first_total == 0){ echo '<h1 class="question_title px-5 py-3 animate__animated animate__fadeInRight animate_25ms"> No Questions Please Choose another Test Batch Series </h1>'; exit(); } $condition = ""; if(isset($_GET['question_id'])){ $condition.="AND tbl_mock_test.id=".$_GET['question_id']; $question_id = $_GET['question_id']; }else{ $condition.= "ORDER BY tbl_mock_test.id desc LIMIT 1"; $question_id = $first_result[0]['id']; } $progress_percentage=0; // last submit button query start here $question_sql = $pdo->prepare("SELECT tbl_mock_test.*,tbl_mock_test_result.question_id FROM tbl_mock_test LEFT JOIN tbl_mock_test_result ON tbl_mock_test.id = tbl_mock_test_result.question_id and tbl_mock_test_result.user_id=? and tbl_mock_test_result.date=? WHERE tbl_mock_test_result.question_id IS NULL AND tbl_mock_test.mock_test_type=? ORDER BY tbl_mock_test.id ASC LIMIT 1"); $question_sql->execute(array($exam_session_id, $date ,$_GET['exam_id'])); $question_result = $question_sql->fetchAll(PDO::FETCH_ASSOC); $question_total=$question_sql->rowCount(); // last submit button query End here // skipped question query start here //if(isset($_GET['question_id'])){ $skipped_color_total=1; $skkiped_color_sql = $pdo->prepare("SELECT * FROM tbl_mock_test_result WHERE question_id=? and user_id=? ORDER BY id"); $skkiped_color_sql->execute(array($question_id,$exam_session_id)); $skipped_color_result = $skkiped_color_sql->fetchAll(PDO::FETCH_ASSOC); $skipped_color_total=$skkiped_color_sql->rowCount(); //} $skipped_sql = $pdo->prepare("SELECT * FROM tbl_mock_test WHERE mock_test_type=? ORDER BY id DESC "); $skipped_sql->execute(array($_GET['exam_id'])); $skipped_result = $skipped_sql->fetchAll(PDO::FETCH_ASSOC); $skipped_total=$skipped_sql->rowCount(); // skipped question query end here // list questions start here $statement = $pdo->prepare("SELECT (SELECT id FROM tbl_mock_test WHERE id != ".$question_id." AND id < ".$question_id." ORDER BY id DESC LIMIT 1) as next_question_id, tbl_mock_test.*, tbl_mock_test_result.question_id FROM tbl_mock_test LEFT JOIN tbl_mock_test_result ON tbl_mock_test.id = tbl_mock_test_result.question_id and tbl_mock_test_result.user_id=? and tbl_mock_test_result.date=? WHERE tbl_mock_test.mock_test_type=? $condition"); $statement->execute(array($exam_session_id, $date, $_GET['exam_id'])); $result = $statement->fetchAll(PDO::FETCH_ASSOC); $total=$statement->rowCount(); $ques_total=$statement->rowCount(); // list question end here $iS=''; if(isset($_GET['payment_questions'])){ $progress = 100/$skipped_total; $iS = $_GET['payment_questions']; $progress_bar_status = $progress * $iS; }else{ $iS=1; $progress = 100/$skipped_total; $progress_bar_status = $progress * $iS; } if($total>0){ foreach ($result as $row) { $color_query = $pdo->prepare("SELECT * FROM tbl_mock_test_result WHERE type=? AND question_id=? AND user_id=? AND date=? ORDER BY id DESC "); $color_query->execute(array($_GET['exam_id'],$row['id'],$exam_session_id,$date)); $color_result = $color_query->fetchAll(PDO::FETCH_ASSOC); $color_total=$color_query->rowCount(); $progress_percentage+=$progress; ?> <form class="position-relative overflow-hidden mt-5" id="subject_questions_<?=$i?>"> <div class="multisteps_form_panel step" > <div class="multisteps_form"> <!-- Form-content --> <input type="hidden" id="color_question_id" value="<?=$color_result[0]['question_id'] ?>"> <input type="hidden" id="color_user_id" value="<?=$exam_session_id?>"> <input type="hidden" id="color_answer_id" value="<?=$color_result[0]['select_option'] ?>"> <input type="hidden" id="color_type_id" value="<?=$color_result[0]['type'] ?>"> <span class="question_number text-uppercase mb-3 float-end">QUESTION <?=$iS?>/<?=$skipped_total?> </span> <div class="progress rounded-pill"> <div class="progress-bar" role="progressbar" style="width: <?=$progress_bar_status?>%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> </div> <h1 class="question_title px-5 py-3 animate__animated animate__fadeInRight animate_25ms"> <?= nl2br($row['question'])?> </h1> </div> <!-- Form-items --> <div class="form_items ps-5"> <ul class="list-unstyled p-0"> <div class="container"> <div class="row"> <div class="col-md-1"> <li style="background-color: #011f41;"> <label style="padding-left: 12px; color:white;" for="opt_1">A.</label> </li> </div> <div class="col-md-11"> <li class="step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_50ms answer_class_<?=$row['id']?>" id="answer_<?=$row['id']?>_A" onclick="ch('A','<?=$row['id']?>','<?=$user_id?>','<?= $_GET['exam_id'] ?>');" style="margin-left: -55px;"> <input type="radio" name="stp_1_select_option" value="<?=$row['option_a']?>" class="check"> <label for="opt_1"><?=$row['option_a']?></label> </li> </div> </div> <div class="row"> <div class="col-md-1"> <li style="background-color: #011f41;"> <label style="padding-left: 12px; color:white;" for="opt_1">B.</label> </li> </div> <div class="col-md-11"> <li class="step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_100ms answer_class_<?=$row['id']?>" id="answer_<?=$row['id']?>_B" onclick="ch('B','<?=$row['id']?>','<?=$user_id?>','<?= $_GET['exam_id'] ?>');" style="margin-left: -55px;"> <input type="radio" name="stp_1_select_option" value="<?=$row['option_b']?>" class="check"> <label for="opt_2"><?=$row['option_b']?></label> </li> </div> </div> <div class="row"> <div class="col-md-1"> <li style="background-color: #011f41;"> <label style="padding-left: 12px; color:white;" for="opt_1">C.</label> </li> </div> <div class="col-md-11"> <li class="step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_150ms answer_class_<?=$row['id']?>" id="answer_<?=$row['id']?>_C" onclick="ch('C','<?=$row['id']?>','<?=$user_id?>','<?= $_GET['exam_id'] ?>');" style="margin-left: -55px;"> <input type="radio" name="stp_1_select_option" value="<?=$row['option_c']?>" class="check"> <label for="opt_3"><?=$row['option_c']?></label> </li> </div> </div> <div class="row"> <div class="col-md-1"> <li style="background-color: #011f41;"> <label style="padding-left: 12px; color:white;" for="opt_1">D.</label> </li> </div> <div class="col-md-11"> <li class="step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_200ms answer_class_<?=$row['id']?>" id="answer_<?=$row['id']?>_D" onclick="ch('D','<?=$row['id']?>','<?=$user_id?>','<?= $_GET['exam_id'] ?>');" style="margin-left: -55px;"> <input type="radio" name="stp_1_select_option" value="<?=$row['option_d']?>" class="check"> <label for="opt_4"><?=$row['option_d']?></label> </li> </div> </div> </div> </ul> </div> <!-- This is form Sunbmit UI--> <!---------- Form Button Start ----------> <div class="form_btn py-5 text-center"> <br> <?php if($question_result[0]['id']==$question_id){ ?> <center style="margin-top: 2%;"> <a type="submit" href="https://tnpsctestbatch.com/mock-test-final-result.php?exam_ids=<?=$_GET['exam_id'] ?>" class="f_btn active text-uppercase rounded-pill text-white" style="color: red;" onclick="finalSubmit()">Submit</a> </center> <?php }else { ?> <button type="button" class="f_btn disable text-uppercase rounded-pill text-white" id="prevBtn" onclick="nextPrevSubjects(-1)"><span><i class="fas fa-arrow-left"></i></span> Last Question</button> <a href="mock-exam.php?exam_id=<?=$_GET['exam_id']?>&&question_id=<?=$row['next_question_id'] ?>&&payments_ids=<?= $payment_questions ?>&&payment_questions=<?= $payment_questions ?>" style="background: #0d6efd;" class="f_btn active text-uppercase rounded-pill text-white" >Next Questions <i class="fas fa-arrow-right"></i></a> <?php } ?> </div> <!---------- Form Button End ----------> <!-- Comment option Start here--> <div class="mb-5"> <div class="d-flex row" > <div class="d-flex flex-column col-md-12" > <div class="d-flex flex-row align-items-center text-left comment-top p-2 bg-white border-bottom px-4"> <h1 style="font-size: 25px; color:white;"> Comments </h1> </div> <div class="coment-bottom bg-white p-2 px-4"> <div class="d-flex flex-row add-comment-section mt-4 mb-4"> <?php if(isset($_SESSION['user_exam'])){ $user_name = $_SESSION['user_exam']['name']; $first_letter = $user_name[0]; ?> <span style="display: flex;background-color: blue;border-radius: 50%;font-size: 29px;font-weight: 900;color: white;height: 50px;width: 50px;justify-content: center;"> <?= $first_letter ?> </span> <?php } ?> <input type="hidden" id="question_id" value="<?=$row['id']?>" class="form-control mr-3" placeholder="Add comment"> <input type="text" onkeyup="comment_box()" id="user_comment_<?=$row['id']?>"> <input type="hidden" id="exam_type" value="3" class="form-control mr-3" placeholder="Add comment"> <input type="hidden" id="user_id" value="<?php if(isset($_SESSION['user_exam'])){ echo $_SESSION['user_exam']['id']; } ?> "> <span class="btn btn-primary" onclick="commentBtn(<?=$row['id']?>)" >Comment</span> </div> <span id="comment_error" ></span> <div id="comment_list_<?=$row['id']?>"> <?php $comment_sql = $pdo->prepare("SELECT tbl_mock_test_comment.*,tbl_mock_test_comment.id AS comment_id,tbl_students.* FROM tbl_mock_test_comment INNER JOIN tbl_students ON tbl_mock_test_comment.user_id = tbl_students.id WHERE tbl_mock_test_comment.exam_type=3 AND tbl_mock_test_comment.status=1 and tbl_mock_test_comment.question_id=? ORDER BY tbl_mock_test_comment.id DESC"); $comment_sql->execute(array($row['id'])); $comment_result = $comment_sql->fetchAll(PDO::FETCH_ASSOC); $comment_total=$comment_sql->rowCount(); if($comment_total>0){ foreach($comment_result as $comment_datas){ $comment_datas['created_at']; $comment_name =$comment_datas['name']; $first_letters = $comment_name[0]; echo '<div class="commented-section mt-2" style="border: 1px solid black;"> <div class="d-flex flex-row align-items-center commented-user"> <span style="width: 25px;height: 25px;margin-top: -16px;background-color: blue;justify-content: center;display: flex;border-radius: 50%;padding-top: 1px;font-size: 15px; padding-left: 1px;font-weight: 900;">'.$first_letters.'</span> <p style="font-size: 13px;" class="mr-2">'.$comment_datas["name"] . ' </p><span class="dot mb-1"></span><span class="mb-1 ml-2" style="margin-left: 10px;margin-left: 10px;margin-top: -11px;font-size: 13px;"> '.date('d-m-Y', strtotime($comment_datas["created_at"])).'</span></div> <div class="comment-text-sm" style="display: flex;margin-top: -18px;margin-left: 32px;font-size: 21px;"><span>'.$comment_datas["comment"] . '</span></div>'; if(isset($session_id) && $session_id==$comment_datas['user_id']){ echo '<span style="padding: 3px;font-size: 12px;margin-bottom: 10px;background-color: black;border: red;" title="Delete Comments" class="btn btn-primary btn-xs active" onclick="deletecommet('.$comment_datas["comment_id"] .')"> <i class="bi bi-trash"></i> </span> '; } echo '</div>'; } }else{ echo '<span> No Comments </span>'; } ?> </div> <div id="ques_id"></div> </div> </div> </div> </div> <!-- Comment option End here--> </div> </form> <?php } }else{ echo '<span style="color:white;"> No Data Founds </span>'; } ?> </div> <div class="col-md-3"> <div class="skippedquiz"> <h4 style="margin-left: 22px;margin-top: 11px;">Questions</h4> <ul class="list-unstyled p-0" style="overflow-y: scroll;max-height: 347px;"> <li class="step_1 ps-5 rounded-pill animate__animated animate__fadeInRight animate_200ms" style="margin-left: -23px;"> <?php $ri=0; for($rd=1;$rd<=$skipped_total;$rd++){ $result_query = $pdo->prepare("SELECT * FROM tbl_mock_test_result WHERE type=? AND question_id=? AND user_id=? AND date=? ORDER BY id DESC "); $result_query->execute(array($_GET['exam_id'],$skipped_result[$ri]['id'],$exam_session_id,$date)); $result_result = $result_query->fetchAll(PDO::FETCH_ASSOC); $result_total=$result_query->rowCount(); if($result_total>0){ if($result_result[0]['select_option']==$skipped_result[$ri]['correct_answer']){ $style = 'class="right_number"'; $question_title = 'title="Answered Correctly"'; }else{ $style = 'class="wrong_number"'; $question_title = 'title="Answered Wrongly"'; } } else if($skipped_color_total ==0 && $question_id<$skipped_result[$ri]['id']){ $style = 'class="skipped_number"'; $question_title = 'title="Skipped Question"'; } else{ $style = 'class="default_number"'; $question_title = 'title="Question Not Responded"'; } ?> <a href="mock-exam.php?exam_id=<?=$_GET['exam_id']?>&&question_id=<?=$skipped_result[$ri]['id']?>&&payment_questions=<?=$rd?>" ><label id="colour<?=$skipped_result[$ri]['id']?>" <?= $style; $question_title; ?> onclick="quizPosition(<?=$rd?>)" ><?=str_pad($rd,2,"0",STR_PAD_LEFT)?></label></a> <?php $ri++; } ?> <!--<label title="Skipped Question" class="skipped_number" for="opt_4">02</label> <label title="Skipped Question" class="skipped_number" for="opt_4">03</label> <label title="Answered Correctly"class="right_number" for="opt_4">04</label> <label title="Question Not Responded" class="default_number" for="opt_4">05</label> <label title="Answered Correctly"class="right_number" for="opt_4">06</label> <label title="Question Not Responded" class="default_number" for="opt_4">07</label> <label title="Answered Correctly"class="right_number" for="opt_4">08</label> <label title="Skipped Question" class="skipped_number" for="opt_4">09</label> <label title="Skipped Question" class="skipped_number" for="opt_4">10</label> <label title="Skipped Question" class="skipped_number" for="opt_4">11</label> <label title="Skipped Question" class="skipped_number" for="opt_4">12</label> <label title="Skipped Question" class="skipped_number" for="opt_4">13</label> <label title="Question Not Responded" class="default_number" for="opt_4">14</label> <label title="Answered Correctly"class="right_number" for="opt_4">15</label> <label title="Answered Wrongly" class="wrong_number" for="opt_4">16</label> <label title="Answered Wrongly" class="wrong_number" for="opt_4">17</label> <label title="Answered Wrongly" class="wrong_number" for="opt_4">18</label> <label title="Skipped Question" class="skipped_number" for="opt_4">19</label> <label title="Question Not Responded" class="default_number" for="opt_4">20</label> <label title="Answered Correctly"class="right_number" for="opt_4">21</label> <label title="Answered Correctly"class="right_number" for="opt_4">22</label> <label title="Answered Correctly"class="right_number" for="opt_4">23</label> <label title="Answered Correctly"class="right_number" for="opt_4">24</label> <label title="Skipped Question" class="skipped_number" for="opt_4">25</label> <label title="Skipped Question" class="skipped_number" for="opt_4">26</label>--> </li> </ul> <table style="margin-left: 19px;margin-bottom: 11px;"> <tr> <td><span class="badge bg-secondary" style="background-color: orange !important; color: orange;">4</span> Skipped</td> </tr> <tr> <td><span class="badge bg-secondary" style="background-color: black !important; color: black;" >4</span> Not Responded</td> <td style="padding-left: 13px;"><span class="badge bg-secondary" style="background-color: blue !important; color: blue;">4</span> attened </td> </tr> </table> </div> </div> </div> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.js"></script>--> <script> $(document).ready(function(){ <?php if(isset($_GET['question_id'])){ ?> checkingcolor(); <?php } ?> }); function checkingcolor(){ var answer = $("#color_answer_id").val(); var id = $("#color_question_id").val(); var user_id = $("#color_user_id").val(); var test_type = $("#color_type_id").val(); ch(answer,id,user_id,test_type); } function comment_box(){ <?php if(isset($_SESSION['user_exam'])){ }else{?> comment = $("#user_comment").val(); if(comment==""){ $("#comment_error").empty(); }else{ $("#comment_error").empty(); $("#comment_error").append("<a style='color:red;' href='../login.php'> Click Here to Login </a>"); } <?php } ?> } <?php $comment_script = ' var exam_type = $("#exam_type").val(); var user_id = $("#user_id").val(); $.ajax({ url: "../api/comment.php", type: "post", dataType: "json", data: {type:"comment",exam_type:exam_type,user_commet,user_commet,user_id:user_id,questions_id:question_id}, success: function (response) { console.log(response); if(response["status"]=="100"){ var n = ""; $("#user_comment_"+question_id).val(n); commentlist(question_id); }else{ alert(response["message"]); } } });'; ?> function ch(answer,id,user_id,test_type){ var chs='answer_class_'+id; $("."+chs).addClass('disabled_ans'); $.ajax({ url: '../api/get-mock-result-api.php', type: 'post', dataType: 'json', data: {type:'get_mock_question_res',answer:answer,user_id:user_id,id:id,test_type:test_type}, success: function (response) { console.log(response); if(response['total_mock']>=3){ window.alert('Please Login'); window.location.href='https://tnpsctestbatch.com/login.php'; } if(response['error']){ var btn=`<p> <button class="btn btn-primary" id="view_btn_`+id+`" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample_`+id+`" aria-expanded="false" aria-controls="collapseExample"> View Explanation </button> </p>`; $('#view_expain_'+id).append(btn); $('#answer_'+id+'_'+answer).css("background","blue"); $('#answer_'+id+'_'+answer).css("color","white"); // $('#answer_'+id+'_'+response['correct_ans']).css("background","#06b206"); // $('#answer_'+id+'_'+response['correct_ans']).css("color","white"); $('#view_btn_'+id).click(); if(answer == response['correct_ans']){ $('#colour'+id).css("background","blue"); $('#colour'+id).css("color","white"); }else{ $('#colour'+id).css("background","blue"); $('#colour'+id).css("color","white"); } // colur_orange(id,0) }else{ // console.log('else part'); // $('#view_expain_'+id).empty(); // $('#answer_'+id+'_'+response['correct_ans']).css("background","green"); // $('#answer_'+id+'_'+response['correct_ans']).css("color","white"); } } }); } function commentBtn(question_id){ var user_commet = $("#user_comment_"+question_id).val(); if(user_commet!=""){ <?php if(isset($_SESSION['user_exam'])){ echo $comment_script; }else{ echo 'window.alert("Please Login"); window.location.href="https://tnpsctestbatch.com/login.php";'; } ?> } } function commentlist(question_id){ $("#ques_id").text(question_id) $("#comment_list").empty(); $("#comment_list_"+question_id).empty(); $.ajax({ url: "../api/comment.php", type: "post", /*dataType: "json",*/ data: {type:"questions_with_comment", question_id:question_id}, success: function (response) { $("#comment_list_"+question_id).append(response); console.log("Musthafa: "+response["comments_list"]); if(response["comments_list"]){ $("#comment_list").append(response["comments_list"]); } } }); } function deletecommet(id, question_id){ $("#comment_list_"+question_id).empty(); $.ajax({ url: "../api/comment.php", type: "post", dataType: "json", data: {type:"delete_commet",id:id}, success: function (response) { console.log(response); if(response["status"]=="100"){ commentlist(question_id); }else{ alert(response["message"]); } } }); } /*function editcommet(id){ alert("Edit id " +id); $("#comment_list").empty(); $.ajax({ url: "../api/comment.php", type: "post", dataType: "json", data: {type:"fetch_comments"}, success: function (response) { console.log(response["comments_list"]); if(response["comments_list"]){ $("#comment_list").append(response["comments_list"]); } } }); }*/ </script> <style> .disabled_ans{ pointer-events:none; opacity:0.7; } </style> <?php include "footer.php";?>