-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusers.php
111 lines (101 loc) · 4.89 KB
/
users.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
<?php session_start(); ?>
<?php
if(!isset($_SESSION['valid'])) {
header('Location: login.php');
}
?>
<?php
include_once("connection.php");
$result = mysqli_query($mysqli, "SELECT users.*, roles.id AS rolesId, roles.name AS rolesName, roles.products AS permissionProducts, roles.roles AS permissionRoles, roles.audit AS permissionAudit, roles.users AS permissionUsers FROM users INNER JOIN roles ON users.role = roles.id ORDER BY name ASC");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Lista de roles | Gabriel Peña & Manuel Albarran</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container users-list">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2>Lista de usuarios</h2>
</div>
<div class="col-sm-6">
<a href="logout.php" class="btn btn-danger">
<i class="material-icons">exit_to_app</i> <span>Salir</span>
</a>
<a href="add_user.php" class="btn btn-success">
<i class="material-icons"></i> <span>Crear usuario</span>
</a>
<a href="index.php" class="btn btn-success">
<i class="material-icons">home</i> <span>Inicio</span>
</a>
</div>
</div>
</div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th id="name_header">Nombre</th>
<th id="mail_header">Correo</th>
<th id="username_header">Usuario</th>
<th id="role_header">Rol</th>
<th id="status_header">Estado</th>
<th id="action_header">Acción</th>
</tr>
</thead>
<tbody>
<?php
while($res = mysqli_fetch_assoc($result)) {
if($res['active'] == 1){
$status = 'Activo';
$icon = 'block';
$class = 'delete';
$text = 'Bloquear';
}else{
$status = 'Inactivo';
$icon = 'check';
$class = 'active';
$text = 'Activar';
}
?>
<tr class="user-item">
<?php echo "<td>".$res['name']."</td>"?>
<?php echo "<td>".$res['email']."</td>"?>
<?php echo "<td>".$res['username']."</td>"?>
<?php echo "<td>".$res['rolesName']."</td>"?>
<?php echo "<td>".$status."</td>"?>
<td class="<?php echo $classHide ?>">
<a href="edit_user.php?id=<?php echo $res[id]?>" class="edit">
<i class="material-icons" data-toggle="tooltip" title="Editar"></i>
</a>
<a href="block_user.php?id_user=<?php echo $res[id]?>&name_user=<?php echo $res[name]?>&active=<?php echo $res[active]?>"
class="<?php echo $class?>">
<i class="material-icons" data-toggle="tooltip"
title="<?php echo $text?>"><?php echo $icon?></i>
</a>
<a href="user_detail.php?id=<?php echo $res[id]?>" class="datail">
<i class="material-icons" data-toggle="tooltip" title="Ir al detalle">input</i>
</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</body>
</html>