File: //proc/self/cwd/aptitude-test/update_question.php
<?php
/**
*
* Title : Test Report
* Developer : Rohit Kashyap
* Date : 04 Mar,2020
* Description : User test report and their sten score with highchart.
*/
ini_set('dsiplay_errors', 1);
error_reporting(E_ALL);
// echo "hello";
// die();
include_once('../wp-config.php');
$PSY_SP_QUESTION = $wpdb->prefix . PSY_SP_QUESTION;
$spaceArray = array(
"<p> </p>", "<br />", "<strong> </strong>", "<strong></strong>", "</strong><strong>", "<p></p>", "<p class=\"Style\"> </p>", " </p>", "<p> ",
" <br/><br/></p>", "<p><strong><br/></strong></p>", "<br/><br/></p>", "<p> ", "<p> </p>", "<p><strong></strong></p>",
"<p> </p>", "<p> </p>", "<br>", " ", "<br/>", "<br >", "<p><strong><br /></strong></p>", "font-size: small;", "src=https","http://staging.shinemetrics.com/wp-content/plugins/tet-india/files/"
);
$replaceSpaceArray = array("", "", "", "", "", "", "", "</p>", "<p>", "</p>", "", "</p>", "<p>", "", "", "", "", "", "", "", "", "", "", "src=\"https","http://staging.shinemetrics.com/");
$getQuestions = $wpdb->get_results("SELECT question_instruction,question_statement,option_1,option_2,option_3,option_4,option_5,correct_answer FROM $PSY_SP_QUESTION where question_statement LIKE '%Wirisformula%'");
?>
<link rel="stylesheet" type="text/css" href="<?php echo get_bloginfo('url') ?>/wp-content/plugins/tet-india/css/tt_styles.css">
<link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Language" content="hi">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
.main_table {
border: 2px solid #ccc;
width: 100%;
}
.user_detail_td {
width: 35%;
float: left;
border: 1px solid #ccc;
}
.user_exam_detail_td {
width: 60%;
float: left;
border: 1px solid #ccc;
}
.user_detail_table {
width: 100%;
}
.user_detail_table td {
padding: 5px;
}
.user_detail_table tr {
border-bottom: 1px solid #ccc;
}
.user_detail_table td:nth-child(1) {
width: 35%;
border-right: 1px solid #ccc;
}
.user_exam_detail_demo_table {
width: 100%;
}
.user_exam_detail_demo_table td,
th {
text-align: left;
padding: 5px;
}
.test_details {
color: #0073aa;
font-weight: bold;
text-decoration: blink;
cursor: pointer;
}
.test_details:hover {
text-decoration: underline;
}
.menu {
background: rgba(0, 0, 0, 0.01);
width: 31%;
float: left;
margin: 10px;
border: 1px solid #ddd;
padding-top: 0px;
font-family: Verdana, sans-serif;
font-size: 13px;
line-height: 1.5;
min-height: 22em;
}
.menu_100 {
background: rgba(0, 0, 0, 0.01);
width: 97%;
float: left;
margin: 10px;
border: 1px solid #ddd;
padding-top: 0px;
font-family: Verdana, sans-serif;
font-size: 13px;
line-height: 1.5;
}
.menu_50 {
background: rgba(0, 0, 0, 0.01);
width: 50%;
float: left;
margin: 10px;
border: 1px solid #ddd;
padding-top: 0px;
font-family: Verdana, sans-serif;
font-size: 13px;
line-height: 1.5;
}
th {
border: 1px solid darkgrey;
}
td {
border: 1px solid darkgrey;
}
.title {
border-bottom: 2px solid skyblue;
margin: 10px;
font-family: arial;
padding-bottom: 5px;
text-align: left;
}
.heading {
margin: 10px;
font-family: verdana;
padding-bottom: 5px;
text-align: left;
}
.fa {
position: relative;
float: right;
color: grey;
font-size: 18px;
top: 7px;
margin: -5px 0px 0px 5px;
}
.table_striped {
margin: 10px;
}
.w3-table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
display: table;
}
.w3-table td,
.w3-table th {
padding: 3px 4px;
display: table-cell;
text-align: left;
vertical-align: top;
}
.postbox {
clear: both;
width: 100%;
float: left;
}
.stTable th,
td {
text-align: center !important;
}
.stTable td {
font-size: 17px;
font-weight: bold;
}
</style>
<div class="postbox" style="font-family: verdana;">
<div class="menu_100">
<div class="table_striped">
<table class="w3-table w3-striped">
<?php
$root_link = '"' . get_bloginfo('url') . '/';
$i = 1;
foreach ($getQuestions as $ql) {
$qId = $ql->question_id;
$ques_medium = $ql->medium_id;
$currect_ans = $ql->correct_answer;
$instructions = str_replace('"../', $root_link, $ql->question_instruction);
$instructions = str_replace($spaceArray, $replaceSpaceArray, $instructions);
$question = str_replace('"../', $root_link, $ql->question_statement);
$question = str_replace($spaceArray, $replaceSpaceArray, $question);
$option1 = str_replace('"../', $root_link, $ql->option_1);
$option1 = str_replace($spaceArray, $replaceSpaceArray, $option1);
$option2 = str_replace('"../', $root_link, $ql->option_2);
$option2 = str_replace($spaceArray, $replaceSpaceArray, $option2);
if ($ql->option_3) {
$option3 = str_replace('"../', $root_link, $ql->option_3);
$option3 = str_replace($spaceArray, $replaceSpaceArray, $option3);
} else {
$option3 = "";
}
if ($ql->option_4) {
$option4 = str_replace('"../', $root_link, $ql->option_4);
$option4 = str_replace($spaceArray, $replaceSpaceArray, $option4);
} else {
$option4 = "";
}
if ($ql->option_5) {
$option5 = str_replace('"../', $root_link, $ql->option_5);
$option5 = str_replace($spaceArray, $replaceSpaceArray, $option5);
} else {
$option5 = "";
}
$varRep = array('{$curnt}' => $i, '{$curnt+1}' => $i + 1, '{$curnt+2}' => $i + 2, '{$curnt+3}' => $i + 3, '{$curnt+4}' => $i + 4, '{$curnt+5}' => $i + 5, '{$curnt+6}' => $i + 6, '{$curnt+7}' => $i + 7, '{$curnt+8}' => $i + 8, '{$curnt+9}' => $i + 9, '{$curnt+10}' => $i + 10, '{$curnt-1}' => $i - 1, '{$curnt-2}' => $i - 2, '{$curnt-3}' => $i - 3, '{$curnt-4}' => $i - 4, '{$curnt-5}' => $i - 5, '{$curnt-6}' => $i - 6, '{$curnt-7}' => $i - 7, '{$curnt-8}' => $i - 8, '{$curnt-9}' => $i - 9, '{$curnt-10}' => $i - 10);
?>
<tr>
<td style="width:50%;">
<div style="width: 100%;text-align: left;">
<h3><?php echo $ql->tabless; ?></h3>
</div>
<?php
if ($instructions) { ?>
<h4 class="title"><?php echo 'Instruction: ' . $instructions; ?></h4>
<?php } ?>
<div style="width: 100%;text-align: left;">
<?php echo $i . '/ ( master id: ' . $qId . '/ Old Id: ' . $qOldId . ' )'; ?>
<?php echo strtr((str_replace('"../', $root_link, $question)), $varRep); ?>
</div>
<div style="width: 100%;text-align: left;">
<input type="hidden" name="" value="<?php echo $currect_ans; ?>">
<div style="width: 100%;">
<span class="tt_ques_lf">
<span class="tt_ques_lf_inn">(a)</span>
<span class="tt_ques_rt_inn">
<input <?php if ($currect_ans == 1) echo "checked"; ?> id="rd_ans1<?php echo $i; ?>" type="radio" value="1" name="rd_ans<?php echo $i; ?>" />
</span>
</span>
<?php echo $option1; ?>
</div>
<div style="width: 100%;">
<span class="tt_ques_lf">
<span class="tt_ques_lf_inn">(b)</span>
<span class="tt_ques_rt_inn">
<input <?php if ($currect_ans == 2) echo "checked"; ?> id="rd_ans2<?php echo $i; ?>" type="radio" value="2" name="rd_ans<?php echo $i; ?>" />
</span>
</span>
<?php echo $option2; ?>
</div>
<?php if ($option3 != "") { ?>
<div style="width: 100%;">
<span class="tt_ques_lf">
<span class="tt_ques_lf_inn">(c)</span>
<span class="tt_ques_rt_inn">
<input <?php if ($currect_ans == 3) echo "checked"; ?> id="rd_ans3<?php echo $i; ?>" type="radio" value="3" name="rd_ans<?php echo $i; ?>" />
</span>
</span>
<?php echo $option3; ?>
</div>
<?php } ?>
<?php if ($option4 != "") { ?>
<div style="width: 100%;">
<span class="tt_ques_lf">
<span class="tt_ques_lf_inn">(d)</span>
<span class="tt_ques_rt_inn">
<input <?php if ($currect_ans == 4) echo "checked"; ?> id="rd_ans4<?php echo $i; ?>" type="radio" value="4" name="rd_ans<?php echo $i; ?>" />
</span>
</span>
<?php echo $option4; ?>
</div>
<?php } ?>
<?php if ($option5 != "") { ?>
<div style="width: 100%;">
<span class="tt_ques_lf">
<span class="tt_ques_lf_inn">(e)</span>
<span class="tt_ques_rt_inn">
<input <?php if ($currect_ans == 5) echo "checked"; ?> id="rd_ans5<?php echo $i; ?>" type="radio" value="5" name="rd_ans<?php echo $i; ?>" />
</span>
</span>
<?php echo $option5; ?>
</div>
<?php } ?>
</div>
</td>
</tr>
<?php
$i++;
}
?>
</table>
</div>
</div>
</div>