File: //proc/thread-self/root/proc/thread-self/cwd/counselor/users-edit-list.php
<?php
include_once('header.php');
include_once('../wp-config.php');
include_once('sten_score_functions.php');
$PSY_USERS = $wpdb->prefix . PSY_USERS;
$PSY_STATES = $wpdb->prefix . PSY_STATES;
$PSY_USERS_DETAILS = $wpdb->prefix . PSY_USERS_DETAILS;
$thisPage = 'users-edit-list';
if (isset($_REQUEST['page'])) {
$pageno = $_REQUEST['page'];
} else {
$pageno = 1;
}
$no_of_records_per_page = 50;
$offset = ($pageno - 1) * $no_of_records_per_page;
$i = $offset + 1;
$countQuery = "SELECT count(u.ID) FROM $PSY_USERS as u LEFT JOIN $PSY_USERS_DETAILS as ud ON ud.user_id=u.ID LEFT JOIN $PSY_STATES as s on s.state_id=ud.state_id";
$total_rows = $wpdb->get_var($countQuery);
$total_pages = ceil($total_rows / $no_of_records_per_page);
$getStudents = "SELECT u.ID,u.user_login,ud.first_name,ud.profile_image,ud.mobile_number,ud.email_address,ud.gender_id,ud.date_of_birth,s.state_name,u.user_registered FROM $PSY_USERS as u LEFT JOIN $PSY_USERS_DETAILS as ud ON ud.user_id=u.ID LEFT JOIN $PSY_STATES as s on s.state_id=ud.state_id order by u.user_registered desc limit $offset,$no_of_records_per_page";
$fetchData = $wpdb->get_results($getStudents);
?>
<style>
.modal-backdrop {
z-index: 999 !important;
}
table.dataTable.nowrap th,
table.dataTable.nowrap td {
white-space: nowrap !important;
}
.page-title {
float: left;
width: 100%;
}
.excel {
float: right;
color: #fff;
}
</style>
<div class="page-inner">
<div class="page-title">
<div class="col-md-4">
<h3> Users MIS </h3>
<div class="page-breadcrumb">
<ol class="breadcrumb">
<li><a href="dashboard">Home</a></li>
<li class="active">Users Edit</li>
</ol>
</div>
</div>
<div class="col-md-8">
<div class="navbar-right">
<ul class="navul">
<!--<li><a href="apt-class">Class List</a></li>-->
</ul>
</div>
</div>
</div>
<div id="main-wrapper">
<div class="col-md-12" style="padding:0;">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">Users List</h4>
<!-- <a href="aptitude-test-excel.php?type=APT&offset=<?php echo $offset; ?>&total=<?php echo $no_of_records_per_page; ?>" target="_blank" class="excel">
<i class="fa fa-file-excel-o" title="Download" style="cursor:pointer;"></i>
</a> -->
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="display " id="userList" style="font-size: 13px;">
<thead>
<tr>
<th>Id</th>
<th>Edit</th>
<th>Login</th>
<th>Name</th>
<th>Email</th>
<th>Mobile</th>
<th>D O B</th>
<th>Reg.on</th>
<th>Gender</th>
<th>State</th>
</tr>
</thead>
<tbody>
<?php
foreach ($fetchData as $tst) {
?>
<tr>
<td><?php echo $i; ?></td>
<td>
<!-- View -->
<a href="edit-user-data?uId=<?php echo $tst->ID; ?>" target="_blank" rel="noopener noreferrer"> <i class="fa fa-edit"></i> </a>
</td>
<td><?php echo $tst->user_login; ?></td>
<td><?php echo $tst->first_name; ?></td>
<td><?php echo $tst->email_address; ?></td>
<td><?php echo $tst->mobile_number; ?></td>
<td><?php echo $tst->date_of_birth == '' ? '---' : date('d M Y',strtotime($tst->date_of_birth)); ?></td>
<td><?php echo date('d M Y',strtotime($tst->user_registered)); ?></td>
<td><?php echo $tst->gender_id; ?></td>
<td><?php echo $tst->state_name; ?></td>
</tr>
<?php $i++;
} ?>
</tbody>
</table>
<div class="btn-group" role="group" aria-label="First group" style="float: right;">
<?php
$k = (($pageno + 4 > $total_pages) ? $total_pages - 4 : (($pageno - 4 < 1) ? 5 : $pageno));
if ($pageno >= 2) {
echo "<a class='btn btn-default' href='$thisPage?page=1'> « </a>";
echo "<a class='btn btn-default' href='$thisPage?page=" . ($pageno - 1) . "'> Prev </a>";
}
for ($j = -4; $j <= 4; $j++) {
if (($k + $j) > 0) {
if ($k + $j == $pageno)
$pagLink .= "<a href='$thisPage?page=" . ($k + $j) . "' class='btn btn-default active'>" . ($k + $j) . "</a>";
else
$pagLink .= "<a class='btn btn-default' href='$thisPage?page=" . ($k + $j) . "'>" . ($k + $j) . "</a>";
}
};
echo $pagLink;
if ($pageno < $total_pages) {
echo "<a class='btn btn-default' href='$thisPage?page=" . ($pageno + 1) . "'> Next </a>";
echo "<a class='btn btn-default' href='$thisPage?page=" . $total_pages . "'> » </a>";
}
echo '<a class="btn btn-default">| Page: ' . $total_pages . '</a><a class="btn btn-default"> | Total Data: ' . $total_rows . '</a>';
?>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Main Wrapper -->
<!-------------------edit ability modal---------------->
<div class="modal fade" id="editAbilityModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" style="border: 3px solid #ccc;">
<div class="modal-header" style="padding: 5px 10px 0px 0px; height: 20px;">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="edit_ability_modal"></div>
</div>
</div>
</div>
<div class="page-footer">
<p class="no-s">shinemetrics.com</p>
</div>
</div>
<!-- Page Inner -->
<link href="assets/css/jquery.dataTables.min.css" rel="stylesheet">
<link href="assets/css/responsive.dataTables.min.css" rel="stylesheet">
<script src="assets/js/jquery.dataTables.min.js"></script>
<script src="assets/js/dataTables.responsive.min.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery.noConflict();
jQuery(function($) {
$('#userList').dataTable({
"bPaginate": false,
"responsive": true,
"order": [
[0, "asc"]
]
});
jQuery('#editAbilityModal').on('show.bs.modal', function(event) {
var button = $(event.relatedTarget);
var abid = button.data('id');
//alert(abid);
var url = "/counselor/apt-ability-edit.php";
jQuery.ajax({
url: url,
type: 'POST',
data: {
abid: abid
},
success: function(data) {
document.getElementById("edit_ability_modal").innerHTML = data;
}
})
})
});
function submitAprForm() {
if (document.getElementById("descr").value == '') {
alert("Description can not empty");
document.getElementById("descr").focus();
event.preventDefault();
return false;
}
}
</script>
<?php include_once('footer.php'); ?>