File: /var/www/content-sp/work-sp/nqb_proofread_previousyear_data.php
<?php
include_once('nqb_proofread_section.php');
$SP_QUESTION = 'csp_sp_question';
$SP_QUESTION_MEDIUM_WISE = 'csp_sp_question_medium_wise';
$TT_PREVIOUS_EXAM_TABLE = 'csp_sp_previous_exam';
$adminId = $editor_id;
$allExmQuery = "SELECT pe.id, pe.exam_name from $TT_PREVIOUS_EXAM_TABLE as pe order by pe.exam_name asc";
$allExmData = $conn->query($allExmQuery);
$getQuesData = array();
if (isset($_POST["submit"])) {
$preExam = $_POST['preExam'];
if ($preExam != '') {
$getQuesQuery = "SELECT previous_exam_name, previous_exam_year, exam_shift, count(question_id) as qnc,count(case when status='4' then 1 end) as pf_q from $SP_QUESTION where previous_exam_name='$preExam' group by previous_exam_year, exam_shift order by previous_exam_year, exam_shift";
$getQuesData = $conn->query($getQuesQuery);
}
}
$spaceArray = array(" & ", "+");
$replaceArray = array(" and ", "plus");
?>
<style>
.table-hover th,
td {
font-size: 13px;
}
.redClass {
background-color: #ff6d6d !important;
}
.orangeClass {
background-color: #ff7607 !important;
}
.modal-backdrop.in {
opacity: 0.9 !important;
z-index: 9 !important;
}
.topic {
width: 20%;
float: left;
font-size: 14px;
margin: 0 0 0 0;
}
.sub_topic {
width: 26%;
float: left;
font-size: 14px;
margin: 0 0 0 -19px;
}
</style>
<?php if (isset($msg)) { ?>
<div class="row">
<div class="col-sm-12">
<?php echo $msg; ?>
</div>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<div class="panel panel-white">
<div class="panel-heading clearfix">
<h4 class="panel-title">Select Exam</h4>
</div>
<div class="panel-body">
<form class="form-inline" method="post" onSubmit="return validateForm();">
<div class="form-group">
<select name="preExam" class="form-control" id="preExam">
<option value="">--Previous Year Exam--</option>
<?php foreach ($allExmData as $exm) { ?>
<option value="<?php echo $exm['exam_name']; ?>" <?php if (@$_POST['preExam'] == $exm['exam_name']) echo "selected"; ?>><?php echo $exm['exam_name']; ?></option>
<?php } ?>
</select>
</div>
<input class="btn btn-info" type="submit" value="Search" name="submit" />
</form>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-info">
<div class="col-md-6">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">Previous Year Question Data (New System)</h4>
</div>
<table class="table table-hover">
<tr>
<th>S.No.</th>
<th>Exam Name</th>
<th>Exam Year</th>
<th>Shift (if any)</th>
<th>Questions Count</th>
<th>Proof Read Count</th>
<th>View</th>
</tr>
<?php
$i = 1;
$qTotal = 0;
$rTotal = 0;
foreach ($getQuesData as $qb) {
$qTotal = $qTotal + $qb['qnc'];
$rTotal = $rTotal + $qb['pf_q'];
$examName = str_replace($spaceArray, $replaceArray, $qb['previous_exam_name']);
$shift = str_replace($spaceArray, $replaceArray, $qb['exam_shift']);
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $qb['previous_exam_name']; ?></td>
<td><?php echo $qb['previous_exam_year']; ?></td>
<td><?php echo $qb['exam_shift']; ?></td>
<td><?php echo $qb['qnc']; ?></td>
<td><?php echo $qb['pf_q']; ?></td>
<td><a style="text-decoration:none; color: #0050ef;font-size:20px;" href="nqb_proofread_previousyear_ques_view?viewIn=HI&year=<?php echo $qb['previous_exam_year'] . '&exam=' . $examName . '&shift=' . $shift; ?>" target="_blank" title="View questions"> <i class="fa fa-eye"></i> </a>
<a style="text-decoration:none; color: #0050ef;font-size:20px;" href="javascript:void(0);" title="Translated Questions"> <i class="fa fa-language" onclick="viewTranslated('<?php echo $qb['previous_exam_name']; ?>','<?php echo $qb['previous_exam_year']; ?>','<?php echo $qb['exam_shift']; ?>')"></i> </a>
</td>
</tr>
<?php $i++;
} ?>
<tr>
<th> </th>
<th>Total</th>
<th><?php echo $qb['previous_exam_year']; ?></th>
<th> </th>
<th><?php echo $qTotal; ?></th>
<th><?php echo $rTotal; ?></th>
</tr>
</table>
</div>
</div>
<div class="col-md-6" id="scrollHere">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">Translated in other languages <span id="appendId"></span></h4>
</div>
<table class="table table-hover" id="t_data">
<h3 class="title"> <i class="fa fa-arrow-left"></i> Click on language icon </h3>
</table>
</div>
</div>
</div>
</div>
<div class="page-footer">
<p class="no-s">Graposs Connect ©</p>
</div>
</div>
<!-------- question status modal -------->
<script>
function viewTranslated(exam, year, shift) {
var arr = {
"exam": exam,
"year": year,
"shift": shift
};
jQuery("#appendId").html(' [' + exam + ' >> ' + year + ' >> ' + shift + ']');
jQuery("html, body").animate({
scrollTop: $('#scrollHere').offset().top
}, 1000);
jQuery("#t_data").html("<i class='fa fa-spinner fa-spin' style='font-size:50px;padding:10px 0 10px 0;margin-left:50%;'></i>");
jQuery.ajax({
type: "POST",
url: "ajax_call/nqb_proofread_previousyear_data_translated.php",
data: JSON.stringify(arr),
contentType: 'application/json; charset=utf-8',
dataType: 'HTML',
success: function(data) {
jQuery("#t_data").html(data);
}
});
}
</script>
<?php
include_once('footer.php');
?>