| Server IP : 104.21.80.248 / Your IP : 162.159.115.42 Web Server : Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 System : Windows NT WIN-ECQAAA40806 6.2 build 9200 (Windows Server 2012 Standard Edition) i586 User : SYSTEM ( 0) PHP Version : 5.6.30 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Inetpub/www/news/elearning/ajax/ |
Upload File : |
<?php
require '../configs/app_top.php';
$qno = intval($_GET["qno"]);
$string = file_get_contents("../" . $_SESSION["exam_file_name"]);
$results = json_decode($string, true);
?>
<script src="<?php echo get_site_url(); ?>bootstrap/js/jquery-1.9.0.min.js"></script>
<input type="hidden" name="q_no" id="q_no" value="<?php echo intval($results[$qno]["qb_id"]); ?>" />
<div class="question">
<span style="font-weight: bold;text-decoration: underline;">คำถามข้อที่ #<?php echo ($qno + 1); ?></span>
<br><br>
<font size="4"> <?php echo safe_output($results[$qno]["qb_question"]); ?></font>
</div>
<div class="padding10"></div>
<div class="answers">
<div class="radio">
<label>
<input type="radio" value="1" id="opt1" name="ans" class="ans" <?php echo ($_SESSION["q_attempt"][$results[$qno]["qb_id"]] == 1 ) ? 'checked' : ''; ?> >
<?php echo safe_output($results[$qno]["qb_option1"]); ?>
</label>
</div>
<div class="radio">
<label>
<input type="radio" value="2" id="opt2" name="ans" class="ans" <?php echo ($_SESSION["q_attempt"][$results[$qno]["qb_id"]] == 2 ) ? 'checked' : ''; ?>>
<?php echo safe_output($results[$qno]["qb_option2"]); ?>
</label>
</div>
<div class="radio">
<label>
<input type="radio" value="3" id="opt3" name="ans" class="ans" <?php echo ($_SESSION["q_attempt"][$results[$qno]["qb_id"]] == 3 ) ? 'checked' : ''; ?>>
<?php echo safe_output($results[$qno]["qb_option3"]); ?>
</label>
</div>
<div class="radio">
<label>
<input type="radio" value="4" id="opt4" name="ans" class="ans" <?php echo ($_SESSION["q_attempt"][$results[$qno]["qb_id"]] == 4 ) ? 'checked' : ''; ?>>
<?php echo safe_output($results[$qno]["qb_option4"]); ?>
</label>
</div>
</div>
<div class="padding10"></div>
<div id="qtns">
<button class="btn btn-info" type="button" <?php
if ($qno < 1) {
echo 'disabled';
} else {
?> onclick="loadQuestions('<?php echo $qno - 1; ?>');" <?php } ?> ><span class="glyphicon glyphicon-backward"></span> ก่อนหน้า</button>
<button class="btn btn-info" type="button" <?php if ($qno < count($results) - 1) { ?> onclick="loadQuestions('<?php echo $qno + 1; ?>');" <?php
} else {
echo 'disabled';
}
?>>ถัดไป <span class="glyphicon glyphicon-forward"></span></button>
</div>
<div class="padding10"></div>
<div class="help-block">คำถามข้อที่: <?php echo ($qno + 1) . " จาก " . count($results) ?>ข้อ</div>
<div class="help-block">ทำเสร็จแล้ว: <span id="tot_atm"><?php echo intval(count($_SESSION["q_attempt"])); ?></span>ข้อ </div>
<center>
<table width="650" border="0">
<tr>
<td>
<?php
$p_100=intval(count($_SESSION["q_attempt"]));
$in=count($results);
$total_a=($p_100*100)/$in;
?>
<div id="load_tweets"> </div>
<div class="help-block">
<div class="progress">
<div class="progress-bar progress-bar-success progress-bar-striped active" role="progressbar"
aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width:<?php echo "$total_a"; ?>%">
<?php echo number_format($total_a, 2, '.', ''); ?>% สำเร็จแล้ว
</div>
</div>
</div>
</td>
</tr>
</table>
</center>
<script>
$(document).ready(function() {
$(".ans").change(function() {
var val = $(this).val();
var qno = $('#q_no').val();
//alert("qno "+ qno+" val:"+val);
$.ajax({
type: "GET",
url: "<?php echo generate_site_link("ajax/set_user_answer"); ?>",
data: "qno=" + qno + "&opt=" + val,
cache: false,
success: function(html) {
// todo
$('#tot_atm').html('<?php echo intval(count($_SESSION["q_attempt"]) + 1); ?>');
}
});
})
});
</script>
<?php
require '../configs/app_bottom.php';
?>