File: /var/www/content-sp/work-sp/nqb_questions_flag.php
<?php
include_once('nqb_report_section.php');
// error_reporting(0);
// error_reporting(E_ALL);
// ini_set('display_errors', 'On');
//check edit permissions
$fileName = 'nqb_questions_add_report';
if (in_array($fileName, $pageArray)) {
$adminId = $editor_id;
$curDate = date('Y-m-d');
$SP_MEDIUM = 'csp_sp_medium';
$SP_EDITORS = 'csp_editors';
$SP_QUES_HISTORY = 'csp_sp_question_history';
//editors
$editors = $conn->query("SELECT editor_id,contact_name FROM $SP_EDITORS where team_id='3' order by editor_id");
/**search */
if(isset($_REQUEST['search_data'])) {
$es_editor = $_REQUEST['es_editor'];
$es_ondate = $_REQUEST['es_ondate'];
$es_fromdate = $_REQUEST['es_fromdate'];
$es_todate = $_REQUEST['es_todate'];
$subQuery = '';
if($es_editor != '') {
$subQuery .= "and h.action_by='$es_editor' ";
}
if($es_ondate !='') {
$q_date = date('Y-m-d',strtotime($es_ondate));
$subQuery .= "and date(h.action_date)='$q_date'";
}
if($es_fromdate !='' && $es_todate !='') {
$fromDate = date('Y-m-d',strtotime($es_fromdate));
$toDate = date('Y-m-d',strtotime($es_todate));
$subQuery .= "and (date(h.action_date) BETWEEN '$fromDate' AND '$toDate'";
}
$_SESSION['preadT_subQuery'] = $subQuery;
}
if (!empty($_SESSION['preadT_subQuery'])) {
$mergeFilter = $_SESSION['preadT_subQuery'];
} else {
$mergeFilter = "and date(h.action_date)='$curDate'";
}
$getAddData = "SELECT h.question_id,h.action_date,m.medium_name,ed.contact_name FROM $SP_QUES_HISTORY as h LEFT JOIN $SP_MEDIUM as m on m.medium_id=h.medium_id LEFT JOIN $SP_EDITORS as ed on ed.editor_id=h.action_by WHERE h.action IN(3,4) and h.ref_id IS NOT NULL $mergeFilter";
$getWorkData = $conn->query($getAddData);
?>
<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>
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" />
<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">
var jq = jQuery.noConflict();
jq(document).ready(function() {
jq('#assign_table').dataTable({
"bPaginate": true,
bFilter: true,
"responsive": true,
"iDisplayLength": 100,
"order": [
[0, 'desc']
]
});
jq("#date").datepicker({
changeMonth: true,
changeYear: true
});
jq("#todate").datepicker({
changeMonth: true,
changeYear: true
});
jq("#fromdate").datepicker({
changeMonth: true,
changeYear: true
});
});
</script>
<div class="row">
<div class="col-md-12">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">Search Filter</h4>
</div>
<div class="spacer"></div>
<div class="panel-body">
<form class="form-horizontal" method="post" onSubmit="return validateForm();">
<div class="form-group">
<label for="editor" class="col-sm-2">Select Editor</label>
<div class="col-sm-10">
<select name="es_editor" class="form-control" id="editor">
<option value="">--Editors--</option>
<?php while ($ms = $editors->fetch_assoc()) { ?>
<option value="<?php echo $ms['editor_id']; ?>"><?php echo $ms['editor_id'] . '|' . $ms['contact_name']; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<label for="date" class="col-sm-2">On Date</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="es_ondate" id="date" placeholder="On Date">
</div>
</div>
<div class="form-group">
<label for="date" class="col-sm-2">From/To Date</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="es_fromdate" id="fromdate" placeholder="From Date">
</div>
<div class="col-sm-4">
<input type="text" class="form-control" name="es_todate" id="todate" placeholder="To Date">
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="Search" name="search_data">
</div>
</form>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">Questions ProofRead Data (Translated)</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>Ques Id</th>
<th>Medium</th>
<th>Add By</th>
<th>Add Date</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
while ($gwd = $getWorkData->fetch_assoc()) {
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $gwd['question_id']; ?></td>
<td><?php echo $gwd['medium_name']; ?></td>
<td><?php echo $gwd['contact_name']; ?></td>
<td><?php echo $gwd['action_date']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?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');
?>