-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
72 lines (69 loc) · 3.24 KB
/
index.php
File metadata and controls
72 lines (69 loc) · 3.24 KB
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
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once("/Applications/MAMP/htdocs/codeReaders/view/head/head.php");
require_once("/Applications/MAMP/htdocs/codeReaders/controller/BookController.php");
$obj = new controller();
$rows = $obj->index();
?>
<div class="container">
<table class="table">
<thead>
<tr>
<th scope="col">Título</th>
<th scope="col">Autor</th>
<th scope="col">Imagen</th>
</tr>
</thead>
<tbody>
<?php if ($rows): ?>
<?php foreach ($rows as $row): ?>
<tr>
<th>
<?= $row[1] ?>
</th>
<th>
<?= $row[2] ?>
</th>
<th class="tapa">
<img class="card-img-top" src="data:image;base64,<?php echo base64_encode($row[4]); ?>">
</th>
<th class="d-flex flex-column">
<a href="/codeReaders/view/book/edit.php?id=<?= $row[0] ?>" class="btn btn-primary">Editar</a>
<!-- Button trigger modal -->
<a class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#exampleModal">Eliminar</a>
<a href="view/book/show.php?id=<?= $row[0] ?>" class="btn btn-info">+ Info</a>
</th>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="exampleModalLabel">Desea eliminar el registro?</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
Una vez eliminado no se podrá recuperar el registro.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">Cerrar</button>
<a href="view/book/delete.php?id=<?= $row[0] ?>" class="btn btn-danger">Eliminar</a>
</div>
</div>
</div>
</div>
</th>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="3" class="text-center">No hay registros</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<?php
require_once("/Applications/MAMP/htdocs/codeReaders/view/head/footer.php");
?>