ok

Mini Shell

Direktori : /home2/selectio/public_html/tnpsctestbatch.com/quiz/
Upload File :
Current File : /home2/selectio/public_html/tnpsctestbatch.com/quiz/current-affair-exam.php

<?php include "header.php";

if(isset($_GET['form_submit'])){
    header('location: final-exam.php'); 
	exit;
}



        
if(isset( $_SESSION['user_exam'])){
    $session_id = $_SESSION['user_exam']['id'];
}
$_COOKIE['users_id'] = "";
 $test_type = isset($_GET['exam_id']) ? $_GET['exam_id']:"";
setcookie("exam_type", $test_type, time() + 2 * 24 * 60 * 60, '/', 'tnpsctestbatch.com' );
$user_id = "";

if(isset($_SESSION['user_exam'])){
    $exam_session_id = $_SESSION['user_exam']['id'];
}else{
    $exam_session_id = $_COOKIE['users_id'];
}




if(isset($_SESSION['user_exam'])) {

	$user_id = $_SESSION['user_exam']['id'];
}
$date = date('Y-m-d');

$quiz_titile="";

if(isset($_GET['exam_id']) && $_GET['exam_id']==1){
    $quiz_titile="<span>TNPC Group 1</span>";
}else if(isset($_GET['exam_id']) && $_GET['exam_id']==2){
    $quiz_titile="<span>TNPC Group 2/2A</span>";
}else{
    $quiz_titile="<span>TNPC Group 4</span>";
}




?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>

<?php

/*    if(!isset($_SESSION['user_exam'])){
echo    '<script>
    alert("please login");
    window.location.href="../login.php";
    </script>';
}*/

?>

<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: green;
    color: white;
    font-weight: 800;

}
.wrong_number{
    padding: 17px;
    margin-top: 10px;
    background-color: red;
    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
}
.next_form{
    display:none;
}
@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>

<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_current_affairs.* FROM tbl_current_affairs WHERE 
                    tbl_current_affairs.title_id=? ORDER BY tbl_current_affairs.id DESC LIMIT 1");
            		$first_sql->execute(array($_GET['title_id']));
            		$first_result = $first_sql->fetchAll(PDO::FETCH_ASSOC);
            		$first_total=$first_sql->rowCount();
        		 // open page first working this Query End here

                $question_id = "";
                $condition = "";
                if(isset($_GET['question_id'])){
                    $condition.="AND tbl_current_affairs.id=".$_GET['question_id']; 
                    $question_id = $_GET['question_id'];
                }else{
                    $condition.= "ORDER BY tbl_current_affairs.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_current_affairs.* FROM tbl_current_affairs WHERE title_id=? ORDER BY tbl_current_affairs.id ASC LIMIT 1");
            		$question_sql->execute(array($_GET['title_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_current_affairs_result WHERE type = ? AND question_id=? AND user_id=? AND date=? ORDER BY id");
            		$skkiped_color_sql->execute(array($_GET['title_id'],$question_id,$exam_session_id,$date));
            		$skipped_color_result = $skkiped_color_sql->fetchAll(PDO::FETCH_ASSOC);
            		$skipped_color_total=$skkiped_color_sql->rowCount();
                //}
                
                    
                    
                    $skipped_sql = $pdo->prepare("SELECT * FROM tbl_current_affairs WHERE title_id=? ORDER BY id DESC ");
            		$skipped_sql->execute(array($_GET['title_id']));
            		$skipped_result = $skipped_sql->fetchAll(PDO::FETCH_ASSOC);
            		$skipped_total=$skipped_sql->rowCount();
            		
            		
                // skipped question query end here
                
                
                
              
                $progress_percentage=0;
                $statement = $pdo->prepare("SELECT *,(SELECT id FROM tbl_current_affairs WHERE id != ".$question_id." AND id < ".$question_id." ORDER BY id DESC LIMIT 1) as next_question_id FROM tbl_current_affairs WHERE title_id=? $condition");
        		$statement->execute(array($_GET['title_id']));
        		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
        		$total=$statement->rowCount();
        		$ques_total=$statement->rowCount();
        		
        		
        		$progress = 100/$skipped_total;
        		
        	
        		$payment_questions = 2;
        		$i = 1;
        		if(isset($_GET['progressbar_id'])){
        		    $i = $_GET['progressbar_id'];
        		    $progress_running = $progress * $i ;
        		    
        		    $payment_questions = $i+1 ;
        		    
        		}else{
        		    
        		    $progress_running = $progress * $i ;
        		    
        		    $payment_questions = $i+1 ;
        		
        		    
        		}
        		
        		if($total>0){
        		
        		foreach ($result as $row) {
        		    
        		    $color_query = $pdo->prepare("SELECT * FROM tbl_current_affairs_result WHERE type=? AND question_id=? AND user_id=? AND	date=? ORDER BY id DESC ");
            		$color_query->execute(array($_GET['title_id'],$row['id'],$exam_session_id,$date));
            		$color_result = $color_query->fetchAll(PDO::FETCH_ASSOC);
            		$color_total=$color_query->rowCount();
        		    
               
                
                error_log('Question  id'.$row['id']);
                
                $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 <?=$i?>/<?=$skipped_total?> </span>
                        <div class="progress rounded-pill">
                           <div class="progress-bar" role="progressbar" style="width: <?=$progress_running?>%;" aria-valuemin="0" aria-valuemax="100"></div>
                        </div>
                        <h1 class="question_title px-5 py-3 animate__animated animate__fadeInRight animate_25ms">
                           <?= nl2br($row['questions'])?> 
                          
                        </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']?>','<?=$exam_session_id?>','<?= $_GET['title_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']?>','<?=$exam_session_id?>','<?= $_GET['title_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']?>','<?=$exam_session_id?>','<?= $_GET['title_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']?>','<?=$exam_session_id?>','<?= $_GET['title_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>
                       
                        <!---------- Form Button Start ---------->
                       <div class="form_btn py-5 text-center next_form">

                          <br>
                          <?php if($question_result[0]['id']==$_GET['question_id']){ ?>
                            <center style="margin-top: 2%;">
                            <form method="get" action="">
                                <button type="submit" name="form_submit" value="1" class="f_btn active text-uppercase rounded-pill text-white" style="color: red;" >Submit</button>
                            </form>
                            </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="current-affair-exam.php?title_id=<?=$_GET['title_id']?>&&question_id=<?=$row['next_question_id'] ?>" 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 ---------->
                       
                        <div id="view_expain_<?=$row['id']?>">
                           
                       </div>
                        <div class="collapse" id="collapseExample_<?=$row['id']?>" style="margin-left: -7%;">
                            <div class="card card-body">
                                <div class="container">
                                    
                                    
                                    <div class="row">
                                        <div class="col-md-12">
                                            <div style="display: flex;justify-content: center;">
                                                <?php if($row["video_link"]!=""){ ?>
                                                   <iframe class="embed-responsive-item" src="<?=$row["video_link"]?>" allowfullscreen style="width: 70%;height: 287px;"></iframe>
                                                <?php } if($row["image"]!="") { ?>
                                                    
                                                     <img src="../admin/<?=$row['image']?>" alt="Upload the image" class="img-thumbnail">
                                                <?php   } ?>
                                            </div>
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="row">
                                        <div class="col-md-12">
                                             <center> <?php if(isset($row['image_name']) && $row['image_name'] !="") { echo nl2br($row['image_name']) ; }?> </center>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12">
                                            
                                            <?php if(isset($row['explanation']) && $row['explanation'] !="") { echo nl2br($row['explanation']) ; }?>

                                        </div>
                                    </div>
                                </div>
                                
                            </div>
                        </div>
                    </div>

                 
                 
                   <!-- This is form Sunbmit UI-->

                  
                        <!---------- Form Button Start ---------->
                       <div class="form_btn py-5 text-center next_form2">

                          <br>
                          <?php if($question_result[0]['id']==$question_id){ ?>
                            <center style="margin-top: 2%;">
                            <form method="get" action="">
                                <button type="submit" name="form_submit" value="1" class="f_btn active text-uppercase rounded-pill text-white" style="color: red;" >Submit</button>
                            </form>
                            </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="current-affair-exam.php?title_id=<?=$_GET['title_id']?>&&question_id=<?=$row['next_question_id'] ?>&&progressbar_id=<?=$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 
                                    $user_name="";
                                    $first_letter="";
                                    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>
                                    
                                    
                                     <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
                    
                    error_log("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=".$row['id']." ORDER BY tbl_mock_test_comment.id DESC");
                       
                    $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>&nbsp; <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 display">
            <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_current_affairs_result WHERE type=? AND question_id=? AND user_id=? AND date=? ORDER BY id DESC ");
                    		$result_query->execute(array($_GET['title_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="current-affair-exam.php?title_id=<?=$_GET['title_id']?>&&question_id=<?=$skipped_result[$ri]['id']?>&&progressbar_id=<?=$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++;
                        
                        } ?>
                       
                    </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>
                        <td style="padding-left: 13px;"><span class="badge bg-secondary" style="background-color: red !important; color: red;">4</span> Wrong </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: green !important; color: green;">4</span> Correct </td>
                    </tr>
                </table>
            </div>
           
       </div>
    </div>
</div>


<style>
    .disabled_ans{
        pointer-events:none;
        opacity:0.7;
    }
</style>
<?php include "footer.php";?>


<script>

    function finalSubmitss(){
        alert("Ajay...");
        // location.replace("https://www.w3schools.com");
        
    }
    
</script>

<script>
$(function(){
     // ========== Form-select-option ========== //
  $(".step_1").on('click', function(){
    $(".step_1").removeClass("active");
    $(this).addClass("active");
  });
  $(".step_2").on('click', function(){
    $(".step_2").removeClass("active");
    $(this).addClass("active");
  });
  $(".step_3").on('click', function(){
    $(".step_3").removeClass("active");
    $(this).addClass("active");
  });
  $(".step_4").on('click', function(){
    $(".step_4").removeClass("active");
    $(this).addClass("active");
  });
  $(".step_5").on('click', function(){
    $(".step_5").removeClass("active");
    $(this).addClass("active");
  });

    // ================== CountDown function ================
  $('.countdown_timer').each(function(){
    $('[data-countdown]').each(function() {
      var $this = $(this), finalDate = $(this).data('countdown');
      $this.countdown(finalDate, function(event) {
        var $this = $(this).html(event.strftime(''
        + '<h3>30</h3>'
        + '<span class="text-uppercase">sec</span>'));
      });
    });
  });

});


var currentTab = 0; // Current tab is set to be the first tab (0)
showTab(currentTab); // Display the current tab

function showTab(n) {
    // This function will display the specified tab of the form ...
    var x = document.getElementsByClassName("multisteps_form_panel");
    x[n].style.display = "block";
    // ... and fix the Previous/Next buttons:
    if (n == 0) {
        document.getElementById("prevBtn").style.display = "none";
    } else {
        document.getElementById("prevBtn").style.display = "inline";
    }
    if (n == (x.length - 1)) {
        document.getElementById("nextBtn").innerHTML = "Submit";
    } else {
        document.getElementById("nextBtn").innerHTML = "Next Question" + ' <span><i class="fas fa-arrow-right"></i></span>';
    }
    // ... and run a function that displays the correct step indicator:
    fixStepIndicator(n)
}

function nextPrev(n) {
    // This function will figure out which tab to display
    var x = document.getElementsByClassName("multisteps_form_panel");
    // Exit the function if any field in the current tab is invalid:
    if (n == 1 && !validateForm()) return false;
    // Hide the current tab:
    x[currentTab].style.display = "none";
    // Increase or decrease the current tab by 1:
    currentTab = currentTab + n;
    // if you have reached the end of the form... :
    if (currentTab >= x.length) {
        //...the form gets submitted:
        document.getElementById("wizard").submit();
        return false;
    }
    // Otherwise, display the correct tab:
    showTab(currentTab);
}


function nextPrevSubjects(n, question_id) {
  
  
    var x = document.getElementsByClassName("multisteps_form_panel");
    
     if (n == "" && !validateForm()) return false;
    
    // if (n == 1 && !validateForm()) return false;
   
  
    x[currentTab].style.display = "none";
    
    currentTab = currentTab + n;
    
    
    if (currentTab >= x.length) {
        document.getElementById("wizard").submit();
        return false;
    }
    
    
    
    var question_id = $("#question_id_"+question_id).val();
   
    showTabSubjects(currentTab, question_id);
    
}

function showTabSubjects(n, question_id) {
    // This function will display the specified tab of the form ...
    var x = document.getElementsByClassName("multisteps_form_panel");
    x[n].style.display = "block";
    // ... and fix the Previous/Next buttons:
    if (n == 0) {
        document.getElementById("prevBtn").style.display = "none";
    } else {
        document.getElementById("prevBtn").style.display = "inline";
    }
    if (n == (x.length - 1)) {
        document.getElementById("nextBtn").innerHTML = "Submit";
        $("#nextBtn").hide();
        // var submit = `<center style="margin-top: 2%;">
        //                 <button type="submit" class="f_btn active text-uppercase rounded-pill text-white" style="color: red;" onclick="finalSubmits()">Submit</button>
        //               </center>`;
        $("#submit_section").append(submit);
    } else {
        document.getElementById("nextBtn").innerHTML = "Next Question" + ' <span><i class="fas fa-arrow-right"></i></span>';
    }
    // ... and run a function that displays the correct step indicator:
    fixStepIndicator(n, question_id)
}

function validateForm() {
    // This function deals with validation of the form fields
    var x, y, i, valid = true;
    x = document.getElementsByClassName("multisteps_form_panel");
    y = x[currentTab].getElementsByTagName("input");
    // A loop that checks every input field in the current tab:
    for (i = 0; i < y.length; i++) {
        // If a field is empty...
        if (y[i].value == "") {
            // add an "invalid" class to the field:
            y[i].className += " invalid";
            // and set the current valid status to false:
            valid = false;
        }
    }
    // If the valid status is true, mark the step as finished and valid:
    if (valid) {
        document.getElementsByClassName("step")[currentTab].className += " finish";
    }
    return valid; // return the valid status
}

function fixStepIndicator(n, question_id) {
    // This function removes the "active" class of all steps...
    var i, x = document.getElementsByClassName("step");
    for (i = 0; i < x.length; i++) {
        x[i].className = x[i].className.replace(" active", "");
    }
    //... and adds the "active" class to the current step:
    x[n].className += " active";
}

function new_Quizes(question_id){
    alert(question_id);
   $("#" + question_id).addClass("active");
   $("#" + question_id).css("display", "block !important");
}
</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 ch(answer,id,user_id,test_type){
       
        var chs='answer_class_'+id;    
        $("."+chs).addClass('disabled_ans');
        
        $.ajax({
                url: '../api/get-current-affair-result.php',
                type: 'post',
                dataType: 'json',
                data: {type:'get_current_affair_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?current-affair=1';
                    }
                    
                    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","red");
                        $('#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","green");
                            $('#colour'+id).css("color","white");
                        }else{
                            $('#colour'+id).css("background","red");
                            $('#colour'+id).css("color","white");
                        }
                        
                        console.log('colour'+id);
                    }
                    else{
                        $('#view_expain_'+id).empty();
                        $('#answer_'+id+'_'+response['correct_ans']).css("background","#06b206");
                        $('#answer_'+id+'_'+response['correct_ans']).css("color","white");
                    
                        
                    }
                }
            });
    }

</script>

<!--Comment options Start Here-->



<script>

<?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 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  } ?>
    
    
   
}

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 deletecommet(id){
    
   var question_id =  $("#question_id").val();
        
        $("#comment_list_"+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 commentlist(question_id){
    
        $("#ques_id").text(question_id);
        $("#comment_list").empty();
        $("#comment_list_"+question_id).empty();
        $.ajax({
                url: "../api/comment.php",
                type: "post", 
                data: {type:"questions_with_comment", question_id:question_id,exam_type:"3"},
                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"]);
                    //  }
                }
            });
    }


 $('#subject_questions').on('submit', function(e){
            e.preventDefault();
            $('#loading-div').show();
            $('#content-div').hide();
            var formData = new FormData(this);
            formData.append('type', 'add_c_title');
                $.ajax({
                url: 'add-api/add-question-form.php',
                type: 'post',
                dataType: 'json',
                data: formData,
                cache: false,
                contentType: false,
                processData: false,
                enctype: 'multipart/form-data',
                success: function (response) {
                    if(response['status']==200){
                        alert(response['message']);
                        $("#add_shifts .close").click();
                        $('#shift_add_form').trigger("reset");
                        emp_datas();
                        $('#loading-div').hide();
                        $('#content-div').show();
                    }else{
                        alert(response['message']);
                        $('#loading-div').hide();
                        $('#content-div').show();
                    }
                    
                   
                }
            });
                
    });
</script>



<!--Comment options End Here-->



<script>

    
function quizPosition(position){
   
     console.log('pos'+position);
    var j=<?=$ques_total?>;
    for(var k=1;k<=j;k++){
        $('#subject_questions_'+k).hide();
    }
    $('#subject_questions_'+position).show();
    showTab(position);
}

</script>






Zerion Mini Shell 1.0