-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
131 lines (118 loc) · 5.59 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
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
129
130
<?php require_once dirname(__FILE__) . '/php/models/User.php'; ?>
<!doctype html>
<html lang="en" class="h-100">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
<meta name="generator" content="Hugo 0.84.0">
<title>CODAC SAMPLE PHP</title>
<!-- Bootstrap core CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<meta name="theme-color" content="#7952b3">
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
</style>
<!-- Custom styles for this template -->
<link href="css/style.css" rel="stylesheet">
</head>
<body class="d-flex flex-column h-100">
<header>
<!-- Fixed navbar -->
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">Cod@c Sample</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav me-auto mb-2 mb-md-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Utilisateurs</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!-- Begin page content -->
<main class="flex-shrink-0">
<div class="container">
<?php include_once dirname(__FILE__) . '/alert_message.php'; ?>
<div class="row">
<div class="col-md-8">
<h1 class="mt-3">Liste des utilisateurs</h1>
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Prénom</th>
<th scope="col">Nom</th>
<th scope="col">Adresse Email</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<?php foreach (User::getAll() as $user) { ?>
<tr>
<th scope="row"><?= $user->id ?></th>
<td><?= $user->firstName ?></td>
<td><?= $user->lastName ?></td>
<td><?= $user->email ?></td>
<td>
<button type="button" class="btn btn-warning btn-sm" data-bs-toggle="modal" data-bs-target="#editUserModal<?= $user->id; ?>">Modifier</button>
<a class="btn btn-danger btn-sm" href="php/action/delete_user.php?id=<?= $user->id ?>">Supprimer</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="col-md-4">
<h1 class="mt-3">Ajouter un utilisateur</h1>
<form action="php/action/add_user.php" method="post">
<div class="row">
<div class="col-md-6">
<div class="mb-3">
<label for="firstName" class="form-label">Prénom</label>
<input type="text" class="form-control" id="firstName" name="firstName" required>
</div>
</div>
<div class="col-md-6">
<div class="mb-3">
<label for="lastName" class="form-label">Nom</label>
<input type="text" class="form-control" id="lastName" name="lastName" required>
</div>
</div>
</div>
<div class="mb-3">
<label for="email" class="form-label">Adresse Email</label>
<input type="email" class="form-control" id="email" name="email" aria-describedby="emailHelp" required>
<div id="emailHelp" class="form-text">L'adresse doit être unique.</div>
</div>
<div class="mb-3">
<label for="password" class="form-label">Mot de passe</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<button type="submit" name="submit" class="btn btn-primary">Créer</button>
</form>
</div>
</div>
</div>
</main>
<?php include_once dirname(__FILE__) . '/edit_user_modals.php'; ?>
</body>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</html>