File: /var/www/selfanalyse/self-strength-test/test_instruction.php
<?php
/**
*
* Title : Test Instruction Page
* Developer : Gulfam Ali, Rohit Kashyap, Sumit Singh Rawat (Designer)
* Date : 04 Mar,2020
* Description : First page for instruction of test (Mock test or Practice test)
*
*/
?>
<!-- <body oncontextmenu="return false;"> -->
<body oncontextmenu="return false;">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Test of Character Virtues</title>
<?php
// ini_set('display_error', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
?>
<?php
include_once('../wp-config.php');
global $wpdb;
$PSY_EXAMS = $wpdb->prefix . PSY_EXAMS;
$PSY_SUBSCRIPTION = $wpdb->prefix . PSY_SUBSCRIPTION;
$PSY_TEST_GEN_TEST_TAKEN = $wpdb->prefix . PSY_TEST_GEN_TEST_TAKEN;
$subscriptionId = $_POST['sID'];
$class_id = $_POST['class_id'];
$testType = 'new';
$view = $_REQUEST['view'];
$pending_test_id = $_REQUEST['pending_test_id'];
global $current_user;
if (is_user_logged_in()) {
get_currentuserinfo();
$user_id = $current_user->ID; // print session USER_ID
$validSubscription = $wpdb->get_row("SELECT subscription_id, exam_id, test_type FROM $PSY_SUBSCRIPTION where subscription_id='$subscriptionId'");
if ($validSubscription > 0) {
if ($validSubscription->test_type == 'SS') {
$exam_id = $validSubscription->exam_id;
$examDetail = $wpdb->get_row("SELECT is_negative_marking,negative_marking_percent,question_weight,subject_choice,app_status,bilingual,section_bound,total_no_of_questions_in_exam,total_exam_time_in_minute,category_name FROM $PSY_EXAMS where exam_category_id='$exam_id'");
$is_negative_marking = $examDetail->is_negative_marking;
$negative_marking_percent = $examDetail->negative_marking_percent / 100;
$quesWeight = $examDetail->question_weight;
$subjectChoice = $examDetail->subject_choice;
$app_status = $examDetail->app_status;
$section_time_wise = $examDetail->section_bound;
$totalQuestinInExam = $examDetail->total_no_of_questions_in_exam;
$totalTimeForExam = $examDetail->total_exam_time_in_minute;
$examName = $examDetail->category_name;
$examStructure = $wpdb->get_results("select parent_id,exam_category_id,category_name, no_of_questions_to_display,subject_choice from $PSY_EXAMS where parent_id='$exam_id' order by display_order");
}
$totalMinute = $totalTimeForExam;
$DisplayTime = $totalTimeForExam;
$dispHr = floor($DisplayTime / 60);
$dispmins = $DisplayTime % 60;
if ($dispmins > 0) {
$dispmin = $dispmins . ' minutes';
} else {
$dispmin = "";
}
if ($dispHr > 1) {
$DisptimeInHour = $dispHr . ' hours ' . $dispmin;
} else {
$DisptimeInHour = $dispHr . ' hour ' . $dispmin;
}
if ($testType == "new" && $testTakenId == 0) // if test is new test
{
$totalDONE = $wpdb->get_var("SELECT count(*) from $PSY_TEST_GEN_TEST_TAKEN where user_id='$user_id' and exam_category_id='$exam_id'");
/*------------ set the timer -------------*/
$dateFormat = "d F Y -- g:i a";
$targetDate = time() + ($totalMinute * 60); //Change the $totalMinute to however many minutes you want to countdown
$actualDate = time();
$secondsDiff = $targetDate - $actualDate;
$remainingDay = floor($secondsDiff / 60 / 60 / 24);
$remainingHour = floor(($secondsDiff - ($remainingDay * 60 * 60 * 24)) / 60 / 60);
$remainingMinutes = floor(($secondsDiff - ($remainingDay * 60 * 60 * 24) - ($remainingHour * 60 * 60)) / 60);
$remainingSeconds = floor(($secondsDiff - ($remainingDay * 60 * 60 * 24) - ($remainingHour * 60 * 60)) - ($remainingMinutes * 60));
$totalTimeSpent = 0;
}
$testIndex = array_search($testTakenId, $CompletedTest);
$totalDONE = $testIndex;
// end calculation
$hours = floor($totalTimeForExam / 60);
$minutes = $totalTimeForExam % 60;
if ($minutes > 0) {
$minute = $minutes . ' minutes';
} else {
$minute = "";
}
if ($hours > 1) {
$timeInHour = $hours . ' hours ' . $minute;
} else {
$timeInHour = $hours . ' hour ' . $minute;
}
$typeExam = "Test";
?>
<input type="hidden" value="<?php echo $remainingHour ?>" name="tt_hour" id="tt_hour" />
<input type="hidden" value="<?php echo $remainingMinutes; ?>" name="tt_minute" id="tt_minute" />
<input type="hidden" value="<?php echo $remainingSeconds; ?>" name="tt_second" id="tt_second" />
<input type="hidden" value="<?php echo $totalTimeSpent; ?>" name="totalTimeSpent" id="totalTimeSpent" />
<input type="hidden" name="subjectChoice" value="<?php echo $subjectChoice; ?>" id="subjectChoice">
<input type="hidden" name="test_type" value="<?php echo $testType; ?>" id="test_type">
<link rel="stylesheet" type="text/css" href="tet_assign_test.css?v=<?php echo date('dmyhis'); ?>">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,900|Roboto:300,400,500,700,900&display=swap" title="default">
<script src="js/jquery-1.12.4.js"></script>
<script src="tet_assign_test.js?v=<?php echo date('dmyhis'); ?>"></script>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<script src="js/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" type="" href="css/toastr.min.css">
<script src="js/toastr.min.js"></script>
<input type="hidden" value="<?php echo ROOT_LINK; ?>" name="siteUrl" id="siteUrl" />
<input type="hidden" value="<?php echo $app_status; ?>" id="app_status" />
<!-- INSTRUCTION PAGE SECTION -->
<section>
<div class="container">
<div class="center" id="center" style="display: block;">
<div class="col-md-12 col-sm-12 col-xs-12 exam_name">
<h4 class="exam_title_dash" id="xam1">Test Name :
<span style="font-weight: 500;" id="name_eng">
<?php echo $examName; ?>
</span>
</h4>
</div>
<div id="tet_loading_img" style="display: none;margin-top: 125px;text-align: center;">
<img src="<?php echo get_bloginfo('url') . '/aptitude-test/fancybox_loading.gif'; ?>" /><br>
<?php echo 'Loading...'; ?>..
</div>
<div class="col-md-12 col-sm-12 col-xs-12" id="instruction_area1">
<div id="eng">
<h4 class="gen_ins">General Instructions </h4>
<ol>
<li>There are multiple answer options for each questions.<br>
</li>
<li>Please choose your option by clicking the mouse.<br>
</li>
<li>There are three buttons / keys at the bottom.<br>
</li>
<li><button class="clr"> Clear Option </button> button will clear the selected option for that question.<br>
</li>
<li><button class="prv"> Previous </button> button will take you to the previous question.<br>
</li>
<li><button class="nxt"> Next </button> button will take you to the next question.<br>
</li>
<li><button class="rprt"> <i class="fa fa-exclamation-triangle"></i> </button> Report a Problem button will be helpful whenever you get stuck anywhere in the Test. Tell us the problem and we will help you.<br>
</li>
<li><button class="sub">Finish & Exit</button> This button will finish the test.<br>
</li>
<li>We have <button class="das"> Questions Dashboard </button> on the right side of the page, once you click on it, you can view all your answered and un-answered questions.<br>
</li>
<li>You can go back or forward by clicking on the serial number of the question displayed on the Dashboard.<br>
</li>
<li>The answered questions will be displayed in green color and the un-answered questions will be displayed in grey color.<br>
</li>
<li>You can see the time clock on the top right corner of the exam page.<br>
</li>
</ol>
<h4 class="gen_ins">Test Specific Instructions</h4>
<ol>
<li>Do not Overthink.</li>
<li>Choose the option that best describes you.</li>
<li>Be honest.</li>
<li>There are 96 questions.</li>
<li>Each have 5 similar options.</li>
<li>Total time = 30 min.</li>
<li>The questions are in the form of statements. The statements are related to the way we think and act.</li>
<li>Choose the option which is most true for you for the given statement.</li>
<li>The strengths cannot be calculated if all the questions are not answered.</li>
</ol>
</div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
<div id="instruction_area2" style="display: none;" class="text-center">
<div style="text-align: center;padding-top: 95px;width: 100%;font-size: 14px;font-weight: bold; line-height: 2em;">
Total allocated time is 30 Minutes.
<br>
You must attempt this test in one go for accurate result.
</div>
<div style="text-align: center;padding-top: 10px;width: 100%">
<a id="start_test" class="button noe" style="cursor:pointer;">Start</a>
</div>
</div>
</div>
<div class="container-fluid" id="checkbox_disc">
<div class="row">
<div class="mock_test_footer">
<div class="col-md-12">
<span id="chkMsg" style="color:#cc0000; width: 100%; float: left; font-size:15px;"></span>
<h4 class="int_ti"><input id="chk_accept" class="check" type="checkbox" name="chk_accept" value="1"> <span id="instructions_eng"> I have read all Instructions.</span> <br />
<span id="instructions_hnd" class="hide"> मैंने सभी निर्देश पढ़ लिए है|</span> </h4>
</div>
<div class="col-md-12">
<a id="show_area2" style="cursor:pointer;">
<button class="start_test">
<span id="srt_eng">Start Test</span>
</button>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- END INSTRUCTION PAGE SECTION -->
<!-- QUESTION AND ANSWER PAGE SECTION -->
<section>
<div id="question_div" style="display: none">
<div id="tet_loading_img" style="display: block;margin-top: 125px;text-align: center;">
<img src="<?php echo get_bloginfo('url') . '/aptitude-test/fancybox_loading.gif'; ?>" /><br>
<?php echo 'Loading...'; ?>..
</div>
<input type="hidden" value="<?php echo $exam_id; ?>" name="exam_category_id" id="exam_category_id" />
<input type="hidden" name="class_id" id="class_id" value="<?php echo $class_id; ?>">
<input type="hidden" name="view" id="view" value="<?php echo $view; ?>">
<input type="hidden" name="pending_test_id" id="pending_test_id" value="<?php echo $pending_test_id; ?>">
<input type="hidden" name="test_view_type" id="test_view_type" value="<?php echo $validSubscription->test_type; ?>">
<input type="hidden" name="asign_ref_id" id="asign_ref_id" value="<?php echo $subscriptionId; ?>">
</div>
</section>
<!-- QUESTION AND ANSWER PAGE SECTION -->
<?php
} // end of valid subscription if
else {
?>
<script>window.location.href='/test'</script>
<?php
}
} // end of check login if
else {
echo "Login first to view this page";
}
?>
</body>