-
Notifications
You must be signed in to change notification settings - Fork 10
/
activeusers.php
176 lines (124 loc) · 6.38 KB
/
activeusers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php include 'app/inc/header.php'; ?>
<?php
// Delete Role By Id
$delid = isset($_GET['delid']) ? $_GET['delid'] : '';
if (isset($_GET['delid']) && isset($_GET['remove']) == 'removeid') {
$delid = preg_replace('/[^a-zA-Z0-9-]/', '', $_GET['delid']);
$deUserByid = $usr->deleteUserById($delid);
}
?>
<?php
// Id disable method
$disid = isset($_GET['disid']) ? $_GET['disid'] : '';
if(isset($_GET['disid'])){
$disid = preg_replace('/[^a-zA-Z0-9-]/', '', $_GET['disid']);
$disableId = $usr->DisableUserById($disid);
}
// Id Enable method
$enid = isset($_GET['enid']) ? $_GET['enid'] : '';
if(isset($_GET['enid'])){
$enid = preg_replace('/[^a-zA-Z0-9-]/', '', $_GET['enid']);
$enableId = $usr->EnableUserById($enid);
}
?>
<!--====== Start Main Wrapper Section======-->
<section class="d-flex" id="wrapper">
<?php include 'app/inc/sidebar.php'; ?>
<div class="page-content-wrapper">
<!-- Header BreadCrumb -->
<div class="content-header">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="dashboard.php"><i class="material-icons">home</i>Home</a></li>
<li class="breadcrumb-item"><a href="users.php">Users</a></li>
<li class="breadcrumb-item active" aria-current="page">Active user</li>
</ol>
</nav>
<div class="create-item">
<a href="users.php" class="btn btn-secondary"><i class="material-icons md-18">arrow_back</i>Back To Userlist</a>
</div>
</div>
<!-- Header BreadCrumb -->
<?php
if (isset($deUserByid)) {
echo $deUserByid;
}
if (isset($enableId)) {
echo $enableId;
}
if (isset($disableId)) {
echo $disableId;
}
?>
<!-- main-content -->
<div class="main-content">
<!-- Users DataTable-->
<div class="row mt-3">
<div class="col-md-12">
<div class="card bg-white">
<div class="card-body mt-3">
<div class="table-responsive">
<table id="usersTable" class="table table-striped table-borderless" style="width:100%">
<thead>
<tr>
<th>SL</th>
<th>Avatar</th>
<th>Name</th>
<th>Email</th>
<th>Role</th>
<th>Status</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
$userlist = $usr->onlyActiveUsers();
if ($userlist) {
$i = 0;
while ($result = $userlist->fetch_assoc()) {
$i++;
?>
<tr>
<td class="pt-4" <?php if ($result['status'] == '1') { ?>
style='color:red'
<?php } ?>><?php echo $i; ?>
</td>
<?php
$avatar = $result['profilePhoto'];
if(is_file($avatar)){ ?>
<td><img id="avatar-css" width="50" height="50" align='middle'src="<?php echo $avatar; ?>" alt="your image" title=''/></td>
<?php }else{?>
<td><img id="avatar-css" width="50" height="50" align='middle'src="app/uploads/userAvatar/dev.jpg" alt="your image" title=''/></td>
<?php } ?>
<td class="pt-4"><?php echo $result['name']; ?></td>
<td class="pt-4"><?php echo $result['email']; ?></td>
<td class="pt-4"><span class="badge badge-lg badge-secondary text-white"><?php echo $result['rolename']; ?></span></td>
<td class="pt-4">
<?php if ($result['status'] == '0') {?>
<span class="badge badge-lg badge-success text-white">Active</span>
<?php }elseif($result['status'] == '1'){ ?>
<span class="badge badge-lg badge-info text-white">Deactive</span>
<?php } ?>
</td>
<td class="text-center pt-3">
<a class="btn btn-secondary" href="viewuser.php?viewuser=<?php echo $result['userid']; ?>"> View user </a>
<a class="btn btn-danger" onclick="return confirm('Are you sure to Delete account ?')" href="?delid=<?php echo $result['userid']; ?>"> Delete </a></td>
</tr>
<?php }}else{ ?>
<tr>
<td colspan="7" class="text-center">No active users yet !</td>
</tr>
<?php } ?>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- Users DataTable-->
</div>
<!-- main-content -->
</div>
</section>
<!--====== End Main Wrapper Section======-->
<?php include 'app/inc/footer.php'; ?>