<?php

    session_start();

    include "../db.php";

    date_default_timezone_set('Asia/Kolkata');

    $currentTime = date('M j, Y g:i a');



    if ( !isset($_SESSION['uid']) && !isset($_SESSION['uref']) && !isset($_SESSION['utype']) && !isset($_SESSION['uname']) )

        header("Location: logout.php");

        $admin_2_run = "SELECT admin_ref FROM users WHERE uref = '$_SESSION[uref]'";

        $admin_2_row2 = mysqli_query($con, $admin_2_run);

        $admin_2_row = mysqli_fetch_assoc($admin_2_row2);

        $admin_2 = $admin_2_row["admin_ref"];

?>



<!DOCTYPE html>

<html lang="en">



<head>

  <?php include "includes/meta.php"; ?>

  <?php include "includes/css.php"; ?>





  <style>

    .modal.fade .modal-dialog {

      width: 100%;

      margin: 0 auto;

    }



    .dataTables_info {

      display: none;

    }



    .dataTables_length {

      display: none;

    }



    #MockTest thead tr {

      background: #00428a;

      color: #fff;

    }



    .btn-primary {

      background: #00428a;

      border-color: #00428a;

      color: #fff;

    }

  </style>

</head>



<body id="page-top" class="mt-55">

  <div style="margin-top: 70px;"></div>

  <?php include "includes/header2.php"; ?>

  <div class="container">

    <div class="row justify-content-center my-5">

      <div class="col-md-8">

        <div class="card shadow mt-3">

          <h5 class="card-header text-dark  text-center font-weight-bold">Add Question</h5>

          <div class="card-body">

            <form method="POST" enctype="multipart/form-data" id="Add_question" action="add-question-ajax.php">

              <div class="row">

                <div class="col-md-12">

                  <label class="badge badge-dark">Question</label>

                  <textarea name="question_name"></textarea>

                </div>

              </div>

              <div class="text-center my-2"><span>OR</span></div>

              <div class="row">

                <div class="col-md-12">

                  <label class="badge badge-dark">Question (Image Upload)</label>

                  <input type="file" class="form-control" name="imageQuestion" id="imageQuestion" accept="image/*">

                </div>

              </div>

              <div class="row mt-4">

                <div class="col-md-4">

                  <label class="badge badge-dark">Correct option</label>

                  <select class="form-control" name="coption" id="coption" required>

                    <option value="">Select correct option</option>

                    <option value="A">A</option>

                    <option value="B">B</option>

                    <option value="C">C</option>

                    <option value="D">D</option>

                  </select>

                </div>

                <div class="col-md-4 mt-2">

                  <label class="badge badge-dark">Difficulty</label>

                  <select class="form-control" name="difficulty" id="difficulty" required>

                    <option value="">Select difficulty</option>

                    <option value="Easy">Easy</option>

                    <option value="Medium">Medium</option>

                    <option value="Hard">Hard</option>

                  </select>

                </div>

                <div class="col-md-4 mt-2">

                  <label class="badge badge-dark">Marks</label>

                  <input type="number" class="form-control" name="marks" id="marks" required>

                </div>

              </div>

              <div class="row my-4">

                <div class="col-md-12">

                  <label class="badge badge-dark">Answer Description</label>

                  <textarea name="answer_decs"></textarea>

                </div>

              </div>

              <div class="text-center my-2"><span>OR</span></div>

              <div class="row">

                <div class="col-md-12">

                  <label class="badge badge-dark">Question (Image Upload)</label>

                  <input type="file" class="form-control" name="answer_decs_image" id="answer_decs_image" accept="image/*">

                </div>

                <input type="hidden" name="mocktest" value="<?php echo $_GET['mocktest']?>">

              </div>

              <div class=" row justify-content-center">

              <a href="view-questions.php?mocktest=<?php echo $_GET['mocktest'];?>" class="btn btn-warning text-sm-center mt-4 mr-2"><i class="fa fa-arrow-left"></i> Back</a>

                <button type="submit" class="btn btn-success text-sm-center mt-4">

                  <i class="fa fa-upload" name="submit_question"></i> Upload

                </button>

              </div>

            </form>

          </div>

        </div>

      </div>

    </div>

  </div>



  <?php include "includes/ft.php"; ?>

  <?php include "includes/js.php"; ?>

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

  <script src="https://cdn.datatables.net/1.13.2/js/jquery.dataTables.min.js"></script>

  <script src="https://cdn.datatables.net/1.13.2/js/dataTables.bootstrap4.min.js"></script>

  <script>

    $(document).ready(function () {

      $('#MockTest').DataTable();

    });

  </script>

  <script>

    CKEDITOR.replace('question_name');

    CKEDITOR.replace('answer_decs');

  </script>

  <?php 

  

 

?>

</body>



</html>