enorme push

This commit is contained in:
2024-10-25 16:49:52 +02:00
parent 829d121268
commit 52faa489fa
23 changed files with 448 additions and 166 deletions

View File

@@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<title>{% block title %}{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="/tpCrudTwig/public/index.php">TP Crud
<img src="/tpCrudTwig/public/images/suisse.png" alt="suisse" width="30" height="30"
class="d-inline-block align-text-top">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup"
aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle active" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Utilisateurs
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="/tpCrudTwig/public/index.php">Liste des utilisateurs</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="/tpCrudTwig/public/users/add.php">Ajouter un
utilisateur</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle active" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
Roles
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="/tpCrudTwig/public/roles/list.php">Liste des rôles</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="/tpCrudTwig/public/roles/add.php">Ajouter un rôle</a>
</li>
</ul>
</li>
</div>
</div>
</nav>
</header>
<div class="container text-center bg-light p-2">
{% block content %}
{% endblock %}
{% if message is not empty %}
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endif %}
{% if error is not empty %}
<div class="alert alert-danger alert-dismissible fade show" role="alert">
{{ error }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endif %}
</div>
<footer class="footer fixed-bottom text-center m-1 bg-dark-subtle">
{% block footer %}
&copy; Copyright {{ "now"|date('Y') }} de Simon Pribylski.
{% endblock %}
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>
</body>
</html>

View File

@@ -0,0 +1,16 @@
{% extends "base.twig" %}
{% block title %}Ajouter rôle{% endblock %}
{% block content %}
<h1>Ajouter un rôle</h1>
<form class="form-group" role="search" method="post">
<label for="name">Nom du rôle</label>
<input type="text" class="form-control" name="name" id="name">
<input type="submit" class="btn btn-success" name="Ajouter" />
</form>
{% endblock %}

View File

@@ -0,0 +1,17 @@
{% extends "base.twig" %}
{% block title %}Modification du rôle{% endblock %}
{% block content %}
<h1>Modifier un rôle</h1>
<form method="post">
<label for="name">Nom</label>
<input type="text" class="form-control" name="name" id="name" value="{{ role.name }}">
<input type="submit" class="btn btn-success" name="Enregistrer" value="Enregistrer" />
<input type="hidden" name="id" value="{{ role.id }}">
</form>
{% endblock %}

View File

@@ -0,0 +1,36 @@
{% extends "base.twig" %}
{% block title %}Liste des rôles{% endblock %}
{% block content %}
<h1 class="">Liste des rôles</h1>
<table class="table table-striped table-bordered table-condensed">
<thead>
<th>ID</th>
<th>Nom</th>
</thead>
<tbody>
{# afficher les roles #}
{% for role in roles %}
<tr>
<td>{{ role.id }}</td>
<td>{{ role.name }}</td>
<td>
<button type="button" class="btn btn-info"
onclick="window.location.href='details.php?id={{ role.id }}'">Voir</button>
<button type="button" class="btn btn-warning"
onclick="window.location.href='edit.php?id={{ role.id }}'">Modifier</button>
<button type="button" class="btn btn-danger"
onclick="window.location.href='delete.php?id={{ role.id }}'">Supprimer</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<button type="button" class="btn btn-success mb-2" onclick="window.location.href='add.php'">Ajouter</button>
{% endblock %}

View File

@@ -1,33 +1,35 @@
<!DOCTYPE html>
<html lang="en">
{% extends "base.twig" %}
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
{# <link rel="stylesheet" href="style/style.css"/> #}
{# <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> #}
<title>Ajouter utilisateur</title>
</head>
{% block title %}Ajouter utilisateur{% endblock %}
<body>
<div class="container text-center bg-light">
<h1>Ajouter un utilisateur</h1>
<form class="form-group" role="search" method="post">
<label for="login">Utilisateur</label>
<input type="text" class="form-control" name="login" id="login">
<label for="password">Mot de passe</label>
<input type="password" class="form-control" name="password" id="password" />
<label for="firstname">Prénom</label>
<input type="text" class="form-control" name="firstname" id="firstname">
<label for="lastname">Nom de famille</label>
<input type="text" class="form-control" name="lastname" id="lastname" />
<label for="role">Role</label>
<input type="number" class="form-control" name="role" id="role">
<label for="description">Description</label>
<textarea name="description" class="form-control"></textarea>
<input type="submit" class="btn btn-success" name="Enregistrer" value="Enregistrer"/>
</form>
</div>
</body>
</html>
{% block content %}
<h1>Ajouter un utilisateur</h1>
<form class="form-group" role="search" method="post">
<label for="login">Utilisateur</label>
<input type="text" class="form-control" name="login" id="login">
<label for="password">Mot de passe</label>
<input type="password" class="form-control" name="password" id="password" />
<label for="firstname">Prénom</label>
<input type="text" class="form-control" name="firstname" id="firstname">
<label for="lastname">Nom de famille</label>
<input type="text" class="form-control" name="lastname" id="lastname" />
<label for="role">Role</label>
<select class="form-control" name="role" id="role-select">
{% for role in roles %}
<option value="{{ role.id }}">{{ role.name }}</option>
{% endfor %}
</select>
<label for="description">Description</label>
<textarea name="description" class="form-control"></textarea>
<input type="submit" class="btn btn-success" name="Ajouter" />
</form>
{% endblock %}

View File

@@ -1,29 +1,24 @@
<!DOCTYPE html>
<html lang="fr">
{% extends "base.twig" %}
<head>
<meta charset="UTF-8">
<title>Détails de l'utilisateur</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
{# <link rel="stylesheet" href="style/style.css" /> #}
{# <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> #}
</head>
{% block title %}Détails de l'utilisateur{% endblock %}
<body>
<div class="container text-center bg-light">
<h1>Détails pour lutilisateur {{ user.login }}</h1>
<div class="container bg-white w-25 border my-2">
<p>ID : {{ user.id }}</p>
<p>Login : {{ user.login }}</p>
<p>FirstName : {{ user.firstname }}</p>
<p>LastName : {{ user.lastname }}</p>
<p>Role : {{ user.role }}</p>
</div>
<div>
<button type="button" class="btn btn-warning" onclick="window.location.href='edit.php?id={{ user.id }}'">Modifier</button>
<button type="button" class="btn btn-danger" onclick="window.location.href='delete.php?id={{ user.id }}'">Supprimer</button>
</div>
</div>
</body>
</html>
{% block content %}
<h1>Détails pour lutilisateur {{ user.login }}</h1>
<div class="container bg-white w-25 border my-2">
<p>ID : {{ user.id }}</p>
<p>Login : {{ user.login }}</p>
<p>FirstName : {{ user.firstname }}</p>
<p>LastName : {{ user.lastname }}</p>
<p>Role : {{ user.role.name }}</p>
</div>
<div>
<button type="button" class="btn btn-warning"
onclick="window.location.href='edit.php?id={{ user.id }}'">Modifier</button>
<button type="button" class="btn btn-danger"
onclick="window.location.href='delete.php?id={{ user.id }}'">Supprimer</button>
</div>
{% endblock %}

View File

@@ -1,30 +1,28 @@
<!DOCTYPE html>
<html lang="fr">
{% extends "base.twig" %}
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Modification de l'utilisateur</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
{# <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> #}
{# <link rel="stylesheet"
href="style/style.css"> #}
</head>
{% block title %}Modification de l'utilisateur{% endblock %}
<body>
<div class="container text-center bg-light">
<h1>Modifier un utilisateur</h1>
<form method="post">
<label for="login">Login</label>
<input type="text" class="form-control" name="login" id="login" value="{{ user.login }}">
<label for="description">Description</label>
<input type="text" class="form-control" name="description" id="description" value="{{ user.description }}">
<label for="role">Role</label>
<input type="number" class="form-control" name="role" id="role" value="{{ user.role }}">
<input type="submit" class="btn btn-success" name="Enregistrer" value="Enregistrer"/>
<input type="hidden" name="id" value="{{ user.id }}">
</form>
</div>
</body>
</html>
{% block content %}
<h1>Modifier un utilisateur</h1>
<form method="post">
<label for="login">Login</label>
<input type="text" class="form-control" name="login" id="login" value="{{ user.login }}">
<label for="description">Description</label>
<input type="text" class="form-control" name="description" id="description" value="{{ user.description }}">
<label for="role">Role</label>
<select class="form-control" name="role" id="role-select">
{% for role in roles %}
<option value="{{ role.id }}" {% if role.id==user.role.id %} selected="selected" {% endif %}>{{ role.name }}
</option>
{% endfor %}
</select>
<input type="submit" class="btn btn-success m-2" name="Enregistrer" />
<input type="hidden" name="id" value="{{ user.id }}">
</form>
{% endblock %}

View File

@@ -1,48 +1,43 @@
{% extends "base.twig" %}
<!DOCTYPE html>
<html lang="fr">
{% block title %}Liste des utilisateurs{% endblock %}
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
{# <link rel="stylesheet" href="style/style.css" /> #}
{# <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> #}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Liste des utilisateurs</title>
</head>
<body>
<div class="container text-center bg-light">
<h1 class="">Liste des utilisateurs</h1>
<table class="table table-striped table-bordered table-condensed">
<thead>
<th>ID</th>
<th>Login</th>
<th>Nom</th>
<th>Prenom</th>
<th>Rôle</th>
<th>Actions</th>
</thead>
<tbody>
{# afficher les utilisateurs #}
{% for user in users %}
<tr>
<td>{{ user.id }}</td>
<td>{{ user.login }}</td>
<td>{{ user.lastname }}</td>
<td>{{ user.firstname }}</td>
<td>{{ user.role }}</td>
<td>
<button type="button" class="btn btn-info" onclick="window.location.href='details.php?id={{ user.id }}'">Voir</button>
<button type="button" class="btn btn-warning" onclick="window.location.href='edit.php?id= {{ user.id }}'">Modifier</button>
<button type="button" class="btn btn-danger" onclick="window.location.href='delete.php?id= {{ user.id }}'">Supprimer</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<button type="button" class="btn btn-success" onclick="window.location.href='add.php'">Ajouter</button>
</div>
</body>
</html>
{% block content %}
<h1 class="">Liste des utilisateurs</h1>
<table class="table table-striped table-bordered table-condensed">
<thead>
<th>ID</th>
<th>Login</th>
<th>Nom</th>
<th>Prenom</th>
<th>Rôle</th>
<th>Actions</th>
</thead>
<tbody>
{# afficher les utilisateurs #}
{% for user in users %}
<tr>
<td>{{ user.id }}</td>
<td>{{ user.login }}</td>
<td>{{ user.lastname }}</td>
<td>{{ user.firstname }}</td>
<td>{{ user.role.name }}</td>
<td>
<button type="button" class="btn btn-info"
onclick="window.location.href='users/details.php?id={{ user.id }}'">Voir</button>
<button type="button" class="btn btn-warning"
onclick="window.location.href='users/edit.php?id= {{ user.id }}'">Modifier</button>
<button type="button" class="btn btn-danger"
onclick="window.location.href='users/delete.php?id= {{ user.id }}'">Supprimer</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<button type="button" class="btn btn-success mb-2" onclick="window.location.href='users/add.php'">Ajouter</button>
{% endblock %}