-
Notifications
You must be signed in to change notification settings - Fork 0
/
adminPagina.php
122 lines (117 loc) · 4.82 KB
/
adminPagina.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
<?php
session_start();
if (!isset($_SESSION['user_name'])) {
header("Location: access.php");
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Administrador</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<!--Header-->
<div class="header">
<div>
<a href="inicio.php">
<img src="images/logo_letra.png">
</a>
<div class="buttons">
<a href="database/logout.php">
<button>
<div class="button-circle"></div>
Cerrar Sesión
</button>
</a>
</div>
</div>
</div>
<div class="scroll-container" id="reservations-container">
<h1>Documentos Publicados</h1>
<?php
require 'database/database.php';
$pdo = Database::connect();
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "SELECT a.idAutor, a.Nombre, a.Apellidos, a.Especializacion, a.nombreInstitucion, b.idDocumento, b.Titulo, b.Indole, b.Estado
FROM Autor a
JOIN Biblioteca b ON a.idAutor = b.idAutor
WHERE b.Estado = 'Pendiente'";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (empty($result)) {
echo '<div>
<div>
<p>No hay documentos por procesar.</p>
</div>
</div>';
} else {
foreach ($result as $row) {
echo '<div class="item-container">
<div class="table-container">
<table>
<tr>
<td><div>' . htmlspecialchars($row['Titulo']) . '</div></td>
</tr>
<tr>
<td><div class="name">' . htmlspecialchars($row['Nombre']) . ' ' . htmlspecialchars($row['Apellidos']) . '</div></td>
</tr>
<tr>
<td><div class="name">' . htmlspecialchars($row['Indole']) . '</div></td>
</tr>
<tr>
<td><div>Estado: ' . htmlspecialchars($row['Estado']) . '</div></td>
</tr>
<tr>
<td>
<form method="GET" action="database/validateDocumento.php">
<input type="hidden" name="id" value="' . htmlspecialchars($row['idDocumento']) . '">
<button type="submit" class="accept">Validación</button>
</form>
</td>
</tr>
<tr>
<td>
<form method="GET" action="database/deleteDocumento.php">
<input type="hidden" name="id" value="' . htmlspecialchars($row['idDocumento']) . '">
<button type="submit" class="delete-btn">Eliminar</button>
</form>
</td>
</tr>
</table>
</div>
<div class="table-container">
<table>
<tr>
<td><div class="name">' . htmlspecialchars($row['Nombre']) . ' ' . htmlspecialchars($row['Apellidos']) . '</div></td>
</tr>
<tr>
<td><div class="name">' . htmlspecialchars($row['nombreInstitucion']) . '</div></td>
</tr>
<tr>
<td><div class="name">' . htmlspecialchars($row['Titulo']) . '</div></td>
</tr>
<tr>
<td><div class="name">' . htmlspecialchars($row['Especializacion']) . '</div></td>
</tr>
<tr>
<td>
<form method="GET" action="database/deleteAutor.php">
<input type="hidden" name="id" value="' . htmlspecialchars($row['idAutor']) . '">
<button type="submit" class="delete-btn">Eliminar Autor y Documentos</button>
</form>
</td>
</tr>
</table>
</div>
</div>';
}
}
Database::disconnect();
?>
</div>
</body>
</html>