BBnepal-Accounts/application/views/teacher/TF-evaluation-qn1.php

362 lines
16 KiB
PHP
Raw Permalink Normal View History

2024-07-10 12:43:19 +00:00
<link rel="stylesheet" href="<?php echo base_url(); ?>assets_teacher/css/style2.css">
<main class="common_margin" id="main">
<div class="main-inner-content main-wrap">
<div class="stud-drade-wrap">
<a href="<?php echo base_url('teacher/evaluate-questions/'.$questions_id); ?>" class="text-dark" style="font-size:23px">
<i class="fas fa-long-arrow-alt-left"> </i>
</a> &nbsp;&nbsp;&nbsp;
<h4 class="content-heading-sec">Evaluation</h4>
</div>
<div class="evaluation_head">
<?php if (isset($exam_data) && !empty($exam_data)) { ?>
<div class="test_heading">
<h6>Tests & Exams /<span><?php echo $exam_data['subject_name'] . ' : '. $exam_data['e_name'] ?></span></h6>
</div>
<div class="test_score">
<?php echo $exam_data['total_marks'] ?> marks
</div>
<?php } ?>
</div>
<?php if(isset($questions_data) && !empty($questions_data)){
$number = 0;
foreach ($questions_data as $key => $value) {
$number++;
if ($value['question_type_id'] == 1) { ?>
<div class="evaluation-wrap <?php echo 'counter_'.$number; ?>" id="<?php echo 'q'.$value['id'] ?>">
<div class="evaluation_q">
<h5>Question : <?php echo $number; ?></h5>
<p><?php echo $value['question_name']; ?></p>
<?php if (isset($value['image']) && !empty($value['image'])) {?>
<img src="<?php echo base_url() .''. $value['image'] ?>" width="auto" height="120">
<?php } ?>
<h5>Select your answer from below options:</h5>
<?php if ($value['answer'] == 'A' ) { ?>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value="" checked></div>
<div class="option-select-left"><?php echo $value['option_a']; ?></div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value=""></div>
<div class="option-select-left"><?php echo $value['option_b']; ?></div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value=""></div>
<div class="option-select-left"><?php echo $value['option_c']; ?></div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value=""></div>
<div class="option-select-left"><?php echo $value['option_d']; ?></div>
</div>
<?php } ?>
<?php if ($value['answer'] == 'B' ) { ?>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value=""></div>
<div class="option-select-left"><?php echo $value['option_a']; ?></div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value="" checked></div>
<div class="option-select-left"><?php echo $value['option_b']; ?></div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value=""></div>
<div class="option-select-left"><?php echo $value['option_c']; ?></div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value=""></div>
<div class="option-select-left"><?php echo $value['option_d']; ?></div>
</div>
<?php } ?>
<?php if ($value['answer'] == 'C' ) { ?>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value="" ></div>
<div class="option-select-left"><?php echo $value['option_a']; ?></div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value=""></div>
<div class="option-select-left"><?php echo $value['option_b']; ?></div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value="" checked></div>
<div class="option-select-left"><?php echo $value['option_c']; ?></div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value=""></div>
<div class="option-select-left"><?php echo $value['option_d']; ?></div>
</div>
<?php } ?>
<?php if ($value['answer'] == 'D' ) { ?>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value="" ></div>
<div class="option-select-left"><?php echo $value['option_a']; ?></div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value=""></div>
<div class="option-select-left"><?php echo $value['option_b']; ?></div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value=""></div>
<div class="option-select-left"><?php echo $value['option_c']; ?></div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value="" checked></div>
<div class="option-select-left"><?php echo $value['option_d']; ?></div>
</div>
<?php } ?>
</div>
<div class="score_display <?php echo ($value['correct_answer'] == $value['answer']) ? 'score_correct' : "score_wrong" ?>">
<h5><?php echo ($value['correct_answer'] == $value['answer']) ? 'Correct' : "Incorrect" ?></h5>
<p>Selected answer is "<?php echo $value['answer'] ?>", Correct answer is "<?php echo $value['correct_answer'] ?>"</p>
</div>
<div class="score_sec">
<span>Scored</span>
<div class="score ">
<?php echo $value['correct_answer'] == $value['answer'] ? $value['question_mark'] : 0 ?>
</div>
<span> out of <?php echo $value['question_mark'] ?></span>
</div>
</div>
<?php }else if( $value['question_type_id'] == 2){ ?>
<div class="evaluation-wrap <?php echo 'counter_'.$number; ?>" id="<?php echo 'q'.$value['id'] ?>" >
<div class="evaluation_q">
<h5>Question : <?php echo $number; ?></h5>
<p><?php echo $value['question_name']; ?></p>
<?php if (isset($value['image']) && !empty($value['image'])) {?>
<img src="<?php echo base_url() .''. $value['image'] ?>" width="auto" height="120">
<?php } ?>
<h5>Select your answer from below options:</h5>
<?php if ($value['answer'] == 1) { ?>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value="" checked></div>
<div class="option-select-left">True</div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value="" ></div>
<div class="option-select-left">False</div>
</div>
<?php } else if ($value['answer'] == 0) {?>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value="" ></div>
<div class="option-select-left">True</div>
</div>
<div class="option-select-sec">
<div class="option-select-right"><input type="radio" value="" checked=""></div>
<div class="option-select-left">False</div>
</div>
<?php } ?>
</div>
<div class="score_display <?php echo ($value['correct_answer'] == $value['answer']) ? 'score_correct' : "score_wrong" ?>">
<h5><?php echo ($value['correct_answer'] == $value['answer']) ? 'Correct' : "Incorrect" ?></h5>
<p>Selected answer is "<?php echo ($value['answer'] == '1') ? 'True' : "False"; ?>", Correct answer is "<?php echo ($value['correct_answer'] == '1') ? 'True' : "False";?>"</p>
</div>
<div class="score_sec">
<span>Scored</span>
<div class="score">
<?php echo ($value['correct_answer'] == $value['answer']) ? $value['question_mark'] : 0 ?>
</div>
<span> out of <?php echo $value['question_mark'] ?></span>
</div>
</div>
<?php }else if( $value['question_type_id'] == 3 || $value['question_type_id'] == 4){ ?>
<div class="evaluation-wrap <?php echo 'counter_'.$number; ?>" id="<?php echo 'q'.$value['id'] ?>">
<div class="evaluation_q">
<h5>Question : <?php echo $number; ?></h5>
<p><?php echo $value['question_name']; ?></p>
<?php if (isset($value['image']) && !empty($value['image'])) {?>
<img src="<?php echo base_url() .''. $value['image'] ?>" width="auto" height="120">
<?php } ?>
<h5>Answer</h5>
<p><?php echo $value['answer']; ?></p>
</div>
<div class="score_sec">
<span>Scored</span>
<div class="score">
<input type="text" class="answer score" name="answer" id="<?php echo 'text_'.$value['id'] ?>" value="<?php echo $value['review']; ?>">
<input type="hidden" name="out_of" id="<?php echo 'max_'.$value['id'] ?>" value="<?php echo $value['question_mark'] ?>">
</div>
<span> out of <?php echo $value['question_mark'] ?></span>
<button class="score_submit" id="<?php echo 'scoreSubmit_'.$value['id'] ?>" onclick="submit_ans(this.id)">Submit</button>
</div>
<span class="text-success msg"></span>
</div>
<?php }
}
} ?>
<div class="btn-previous-sec">
<div class="btn-pre-one">
<input type="button" value="Previous question" class="btn-pre-inner" onclick="prev()">
</div>
<div class="btn-pre-one">
<button type="button" value="" class="btn-next-inner" onclick="next()">Next question</button>
</div>
<div class="btn-pre-one btn-submit">
<button type="button" value="" class="phy-evlauate btn btn-success" style="background:#28a745; font-size: 13px;" data-toggle="modal" data-target="#submitModal">Submit</button>
</div>
</div>
<!-- model for click -->
<div class="viewDoc delete-modal-wrap" >
<div class="modal fade" id="submitModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<form action="<?php echo base_url()?>teacher/teacher_review_status" method="post">
<?php if (isset($exam_data) && !empty($exam_data)) { ?>
<input type="hidden" name="exams_id" value="<?php echo $exam_data['id']; ?>">
<?php } ?>
<?php if(isset($questions_data) && !empty($questions_data)){ ?>
<input type="hidden" name="student_id" value="<?php echo $questions_data[0]['student_id']; ?>">
<input type="hidden" name="status" value="<?php echo $questions_data[0]['status']; ?>">
<?php } ?>
<div class="delete-modal">
<i class="fas fa-exclamation-circle"></i>
<input type="hidden" id="sdid" />
<h4 >Are you sure?</h4>
<p>Are you sure you want to submit the record?</p>
<div class="delete-modal-btn">
<button type="submit" class="subject_addbtn subject_addbtn_green btn_submit_answer" >Submit</button>
<button type="button" class="subject_addbtn subject_addbtn_cancel" data-dismiss="modal">Cancel</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</main>
<?php if(isset($questions_data) && !empty($questions_data)){
if ($questions_data[0]['status'] == 2) {
?>
<style type="text/css">
.btn-success, .score_submit{
display: none;
}
</style>
<script >
$('.answer').attr('readonly', true);
</script>
<?php } } ?>
<script>
var visibleDiv = 0;
function showDiv()
{
$('.evaluation-wrap').hide();
$(".evaluation-wrap:eq("+ visibleDiv +")").show();
}
showDiv();
function next() {
$('.msg').text('');
if (visibleDiv == $('.evaluation-wrap').length-1) {
visibleDiv = 0;
}else{
visibleDiv ++;
}
showDiv();
}
function prev()
{
$('.msg').text('');
if (visibleDiv == 0) {
visibleDiv = $('.evaluation-wrap').length-1;
}
else{
visibleDiv --;
}
showDiv();
}
function submit_ans(id)
{
var data = id;
var split = data.split('_',2);
var exam_ans_id = split[1];
var mark = $("#text_"+exam_ans_id).val();
var limit_mark = $("#max_"+exam_ans_id).val();
if (Number(mark) <= Number(limit_mark)) {
var formData = new FormData();
formData.append('exam_answer_id', exam_ans_id);
formData.append('marks',mark);
$.ajax({
url: '<?php echo base_url().'teacher/get_questionsAndAnswerEvaluation/'?>',
type:'POST',
data:formData,
contentType:false,
processData:false,
success: function(result) {
if (result == 1) {
$('#text_'+ exam_ans_id).val(mark);
$('.msg').text('Marks added into Database');
}else{
alert('cannot enter more than out of marks');
$('#text_'+ exam_ans_id).val('');
$("#text_"+exam_ans_id).focus();
}
}
});
}else{
alert('cannot enter more than out of marks');
$('#text_'+ exam_ans_id).val('');
$("#text_"+exam_ans_id).focus();
}
}
// function pop_up_message() {
// $('#timeUpModal').modal({
// backdrop: 'static',
// keyboard: false
// });
// }
</script>