Preview: exambatch.php
Size: 8.93 KB
/home/jambtst2015/public_html/protected/views/user/exambatch.php
<!-- Fancy Box -->
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/source/jquery.fancybox.js?v=2.1.5"></script>
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/source/jquery.fancybox.css?v=2.1.5" media="screen" />
<!-- Fancy Box -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.plugin.js"></script>
<script src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.countdown.js"></script>
<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/jquery.countdown.css">
<script type="text/JavaScript">
<!-- Clock -->
function updateClock(){
var currentTime = new Date ( );
var currentHours = currentTime.getHours ( );
var currentMinutes = currentTime.getMinutes ( );
var currentSeconds = currentTime.getSeconds ( );
// Pad the minutes and seconds with leading zeros, if required
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;
// Compose the string for display
var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
$("#clock").html(currentTimeString);
}
$(document).ready(function(){
setInterval('updateClock()', 1000);
});
<!-- Clock -->
<!-- Remove messege div -->
$(document).ready(function(){
setTimeout(function(){
$(".flash-success").fadeOut("slow", function () {
$(".flash-success").remove("slow");
});
$(".flash-error").fadeOut("slow", function () {
$(".flash-error").remove("slow");
});
}, 4000);
});
<!-- Remove messege div -->
</script>
<script>
var hook = true;
window.onbeforeunload = function() {
if (hook) {
return "Are you sure you want to leave this page without saving?"
}
}
function unhook() {
hook=false;
}
</script>
<script>
function answered(val){
$("#isAnswerd").val(val);
}
$(document).ready(function(e) {
var examtime = $("#examtime").val();
var splitResult = examtime.split(":");
//alert(splitResult[1]);
$('#countdown').countdown(
{until: '+'+splitResult[0]+'h +'+splitResult[1]+'m +0s',
layout: '{d<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl}{s>}',
onExpiry: timeover
});
}
);
function timeover(){
unhook();
alert('Your examnination time is over. GO to result section to get your result.');
$("#exam_form").submit() ;
}
</script>
<script>
$(document).ready(function(e) {
$(".red-btn").click(function(){
var isEmpty = $("#isAnswerd").val();
if(isEmpty==''){
var userConfirm = confirm('You have not answered any question, would you still like to submit?');
if(userConfirm==true){
unhook();
//$('#submit').attr('id','unfollow');
$("#exam_form").submit() ;
}
}else{
unhook();
$("#exam_form").submit() ;
}
});
});
</script>
<h4>
<span>Exam batch : <?php echo Helpers::getrecord('Subjectbody','id',$_REQUEST['subject'],'subject'); ?> <?php echo Helpers::getrecord('Questionbody','id',$_REQUEST['paper'],'paper_name'); ?></span>
<span class="dateTime">Exam date - <?php echo date("F j, Y");?> & time - <span id="clock" style="font-weight:bold"></span></span>
</h4>
<?php if(!empty($allQuestion)){ ?>
<div class="row second-top">
<div class="hour-remaining">
<?php if($exam_time = Yii::app()->user->getState('userexam_time')!=''){?>
<span style="color:#000;">You Have </span><span id="countdown"></span> <span> REMAINING. </span>
<?php } else{?>
<span style=" margin: 7px 0 14px;"> </span>
<?php } ?>
</div>
<a href="javascript:void(0);" class="red-btn left" id="submit">End test</a>
<a href="<?php echo Yii::app()->request->baseUrl; ?>/user/settime/paper/<?php echo $_REQUEST['paper'];?>/subject/<?php echo $_REQUEST['subject'];?>" class="green-btn right">retake exam</a>
</div>
<?php } ?>
<div class="contentarea questionArea">
<?php /*?><h2 class="qusHeader">Questions numbers 1 to 10 carry 1 mark each. For each of the questions 1 - 10 , Four alternatives choices have been provided of which only one is correct. You have to select the currect choice.. </h2><?php */?>
<?php if(!empty($allQuestion)){ ?>
<form action="<?php echo Yii::app()->request->baseUrl; ?>/user/thankyou" method="post" id="exam_form" name="exam_form">
<div class="qusCont">
<?php
$arrCount = count($allQuestion);
$inc=1;
foreach($allQuestion as $allQuestionSingle){ ?>
<div class="options" <?php if($inc==$arrCount){ ?>style="border-bottom:none;"<?php } ?>>
<h4 class="qus"><?php echo $inc.'. '.$allQuestionSingle['question']; ?></h4>
<div class="row-block">
<div class="option-block"><span class="radio"><input type="radio" value="1" name="option<?php echo $allQuestionSingle['id'] ;?>" onclick="answered(this.value);"></span> <span class="options-ops">(a) <?php echo $allQuestionSingle['ans1']; ?></span> </div>
<div class="option-block"><span class="radio"><input type="radio" value="2" name="option<?php echo $allQuestionSingle['id'] ;?>" onclick="answered(this.value);"></span> <span class="options-ops">(b) <?php echo $allQuestionSingle['ans2']; ?></span> </div>
</div>
<div class="row-block">
<div class="option-block"><span class="radio"><input type="radio" value="3" name="option<?php echo $allQuestionSingle['id'] ;?>" onclick="answered(this.value);"></span> <span class="options-ops">(c) <?php echo $allQuestionSingle['ans3']; ?></span> </div>
<div class="option-block"><span class="radio"><input type="radio" value="4" name="option<?php echo $allQuestionSingle['id'] ;?>" onclick="answered(this.value);"></span> <span class="options-ops">(d) <?php echo $allQuestionSingle['ans4']; ?></span> </div>
</div>
<?php if($allQuestionSingle['ans5']!=''){ ?>
<div class="row-block">
<div class="option-block"><span class="radio"><input type="radio" value="5" name="option<?php echo $allQuestionSingle['id'] ;?>" onclick="answered(this.value);"></span> <span class="options-ops">(e) <?php echo $allQuestionSingle['ans5']; ?></span> </div>
</div>
<?php } ?>
<input type="hidden" name="question_h_id[]" value="<?php echo $allQuestionSingle['id'];?>" />
<input type="hidden" name="subject_id" value="<?php echo $_REQUEST['subject'];?>" />
<input type="hidden" name="paper_id" value="<?php echo $_REQUEST['paper'];?>" />
</div>
<?php $inc++;
}
?>
<input type="hidden" name="examtime" id="examtime" value="<?php echo Yii::app()->user->getState('userexam_time');?>" />
<input type="hidden" id="isAnswerd" name="isAnswerd" />
</div>
</form>
<?php }else{ ?>
<input type="hidden" name="examtime" id="examtime" value="<?php echo Yii::app()->user->getState('userexam_time');?>" />
<input type="hidden" id="isAnswerd" name="isAnswerd" />
<h2 class="qusHeader">Sorry no question posted yet.. </h2>
<?php } ?>
<div class="clear"></div>
</div>
<?php if(!empty($allQuestion)){ ?>
<div style="padding-top:10px;"> <a href="javascript:void(0);" class="red-btn left" id="submit1">End test</a></div>
<div class="clear"></div>
<?php } ?>
Directory Contents
Dirs: 0 × Files: 24