File: /var/www/content-sp/work-sp/nqb_user_list.php
<?php
// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
include_once('nqb_user_section.php');
$curDateTime = date('Y-m-d H:i:s');
//check edit permissions
$fileName = str_replace('.php', '', basename($_SERVER['REQUEST_URI'], '?' . $_SERVER['QUERY_STRING']));
if (in_array($fileName, $pageArray)) {
$SP_EDITORS = 'csp_editors';
$edData = $conn->query("select e.* from $SP_EDITORS as e where editor_status='1' order by e.editor_id asc");
?>
<style>
.table-hover th,
td {
font-size: 13px;
}
.sorting_1 {
text-align: right;
}
</style>
<link rel="stylesheet" type="text/css" href="assets/plugins/jquery-ui/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/datatables.responsive.min.js"></script>
<script type="text/javascript">
var jq = jQuery.noConflict();
jq(document).ready(function() {
jq('#user_list').dataTable({
"responsive": true,
"order": [
[0, 'asc']
],
"bPaginate": true,
"iDisplayLength": 50,
"lengthMenu": [
[50, 100, 300, 500, 1000],
[50, 100, 300, 1000, "All"]
]
});
});
</script>
<div class="row">
<div class="col-md-12">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title" style="width: 100%;">
<span style="width:90%; float:left;">
All Users List
</span>
</h4>
</div>
<div class="panel-body">
<div class="table-responsive">
<table id="user_list" class="display table" style="width: 100%;">
<thead>
<tr>
<th>S.No.</th>
<th>Status</th>
<th>Id</th>
<th>Login</th>
<th>Name</th>
<th>Email</th>
<th>Mobile</th>
<th>Masters</th>
<th>Download</th>
<th>Add Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
while ($ed = $edData->fetch_assoc()) {
$ch_id = $ed['editor_id'];
$currentSt = $ed['editor_status'];
if ($ed['editor_status'] == '1') {
$status = '<span id="badge_'.$i.'" style="cursor:pointer;" class="badge badge-success" onclick="updateSt(' . $ch_id . ','.$i.')">Active</span>';
} else {
$status = '<span id="badge_'.$i.'" style="cursor:pointer;" class="badge badge-danger" onclick="updateSt(' . $ch_id . ','.$i.')">De-active</span>';
}
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $status; ?></td>
<td><?php echo $ed['editor_id']; ?></td>
<td><?php echo $ed['editor_login']; ?></td>
<td><?php echo $ed['display_name']; ?></td>
<td><?php echo $ed['official_email']; ?></td>
<td><?php echo $ed['contact_no']; ?></td>
<td><?php echo $ed['q_masters']; ?></td>
<td><?php echo $ed['download_access']; ?></td>
<td><?php echo $ed['added_date']; ?></td>
<td>
<a target="_blank" href="./nqb_user_edit?ed_id=<?php echo $ed['editor_id']; ?>" title="Edit Details">
<i class="fa fa-edit"></i>
</a>
</td>
</tr>
<?php $i++;
} ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div><!-- Main Wrapper -->
<div class="page-footer">
<p class="no-s">content.grapossconnect.com</p>
</div>
<script>
function updateSt(editor, i) {
var url = "ajax_call/nqb_user_status.php";
var arr = {
"editor": editor,
};
jQuery.ajax(url, {
type: 'POST',
data: JSON.stringify(arr),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(data) {
if (data.status == '1') {
jQuery("#badge_"+i).html(data.value);
jQuery("#badge_"+i).removeClass("badge-danger");
jQuery("#badge_"+i).removeClass("badge-success");
jQuery("#badge_"+i).addClass(data.class);
} else {
alert(data.message);
}
},
error: function(jqXhr, textStatus, errorMessage) {}
});
}
</script>
<?php
} else {
echo "<script type='text/javascript'>alert('You dont have access');</script>";
echo "<script type='text/javascript'>location.href='/work-sp';</script>";
}
include_once('footer.php');
?>