File: /var/www/content-sp/work-sp/nqb_proofread_access_report_datewise.php
<?php
include_once('nqb_proofread_section.php');
// error_reporting(0);
// error_reporting(E_ALL);
// ini_set('display_errors', 'On');
//check edit permissions
$fileName = 'nqb_proofread_access_datewise';
if (in_array($fileName, $pageArray)) {
$adminId = $editor_id;
$curDate = date('Y-m-d H:i:s');
$SP_MASTER_CATEGORY = 'csp_sp_master_category';
$SP_MASTER_STRUCTURE = 'csp_sp_master_structure';
$SP_MEDIUM = 'csp_sp_medium';
$SP_EDITORS = 'csp_editors';
$SP_MASTER_PROOF_READ_ACCESS = 'csp_proofread_access';
$SP_QUESTION = 'csp_sp_question';
$SP_QUESTION_MEDIUM_WISE = 'csp_sp_question_medium_wise';
$getWorkQuery = "SELECT ac.id, ta.contact_name as tto, tb.contact_name as tby, ac.assign_date, ac.status, ac.medium_id,md.medium_name as source_med,tmd.medium_name as tar_med,ac.target_medium,tmd.medium_code,ac.assign_to,ac.questions,ac.level_status from $SP_MASTER_PROOF_READ_ACCESS as ac LEFT JOIN $SP_MASTER_CATEGORY as mc ON mc.master_id=ac.master_id LEFT JOIN $SP_MASTER_STRUCTURE as s ON s.sub_id=ac.subject_id LEFT JOIN $SP_MASTER_STRUCTURE as t ON t.sub_id=ac.topic_id LEFT JOIN $SP_MASTER_STRUCTURE as st ON st.sub_id=ac.sub_topic_id LEFT JOIN $SP_EDITORS as ta ON ta.editor_id=ac.assign_to LEFT JOIN $SP_EDITORS as tb ON tb.editor_id=ac.assign_by LEFT JOIN $SP_MEDIUM as md ON md.medium_id=ac.medium_id LEFT JOIN $SP_MEDIUM as tmd ON tmd.medium_id=ac.target_medium where ac.status IN('0','1') and ac.assign_type='datewise' order by ac.id desc";
$getWorkData = $conn->query($getWorkQuery);
?>
<style>
.form-group select {
height: 34px;
}
.modal-backdrop {
z-index: 999 !important;
}
.radio_ans {
top: -2px;
left: 11px;
height: 15px !important;
width: 25px !important;
background-color: #eee !important;
border-radius: 50%;
position: relative !important;
opacity: 1 !important;
}
select.form-control {
width: 15em !important;
}
table.dataTable {
font-size: 13px;
}
.delWork {
color: red;
font-size: 15px;
cursor: pointer;
margin-left: 4px;
}
.tddd {
cursor: pointer;
}
</style>
<script src="assets/plugins/jquery/jquery-2.1.3.min.js"></script>
<script src="assets/plugins/jquery-ui/jquery-ui.min.js"></script>
<link href="assets/plugins/datatables/css/jquery.datatables.min.css" rel="stylesheet">
<link href="assets/plugins/datatables/css/responsive.datatables.min.css" rel="stylesheet">
<script src="assets/plugins/datatables/js/jquery.datatables.min.js"></script>
<script src="assets/plugins/datatables/js/jquery.datatables.js"></script>
<script src="assets/plugins/datatables/js/datatables.responsive.min.js"></script>
<script type="text/javascript">
jQuery.noConflict();
jQuery(function($) {
$('#assign_table').dataTable({
"bPaginate": true,
bFilter: true,
"responsive": true,
"iDisplayLength": 100,
"order": [
[0, 'desc']
]
});
});
</script>
<div class="row">
<div class="col-md-12">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">Previous Year Assign Questions</h4>
</div>
<div class="spacer"></div>
<div class="panel-body">
<div class="table-responsive">
<table id="assign_table" class="display table" style="width: 100%; cellspacing: 0;">
<thead>
<tr>
<th>Id</th>
<th>Status</th>
<th>Date Wise(add on date)</th>
<th>Source</th>
<th>Target</th>
<th>Total</th>
<th>Done</th>
<th>To</th>
<th>By</th>
<th>Date</th>
<th>View</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
while ($gwd = $getWorkData->fetch_assoc()) {
if ($gwd['status'] == '0') {
$sts = '<font style="color:red;">DeActive</font>';
} else if ($gwd['status'] == '1') {
$sts = '<font style="color:green;">Active</font>';
}
$medium = $gwd['medium_id'];
$medium_code = $gwd['medium_code'];
$target_medium = $gwd['target_medium'];
$questions = $gwd['questions'];
$dateDetails = $conn->query("SELECT add_date FROM $SP_QUESTION where question_id IN($questions)");
$dateData = $dateDetails->fetch_assoc();
if ($questions != '') {
$level_status = $gwd['level_status'];
if ($level_status == '0') {
$subSt = "and sq.status='4'";
} else {
$subSt = '';
}
$limitQues = sizeof(explode(",", $questions));
$doneCount = $conn->query("SELECT count(sq.question_id) as doneTot from $SP_QUESTION_MEDIUM_WISE as sq where sq.question_id IN($questions) and medium_id='$target_medium' $subSt");
$dct = $doneCount->fetch_assoc();
$doneF = $dct['doneTot'];
} else {
$limitQues = '--';
$doneF = '--';
}
?>
<tr>
<td><?php echo $gwd['id']; ?></td>
<td id="td_<?php echo $gwd['id']; ?>">
<font id="fnt_<?php echo $gwd['id']; ?>" class="tddd"><?php echo $sts; ?></font><i class="fa fa-trash delWork" id="ico_<?php echo $gwd['id']; ?>"></i>
</td>
<td><?php echo date('d-m-Y',strtotime($dateData['add_date'])); ?></td>
<td><?php echo $gwd['source_med']; ?></td>
<td><?php echo $gwd['tar_med']; ?></td>
<td><?php echo $limitQues; ?></td>
<td><?php echo $doneF; ?></td>
<td><?php echo $gwd['tto']; ?></td>
<td><?php echo $gwd['tby']; ?></td>
<td><?php echo date('d-m-Y', strtotime($gwd['assign_date'])); ?></td>
<td><a target="_blank" href="nqb_proofread_datewise_ques_view.php?uniqueID=<?php echo $gwd['id']; ?>">User View</a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="page-footer">
<p class="no-s">Graposs Connect ©</p>
</div>
</div>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery('.tddd').on('click', function() {
var idd = this.id;
var wid = idd.substring(4);
var loadUrl = "ajax_call/nqb_proofread_access_update.php?wid=" + wid + "&typ=upd";
var jqxhr = jQuery.get(loadUrl);
jqxhr.success(function(data) {
jQuery("#fnt_" + wid).html(data);
});
});
jQuery(document).on('click', '.delWork', function() {
var idd = this.id;
var wid = idd.substring(4);
var loadUrl = "ajax_call/nqb_proofread_access_update.php?wid=" + wid + "&typ=del";
var jqxhr = jQuery.get(loadUrl);
jqxhr.success(function(data) {
jQuery("#td_" + wid).html(data);
});
});
});
</script>
<?php
} else {
echo "<script type='text/javascript'>alert('You dont have access to view this report');</script>";
echo "<script type='text/javascript'>location.href='/work-sp';</script>";
}
include_once('footer.php');
?>