/
indexPersonal.php
129 lines (121 loc) · 4.44 KB
/
indexPersonal.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
<?php
require './clases/AutoCarga.php';
$sesion = new Session();
if(!$sesion->isLogged()){
header("Location:login.php");
exit();
}
$bd = new DataBase();
$gestor = new ManageUsuario($bd);
$usuario = $sesion->getUser();
$email = $usuario->getEmail();
$alias = $usuario->getAlias();
$fecha = $usuario->getFechaalta();
$status = "Personal";
if($usuario->getPersonal() == 0) {
$sesion->sendRedirect("index.php");
}
if($usuario->getAdministrador() == 1) {
$sesion->sendRedirect("indexAdmin.php");
}
//paginación
$page = Request::get("page");
if ($page === null || $page === "") {
$page = 1;
}
$order = Request::get("order");
$sort = Request::get("sort");
$orden = "$order $sort";
$nrpp = Request::get("nrpp");
$registros = $gestor->count();
$pages = ceil($registros / Constants::NRPP);
if ($nrpp === "" || $nrpp === null) {
$nrpp = Constants::NRPP;
}
$queryString = "";
if (trim($page) != "") {
$queryString = "&nrpp=$nrpp";
}
$usuarios = $gestor->getList($page, trim($orden), $nrpp);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!--
<meta name="google-signin-scope" content="profile email">
<meta name="google-signin-client_id" content="144315405047-hu44apt2g5q2akupkjalbk66ctmm0irb.apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer></script>
-->
<link rel="stylesheet" href="css/style.css" type="text/css" />
<script type="text/javascript" src="js/jquery-2.1.4.js"></script>
<script type="text/javascript" src="js/javascript.js"></script>
<title>Iniciar Sesión</title>
</head>
<body>
<div class="wrap">
<aside class="profile">
<img src="images/user.jpg" />
<p>Email: <?= $email; ?></p>
<p>Alias: <?= $alias; ?></p>
<p>Fecha de alta: <?= $fecha; ?></p>
<p>Estatus: <?= $status; ?></p>
</aside>
<section class="action">
<h1>Bienvenido <?= $alias; ?></h1>
<section class="enlaces">
<a href="edit.php">Editar datos</a>
<a href="cambiarmail.php">Cambiar email</a>
<a href="viewinsert.php">Nuevo usuario</a>
<!--<a href="uploadFile.php">Subir imagen</a>-->
<a class="red" href="phplogout.php">Log Out</a>
<a class="red" href="phpdeleteaccount.php">Delete Account</a>
</section>
</section>
</div>
<table class="table-fill">
<tr>
<th>Email</th>
<th>Alias</th>
<th>Fecha de alta</th>
<th>Activo</th>
<th>Administrador</th>
<th>Personal</th>
<th>Acciones</th>
</tr>
<tfoot>
<tr>
<td>
<span id="page"><?= "Página $page de ". ceil($registros/$nrpp) ?></span>
</td>
<td class="paginacion" colspan="5">
<a href="?<?= $queryString ?>">Primero</a>
<a href="?page=<?= max(1, $page - 1) . $queryString ?>">Anterior</a>
<a href="?page=<?= min($page + 1, $pages) . $queryString; ?>">Siguiente</a>
<a href="?page=<?= ceil($registros/$nrpp) . $queryString; ?>">Última</a>
</td>
<td>
<span>Total: <?= $bd->count("usuario") ?></span>
</td>
</tr>
</tfoot>
<?php
foreach ($usuarios as $indice => $usuario) {
if($usuario->getAdministrador() !== "1") {
?>
<tr>
<td><?php echo $usuario->getEmail(); ?></td>
<td><?php echo $usuario->getAlias(); ?></td>
<td><?php echo $usuario->getFechaalta(); ?></td>
<td><?php echo $usuario->getActivo(); ?></td>
<td><?php echo $usuario->getAdministrador(); ?></td>
<td><?php echo $usuario->getPersonal(); ?></td>
<td class="accion"><?php echo "<a class='editar' href='vieweditAdmin.php?email={$usuario->getEmail()}'><img src='../images/edit.png'/></a>"; ?></td>
<?php
}
}
?>
</tr>
</table>
</body>
</html>