<?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php"); ?>
<?php
             $branch=$_SESSION['branch'];
             $class_id=$_REQUEST['class_id'];
             $subject_id=$_REQUEST['subject_id'];
            

            $testdetailId=$_GET['subject_detail_id'];
            $query = "SELECT * FROM eduportal_create_test as test, eduportal_LMS_test_subject_details as detail where test.branch_id='$branch' and detail.subject_detail_id='$testdetailId'";

          $tstdata = $m->query($query);

          $sql2 = "SELECT * FROM eduportal_subject_config WHERE subject_id='$subject_id'";
          //print_r($sql2);
          $subject = $m->query($sql2);

                $number=$tstdata[0]['number_of_questions'];
                $test_id=$tstdata[0]['test_id'];
              
          $sql = "SELECT * FROM  eduportal_mcq_question_pool as pool, eduportal_insert_manual_question as manual  WHERE pool.branch_id=manual.branch_id and pool.class_id=manual.class_id and pool.subject_id=manual.subject_id and pool.question_id=manual.question_id and manual.test_id='$test_id' limit $number";

            $WorkAssignListings = $m->query($sql);
     ?>

<!DOCTYPE html>
<html class="no-js" lang="">

<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Attempt Online Test | Eduportal</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Favicon -->
    <link rel="shortcut icon" type="image/x-icon" href="img/favicon.png">
    <!-- Normalize CSS -->
    <link rel="stylesheet" href="css1/normalize.css">
    <!-- Main CSS -->
    <link rel="stylesheet" href="css1/main.css">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="css1/bootstrap.min.css">
    <!-- Fontawesome CSS -->
    <link rel="stylesheet" href="css1/all.min.css">
    <!-- Flaticon CSS -->
    <link rel="stylesheet" href="fonts/flaticon.css">
    <!-- Animate CSS -->
    <link rel="stylesheet" href="css1/animate.min.css">
    <!-- Data Table CSS -->
    <link rel="stylesheet" href="css1/jquery.dataTables.min.css">
    <!-- Custom CSS -->
    <link rel="stylesheet" href="style.css">
    <!-- Modernize js -->
    <script src="js1/modernizr-3.6.0.min.js"></script>
     <!-- Font Awesome -->
    <link href="../vendors/vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  

    <!-- Custom Theme Style -->
    <link href="../build/css/custom.min.css" rel="stylesheet">
</head>

<!-- <script type="text/javascript">
  function timeout()
{
  var minute = Math.floor(timeLeft/60);
  var second = timeLeft%60;
  var sec = checktime(second);
  var mint = checktime(minute);
  if(timeLeft<=0) 
  {
    
    clearTimeout(tm);
    //
    /*x = document.getElementById("stopCover");
    x.style.display = "block";*/
    setTimeout(function () { document.getElementById('frmQuiz').submit()});
  //  window.location = "result_report.php";
  } else {
    document.getElementById('time').innerHTML="Remaining time: "+mint+":"+sec;
  }
  timeLeft --;
  var tm = setTimeout(function () {timeout()}, 1000);
  
} 

function checktime(msg)
{
  if(msg<10)
  {
    msg="0"+msg;
  }
  return msg;
}


function timein()
{
  var m = Math.floor(timeStart/60);
  var s = timeStart%60;
  var ss = checkin(s);
  var mm = checkin(m);
  
  document.getElementById('timer').value = mm+":"+ss;
  
  timeStart ++;
  var tt = setTimeout(function () {timein()}, 1000);
} 

function checkin(msgs)
{
  if(msgs<10)
  {
    msgs="0"+msgs;
  }
  return msgs;
}


</script> -->


<body onload="timeout(); timein();">
 
    <div id="wrapper" class="wrapper bg-ash">
        <!-- Header Menu Area Start Here -->
        <div class="navbar navbar-expand-md header-menu-one bg-light">
        <!--     <div class="nav-bar-header-one">
                <div class="header-logo">
                    <a href="index.html">
                        <img src="img/logo.png" alt="logo">
                    </a>
                </div>
                  <div class="toggle-button sidebar-toggle">
                    <button type="button" class="item-link">
                        <span class="btn-icon-wrap">
                            <span></span>
                            <span></span>
                            <span></span>
                        </span>
                    </button>
                </div>
            </div> -->
            <div class="d-md-none mobile-nav-bar">
               <button class="navbar-toggler pulse-animation" type="button" data-toggle="collapse" data-target="#mobile-navbar" aria-expanded="false">
                    <i class="far fa-arrow-alt-circle-down"></i>
                </button>
                <button type="button" class="navbar-toggler sidebar-toggle-mobile">
                    <i class="fas fa-bars"></i>
                </button>
            </div>
            <div class="header-main-menu collapse navbar-collapse" id="mobile-navbar">
                <ul class="navbar-nav">
                    <li class="navbar-item header-search-bar">
                       <b>Wellcome <span style="color: lightgray;font-size: 16px"><?php echo $userProfile[0]['parents_name'];?></span> To <span><?php echo $branch_details[0]['Branch_Name']?></span></b>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="navbar-item dropdown header-admin">
                        <a class="navbar-nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown"
                            aria-expanded="false">
                            <div class="admin-title">
                                <h5 class="item-title"><?php echo $userProfile[0]['parents_name'];?></h5>
                               
                            </div>
                            <div class="admin-img">
                                <img src="img/figure/admin.jpg" alt="Admin">
                            </div>
                        </a>
                        <div class="dropdown-menu dropdown-menu-right">
                            <div class="item-header">
                                <h6 class="item-title"><?php echo $WorkAssignListVal[0]['last_name'];?></h6>
                            </div>
                            <div class="item-content">
                                <ul class="settings-list">
                                    <li><a data-toggle="modal" data-target="#changepass<?php echo $_SESSION['parents_id'];?>"><i class="flaticon-user"></i>Change Password</a></li>
                                    
                                    <li><a href="logout.php"><i class="flaticon-turn-off"></i>Log Out</a></li>
                                </ul>

                                <!-- User Change Password Popup start -->


      <div id="changepass<?php echo $_SESSION['parents_id'];?>" class="modal fade" role="dialog">
        <div class="modal-dialog">

          <!-- Modal content-->
          <div class="modal-content">
            <div class="modal-header" style="border-bottom:none;">
              <button type="button" class="close" data-dismiss="modal">&times;</button>
              <h4 class="modal-title" style="text-align:center;"> Change Password:- (<?php echo $_SESSION['parents_name']; ?>)  </h4>
            </div>

            <div class="modal-body">

<form class="form-style-7" action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php" method="post"  enctype="multipart/form-data">

           <input type="hidden" name="action" value="ChangePassword"> 
           <input type="hidden" name="cell_no" value="<?php echo $branch[0]['cell_no'];?>"> 
                <div class="col-md-12" >
                      <div class="form-group" >
                        
                        <label>  New Password </label>
                          <input style="height:40px;padding-left:1%;" id="password" type="password" value="<?php echo $WorkAssignListVal['user_fname'];?>"  class="form-control field" name="password"/>
                      </div>
                </div>

                 <div class="col-md-12" >
                      <div class="form-group" >
                        
                        <label>  Confirm Password </label>
                          <input style="height:40px;padding-left:1%;" id="confirm_password" type="password"  value="<?php echo $designation[0]['designation_name']; ?>"  class="form-control field" name="confirm_password"/><span id='messages'></span>
                      </div>
                  </div>

            <div class="modal-footer">

            <!-- <button type="submit" class="btn btn-primary" name="submit" >Submit </button> -->
              


            </div>

                 </form>

          </div>

          </div>

        </div>
      </div>

      <!-- User Change Password Popup End -->
                            </div>
                        </div>
                    </li>
                    
                </ul>
            </div>
        </div>
        <!-- Header Menu Area End Here -->
        <!-- Page Area Start Here -->
        <div class="dashboard-page-one">

            <!-- Sidebar Area Start Here -->
            <!-- <div class="sidebar-main sidebar-menu-one sidebar-expand-md sidebar-color">
               <div class="mobile-sidebar-header d-md-none">
                    <div class="header-logo">
                        <a href="index.html"><img src="img/logo1.png" alt="logo"></a>
                    </div>
               </div>
                
            </div> -->
            <!-- Sidebar Area End Here -->

            <div class="dashboard-content-one">
                <!-- Breadcubs Area Start Here -->
                <div class="breadcrumbs-area">
                    <h3>Attempt Online Test</h3>
                    <a href="dashboard.php" class="btn btn-success" style="float: right;">Back to Home</a>
                    <ul>
                        <li>
                            <a href="dashboard.php">Home</a>

                        </li>
                        <li>Online Test</li>
                    </ul>
                </div>

                <!-- Breadcubs Area End Here -->
                <!-- Dashboard summery Start Here -->
                
                <!-- Dashboard summery End Here -->
                <!-- Dashboard Content Start Here -->
                <div class="row">



                    <div class="col-5-xxxl col-12">

                        <div class="card dashboard-card-twelve">

                            <div class="card-body">
                                <div class="heading-layout1">
                                 
                                    <div class="item-title">
                                        <h1>   <?php echo $tstdata[0]['title']." / ".$subject[0]['subject'];?></h1>
                                        <h3>
                                            Total Questions = <?php echo $tstdata[0]['number_of_questions'];?></h3>
    <div id="time" style="background-color: lightgreen; color:black; font-size: 22px; font-weight: bold; text-align: center;">
    <script type="text/javascript">
    var timeLeft = <?php echo $tstdata[0]['duration'];?>*60;
    var timeStart = -1;
    </script>
    </div>
                                      
                                    </div>
                                    <div class="dropdown">
                                        <a class="dropdown-toggle" href="#" role="button" data-toggle="dropdown"
                                            aria-expanded="false">...</a>

                                        <div class="dropdown-menu dropdown-menu-right">
                                            <a class="dropdown-item" href="#"><i
                                                    class="fas fa-times text-orange-red"></i>Close</a>
                                            <a class="dropdown-item" href="#"><i
                                                    class="fas fa-cogs text-dark-pastel-green"></i>Edit</a>
                                            <a class="dropdown-item" href="#"><i
                                                    class="fas fa-redo-alt text-orange-peel"></i>Refresh</a>
                                        </div>
                                    </div>
                                </div>
                                <div class="kids-details-wrap">
                                    <div class="row">
      <form id="frmQuiz" action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php" method="post" enctype="multipart/form-data" class="form-horizontal form-label-left" >   

      	  <input type="hidden" name="action" value="saveStudentTest" />
      	  <input type="hidden" name="student_id" value="<?php echo $_REQUEST['student_id'];?>">
      	  <input type="hidden" name="test_id" value="<?php echo $_REQUEST['test_id'];?>">
          <input type="hidden" name="subject_id" value="<?php echo $_REQUEST['subject_id'];?>">
          <input type="hidden" name="number_of_questions" value="<?php echo $tstdata[0]['number_of_questions'];?>">
          <input type="hidden" name="each_question_number" value="<?php echo $tstdata[0]['each_question_number'];?>">

    <?php foreach ($WorkAssignListings as $WorkAssignListVal) {  


         $m->where("question_id", $WorkAssignListVal['question_id']);
        $options=$m->get("eduportal_mcq_question_options");
       $count= count($options);
        ?>
        <input type="hidden" name="questions[]" value="<?php echo $WorkAssignListVal['question_id'];?>">
      <div class="col-md-12" style="font-size: 16px; font-weight: bold;">
         <?php  echo $WorkAssignListVal['questions']."<br><br>";?>
      </div> <br> 
     
     
    <?php  for ($i=0; $i < $count ; $i++) { ?>
        
        <div class="col-md-12" style="font-size: 16px;">
       <input style='width:20px; height:20px;' type='radio' id='male' name='questionAnswer<?php echo $WorkAssignListVal['question_id'];?>' value='<?php echo $options[$i]['optionABCD'];?>'>
       <?php echo "(".$options[$i]['optionABCD'].")  ".$options[$i]['option_details']."<br><br>";?> 
        </div>
      


  <?php   }  } ?>

  <button id="send" type="submit" style="float: right;width: 100px;height: 35px;font-size: 18px;" class="btn btn-primary" >Submit</button>

    </form>

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

          
                                      
                                      
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <footer class="footer-wrap-layout1">
                    <div class="copyright">© Copyrights <a href="#">CompuTech Technologies</a> 2019. All rights reserved. Designed by</div>
                </footer>
                <!-- Dashboard Content End Here -->
            </div>
        </div>
        <!-- Page Area End Here -->
    </div>
    <!-- jquery-->
    <script src="js1/jquery-3.3.1.min.js"></script>
    <!-- Plugins js -->
    <script src="js1/plugins.js"></script>
    <!-- Popper js -->
    <script src="js1/popper.min.js"></script>
    <!-- Bootstrap js -->
    <script src="js1/bootstrap.min.js"></script>
    <!-- Counterup Js -->
    <script src="js1/jquery.counterup.min.js"></script>
    <!-- Waypoints Js -->
    <script src="js1/jquery.waypoints.min.js"></script>
    <!-- Scroll Up Js -->
    <script src="js1/jquery.scrollUp.min.js"></script>
    <!-- Data Table Js -->
    <script src="js1/jquery.dataTables.min.js"></script>
    <!-- Custom Js -->
    <script src="js1/main.js"></script>

</body>

</html>