-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
78 lines (70 loc) · 3.66 KB
/
index.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
<?php
require __DIR__ .'/users/users.php';
$users = getUsers();
include "partials/header.php";
?>
<div class="container">
<p>
<a class="btn btn-success" href="create.php"><i class="bi bi-plus"></i> Create new User</a>
</p>
<table class="table table-striped">
<thead>
<tr>
<th>Image</th>
<th>Name</th>
<th>Username</th>
<th>Email</th>
<th>Website</th>
<th>Actions</th>
</tr>
</thead>
<?php if (count($users) > 0) : ?>
<tbody>
<?php foreach ($users as $user): ?>
<tr>
<td class="align-middle">
<?php if (isset($user['extension'])): ?>
<img style="width: 60px; height: 60px; border-radius: 50%" src="<?php echo "/users/images/{$user['id']}.{$user['extension']}" ?>" alt="Imagem de perfil de <?php echo $user['name']; ?>">
<?php endif; ?>
</td>
<td class="align-middle"><?php echo $user['name'] ?></td>
<td class="align-middle"><?php echo $user['username'] ?></td>
<td class="align-middle"><?php echo $user['email'] ?></td>
<td class="align-middle">
<?php if ($user['website']): ?>
<?php if (filter_var($user['website'], FILTER_VALIDATE_URL)) : ?>
<a target="_blank" href="<?php echo $user['website'] ?>">
Website
</a>
<?php else : ?>
<a target="_blank" href="http://<?php echo $user['website'] ?>">
Website
</a>
<?php endif; ?>
<?php endif; ?>
</td>
<td class="d-inline-flex">
<a href="view.php?id=<?php echo $user['id'] ?>" class="mx-1 btn btn-outline-info">
<i class="bi bi-eye"></i>
</a>
<a href="update.php?id=<?php echo $user['id'] ?>" class="mx-1 btn btn-outline-secondary">
<i class="bi bi-pencil-square">
</i>
</a>
<!-- Button trigger modal -->
<button type="button" class="btn btn-outline-danger deleteModalButton" data-toggle="modal" data-target="#deleteModal" data-id="<?php echo $user['id'] ?>">
<i class="bi bi-trash-fill"></i>
</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<?php else : ?>
<tr>
<td colspan="7">No users found.</td>
</tr>
<?php endif; ?>
</table>
<?php include "_deleteModal.php"; ?>
</div>
<?php include "partials/footer.php"; ?>