1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-01-07 13:02:21 +00:00

Design inscription, connexion, calendrier

This commit is contained in:
galaxyoyo 2019-09-24 12:04:42 +02:00
parent e878854861
commit 5724a6c98e
6 changed files with 269 additions and 276 deletions

View File

@ -55,14 +55,13 @@ class LoggingInUser
public function makeVerifications() public function makeVerifications()
{ {
global $URL_BASE;
ensure(filter_var($this->email, FILTER_VALIDATE_EMAIL), "L'adresse email est invalide."); ensure(filter_var($this->email, FILTER_VALIDATE_EMAIL), "L'adresse email est invalide.");
$this->user = User::fromEmail($this->email); $this->user = User::fromEmail($this->email);
ensure($this->user != null, "Le compte n'existe pas."); ensure($this->user != null, "Le compte n'existe pas.");
ensure($this->user->checkPassword($this->password), "Le mot de passe est incorrect."); ensure($this->user->checkPassword($this->password), "Le mot de passe est incorrect.");
if ($this->user->getConfirmEmailToken() != null) { if ($this->user->getConfirmEmailToken() != null) {
$_SESSION["confirm_email"] = $this->email; $_SESSION["confirm_email"] = $this->email;
/** @noinspection HtmlUnknownTarget */
throw new AssertionError("L'adresse mail n'a pas été validée. Veuillez vérifier votre boîte mail (surtout vos spams). " throw new AssertionError("L'adresse mail n'a pas été validée. Veuillez vérifier votre boîte mail (surtout vos spams). "
. "<a href=\"/connexion/confirmation-mail\">Cliquez ici pour renvoyer le mail de confirmation</a>."); . "<a href=\"/connexion/confirmation-mail\">Cliquez ici pour renvoyer le mail de confirmation</a>.");
} }
@ -125,7 +124,7 @@ class ResetPassword
ensure($data !== false, "Il n'y a pas de compte à récupérer avec ce jeton."); ensure($data !== false, "Il n'y a pas de compte à récupérer avec ce jeton.");
$this->user = User::fromId($data["id"]); $this->user = User::fromId($data["id"]);
if ($this->password == null) if (!isset($_POST["password"]))
return; return;
ensure($this->password == $this->confirm_password, "Les deux mots de passe sont différents."); ensure($this->password == $this->confirm_password, "Les deux mots de passe sont différents.");

View File

@ -4,5 +4,11 @@ unset($_SESSION["user_id"]);
session_destroy(); session_destroy();
require_once "server_files/views/header.php"; require_once "server_files/views/header.php";
echo "<h2>Déconnexion réussie !</h2>"; ?>
<div class="alert alert-success">
Déconnexion réussie !
</div>
<?php
require_once "server_files/views/footer.php"; require_once "server_files/views/footer.php";

View File

@ -1,138 +1,128 @@
<?php require_once "header.php"; ?> <?php require_once "header.php"; ?>
<?php if (isset($_GET["edit"])) { ?> <div class="mt-4 mb-4">
<form method="post"> <h1 class="display-4">Calendrier</h1>
<table style="width: 100%;"> </div>
<tbody>
<tr>
<td style="width: 30%;">
<label for="date_inscription">Fin des inscriptions :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_inscription" name="date_inscription"
value="<?= substr($CONFIG->getInscriptionDate(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_inscription" name="time_inscription"
value="<?= substr($CONFIG->getInscriptionDate(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 1 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase1" name="date_start_phase1"
value="<?= substr($CONFIG->getStartPhase1Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_start_phase1" name="time_start_phase1"
value="<?= substr($CONFIG->getStartPhase1Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 1 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase1" name="date_end_phase1"
value="<?= substr($CONFIG->getEndPhase1Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_end_phase1" name="time_end_phase1"
value="<?= substr($CONFIG->getEndPhase1Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 2 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase2" name="date_start_phase2"
value="<?= substr($CONFIG->getStartPhase2Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_start_phase2" name="time_start_phase2"
value="<?= substr($CONFIG->getStartPhase2Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 2 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase2" name="date_end_phase2"
value="<?= substr($CONFIG->getEndPhase2Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_end_phase2" name="time_end_phase2"
value="<?= substr($CONFIG->getEndPhase2Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 3 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase3" name="date_start_phase3"
value="<?= substr($CONFIG->getStartPhase3Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_start_phase3" name="time_start_phase3"
value="<?= substr($CONFIG->getStartPhase3Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 3 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase3" name="date_end_phase3"
value="<?= substr($CONFIG->getEndPhase3Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_end_phase3" name="time_end_phase3"
value="<?= substr($CONFIG->getEndPhase3Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 4 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase4" name="date_start_phase4"
value="<?= substr($CONFIG->getStartPhase4Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_start_phase4" name="time_start_phase4"
value="<?= substr($CONFIG->getStartPhase4Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 4 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase4" name="date_end_phase4"
value="<?= substr($CONFIG->getEndPhase4Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_end_phase4" name="time_end_phase4"
value="<?= substr($CONFIG->getEndPhase4Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td colspan="2" style="width: 100%;">
<input style="width: 100%;" type="submit" name="update_calendar"
value="Mettre à jour le calendrier"/>
</td>
</tr>
</tbody>
</table>
</form>
<?php } else { ?><h2>Calendrier</h2>
<?= Phase::getTranslatedName(Phase::INSCRIPTION) ?> : <?php if (isset($_GET["edit"])) { ?>
<strong><?= formatDate($CONFIG->getInscriptionDate(), true) ?></strong><br/>
<?= Phase::getTranslatedName(Phase::PHASE1) ?> : Du <form method="POST">
<strong><?= formatDate($CONFIG->getStartPhase1Date(), true) ?></strong> au <div class="form-group row">
<strong><?= formatDate($CONFIG->getEndPhase1Date(), true) ?></strong><br/> <label for="inscription">Fin des inscriptions :</label>
<?= Phase::getTranslatedName(Phase::PHASE2) ?> : Du <div class="form-group col-md-10">
<strong><?= formatDate($CONFIG->getStartPhase2Date(), true) ?></strong> au <input class="form-control" type="date" id="inscription" name="date_inscription"
<strong><?= formatDate($CONFIG->getEndPhase2Date(), true) ?></strong><br/> value="<?= substr($CONFIG->getInscriptionDate(), 0, 10) ?>"/>
<?= Phase::getTranslatedName(Phase::PHASE3) ?> : Du <input class="form-control" type="time" id="inscription" name="time_inscription"
<strong><?= formatDate($CONFIG->getStartPhase3Date(), true) ?></strong> au value="<?= substr($CONFIG->getInscriptionDate(), 11, 5) ?>"/>
<strong><?= formatDate($CONFIG->getEndPhase3Date(), true) ?></strong><br/> </div>
<?= Phase::getTranslatedName(Phase::PHASE4) ?> : Du </div>
<strong><?= formatDate($CONFIG->getStartPhase4Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase4Date(), true) ?></strong><br/> <div class="form-group row">
<br/> <label for="phase1">Dates de la phase 1 :</label>
Phase actuelle : <strong><?= Phase::getTranslatedName(Phase::getCurrentPhase()) ?></strong><br/> <div class="form-group col-md-5">
<input class="form-control" type="date" id="phase1" name="date_start_phase1"
value="<?= substr($CONFIG->getStartPhase1Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase1" name="time_start_phase1"
value="<?= substr($CONFIG->getStartPhase1Date(), 11, 5) ?>"/>
</div>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase1" name="date_end_phase1"
value="<?= substr($CONFIG->getEndPhase1Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase1" name="time_end_phase1"
value="<?= substr($CONFIG->getEndPhase1Date(), 11, 5) ?>"/>
</div>
</div>
<div class="form-group row">
<label for="phase2">Dates de la phase 2 :</label>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase2" name="date_start_phase2"
value="<?= substr($CONFIG->getStartPhase2Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase1" name="time_start_phase2"
value="<?= substr($CONFIG->getStartPhase2Date(), 11, 5) ?>"/>
</div>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase2" name="date_end_phase2"
value="<?= substr($CONFIG->getEndPhase2Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase2" name="time_end_phase2"
value="<?= substr($CONFIG->getEndPhase2Date(), 11, 5) ?>"/>
</div>
</div>
<div class="form-group row">
<label for="phase3">Dates de la phase 3 :</label>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase3" name="date_start_phase3"
value="<?= substr($CONFIG->getStartPhase3Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase3" name="time_start_phase3"
value="<?= substr($CONFIG->getStartPhase3Date(), 11, 5) ?>"/>
</div>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase3" name="date_end_phase3"
value="<?= substr($CONFIG->getEndPhase3Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase3" name="time_end_phase3"
value="<?= substr($CONFIG->getEndPhase3Date(), 11, 5) ?>"/>
</div>
</div>
<div class="form-group row">
<label for="phase4">Dates de la phase 4 :</label>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase4" name="date_start_phase4"
value="<?= substr($CONFIG->getStartPhase4Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase4" name="time_start_phase4"
value="<?= substr($CONFIG->getStartPhase4Date(), 11, 5) ?>"/>
</div>
<div class="form-group col-md-5">
<input class="form-control" type="date" id="phase4" name="date_end_phase4"
value="<?= substr($CONFIG->getEndPhase4Date(), 0, 10) ?>"/>
<input class="form-control" type="time" id="phase4" name="time_end_phase4"
value="<?= substr($CONFIG->getEndPhase4Date(), 11, 5) ?>"/>
</div>
</div>
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" type="submit" name="update_calendar"
value="Mettre à jour le calendrier"/>
</div>
</form>
<?php } else { ?>
<div class="alert alert-<?= Phase::getCurrentPhase() == Phase::INSCRIPTION ? "warning" : "success" ?>">
<?= Phase::getTranslatedName(Phase::INSCRIPTION) ?> :
<strong><?= formatDate($CONFIG->getInscriptionDate(), true) ?></strong>
</div>
<div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE1 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE1 ? "warning" : "success") ?>">
<?= Phase::getTranslatedName(Phase::PHASE1) ?> :
Du <strong><?= formatDate($CONFIG->getStartPhase2Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase2Date(), true) ?></strong>
</div>
<div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE2 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE2 ? "warning" : "success") ?>">
<?= Phase::getTranslatedName(Phase::PHASE2) ?> :
Du <strong><?= formatDate($CONFIG->getStartPhase2Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase2Date(), true) ?></strong>
</div>
<div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE3 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE3 ? "warning" : "success") ?>">
<?= Phase::getTranslatedName(Phase::PHASE3) ?> :
Du <strong><?= formatDate($CONFIG->getStartPhase3Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase3Date(), true) ?></strong>
</div>
<div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE4 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE4 ? "warning" : "success") ?>">
<?= Phase::getTranslatedName(Phase::PHASE4) ?> :
Du <strong><?= formatDate($CONFIG->getStartPhase4Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase4Date(), true) ?></strong>
</div>
<?php if ($_SESSION["role"] == Role::ADMIN) { ?> <?php if ($_SESSION["role"] == Role::ADMIN) { ?>
<a href="/calendrier/modifier">Modifier le calendrier</a> <!--suppress HtmlUnknownTarget -->
<a href="/calendrier/modifier">
<button class="btn btn-primary btn-block">Modifier le calendrier</button>
</a>
<?php } <?php }
} }

View File

@ -3,96 +3,64 @@ require_once "header.php";
if (!$has_error) { if (!$has_error) {
if (isset($recuperate_account)) if (isset($recuperate_account))
echo "<h2>Le mail de récupération de mot de passe a bien été envoyé.</h2>"; echo "<div class=\"alert alert-warning\">Le mail de récupération de mot de passe a bien été envoyé.</div>";
elseif (isset($reset_password)) elseif (isset($reset_password) && isset($_POST["password"]))
echo "<h2>Le mot de passe a bien été changé. Vous pouvez désormais vous connecter.</h2>"; echo "<div class=\"alert alert-success\">Le mot de passe a bien été changé. Vous pouvez désormais vous connecter.</div>";
elseif (isset($_GET["confirmation-mail"])) elseif (isset($_GET["confirmation-mail"]))
echo "<h2>Le mail a bien été renvoyé.</h2>"; echo "<div class=\"alert alert-success\">Le mail a bien été renvoyé.</div>";
else if (isset($logging_in_user)) { else if (isset($logging_in_user)) {
echo "<h2>Connexion réussie !</h2>"; echo "<div class=\"alert alert-success\">Connexion réussie !</div>";
require_once "footer.php"; require_once "footer.php";
} else if (isset($_SESSION["user_id"])) { } else if (isset($_SESSION["user_id"])) {
echo "<h2>Vous êtes déjà connecté.</h2>"; echo "<div class=\"alert alert-danger\">Vous êtes déjà connecté !</div>";
require_once "footer.php"; require_once "footer.php";
} }
} }
if (isset($_GET["mdp-oublie"])) { ?>
<form method="POST"> if (isset($_GET["mdp_oublie"])) { ?>
<table style="width: 100%;"> <form method="POST" class="jumbotron mt-5">
<tbody> <h1 class="display-4">Réinitialisation du mot de passe</h1>
<tr> <label for="email">E-mail associée au compte :</label>
<td style="width: 30%;"> <input type="email" class="form-control" id="email" name="email"/>
<label for="email">E-mail associée au compte :</label> <input class="btn btn-lg btn-primary btn-block" type="submit" name="forgotten_password"
</td> value="Envoyer l'e-mail de récupération"/>
<td style="width: 70%;">
<input style="width: 100%;" type="email" id="email" name="email"/>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" name="forgotten_password"
value="Envoyer l'e-mail de récupération"/>
</td>
</tr>
</tbody>
</table>
</form> </form>
<?php } elseif (isset($_GET["reset_password"])) { <?php } elseif (isset($reset_password) && $reset_password->user != null && ($has_error || !isset($_POST["password"]))) { ?>
if ($reset_password->user != null) { ?> <form method="POST" class="jumbotron mt-5">
<form method="POST"> <h1 class="display-4">Connexion</h1>
<table style="width: 100%;"> <input type="hidden" name="token" value="<?= $_GET["token"] ?>"/>
<tbody> <div class="form-group">
<tr> <label for="password">Nouveau mot de passe :</label>
<td style="width: 30%;"> <input type="password" id="password" name="password" class="form-control"/>
<label for="password">Nouveau mot de passe :</label> </div>
</td> <div class="form-group">
<td style="width: 70%;"> <label for="confirm_password">Confirmer le mot de passe :</label>
<input style="width: 100%;" type="password" id="password" name="password"/> <input type="password" id="confirm_password" name="confirm_password" class="form-control"/>
</td> </div>
</tr> <input type="submit" name="reset_password" class="btn btn-block btn-primary"
<tr> value="Changer le mot de passe"/>
<td style="width: 30%;"> </form>
<label for="confirm_password">Confirmer le mot de passe :</label> <?php } elseif (isset($_GET["confirmation-mail"])) { ?>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="password" id="confirm_password" name="confirm_password"/>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" name="reset_password"
value="Changer le mot de passe"/>
</td>
</tr>
</tbody>
</table>
</form>
<?php }
} elseif (isset($_GET["confirmation-mail"])) { ?>
<?php } else { ?> <?php } else { ?>
<form method="POST"> <form method="POST" class="jumbotron mt-5">
<h1 class="display-4">Connexion</h1>
<hr class="mt-2 mb-4"/>
<input type="hidden" name="submitted" value="true"/> <input type="hidden" name="submitted" value="true"/>
<table style="width: 100%;"> <div class="form-group">
<tr> <label for="email">E-mail :</label>
<td style="width: 30%;"><label for="email">E-mail :</label></td> <input class="form-control" type="email" id="email" name="email"
<td style="width: 70%;"><input style="width: 100%;" type="email" id="email" name="email" value="<?php if (isset($email)) echo $email ?>"/>
value="<?php if (isset($email)) echo $email ?>"/></td> </div>
</tr> <div class="form-group">
<tr> <label for="password">Mot de passe :</label>
<td><label for="password">Mot de passe :</label></td> <input class="form-control" type="password" id="password" name="password"/>
<td><input style="width: 100%;" type="password" id="password" name="password"/></td> </div>
</tr> <input class="btn btn-primary btn-block" type="submit" value="Se connecter"/>
<tr>
<td colspan="2">
<!--suppress HtmlUnknownTarget -->
<a href="/connexion/mdp-oublie">Mot de passe oublié ?</a>
</td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%;" type="submit" value="Se connecter"/></td>
</tr>
</table>
</form> </form>
<div class="alert">
<!--suppress HtmlUnknownTarget -->
<a href="/connexion/mdp-oublie">Mot de passe oublié ?</a>
</div>
<?php } ?> <?php } ?>
<?php require_once "footer.php" ?> <?php require_once "footer.php" ?>

View File

@ -100,8 +100,12 @@
</div> </div>
<div class="container"> <div class="container">
<div class="mt-4 mb-4">
</div>
<?php <?php
if (isset($has_error) && $has_error) { if (isset($has_error) && $has_error) { ?>
echo "<h2>Erreur : " . $error_message . "</h2>"; <div class="alert alert-danger">
} Erreur : <?= $error_message ?>
</div>
<?php }

View File

@ -1,74 +1,100 @@
<?php <?php
require_once "header.php"; require_once "header.php";
?>
<div class="mt-4 mb-4">
<h1 class="display-4">Formulaire d'inscription</h1>
</div>
<?php
/** @var NewUser $user */ /** @var NewUser $user */
if (isset($user) && !$has_error) { if (isset($user) && !$has_error) {
?> ?>
Votre inscription est validée ! Merci désormais de confirmer votre boîte mail pour valider votre adresse. <div class="alert alert-success">
Votre inscription est validée ! Merci désormais de confirmer votre boîte mail pour valider votre adresse.
</div>
<?php } else if (isset($_SESSION["user_id"])) { ?> <?php } else if (isset($_SESSION["user_id"])) { ?>
<h2>Vous êtes déjà connecté !</h2> <div class="alert alert-danger">
Vous êtes déjà connecté !
</div>
<?php } elseif(date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate()) { ?> <?php } elseif(date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate()) { ?>
<h2>La date limite d'inscription est dépassée.</h2> <div class="alert alert-danger">
La date limite d'inscription est dépassée.
</div>
<?php } else { ?> <?php } else { ?>
<form method="POST"> <form method="POST">
<input type="hidden" name="submitted" value="true"/> <input type="hidden" name="submitted" value="true"/>
<table style="width: 100%;">
<tr> <div class="form-group row">
<td style="width: 30%;"><label for="email">E-mail :</label></td> <label for="role">Rôle :</label>
<td style="width: 70%;"><input style="width: 100%;" type="email" id="email" name="email" <select id="role" name="role" onchange="selectRole()" class="custom-select">
value="<?php if (isset($user)) echo $user->email ?>" <option value="participant"><?= Role::getTranslatedName(Role::PARTICIPANT) ?></option>
required/></td> <option value="encadrant"><?= Role::getTranslatedName(Role::ENCADRANT) ?></option>
</tr> </select>
<tr> </div>
<td><label for="password">Mot de passe :</label></td>
<td><input style="width: 100%;" type="password" id="password" name="password" required/></td> <div class="form-row">
</tr> <div class="form-group col-md-6">
<tr> <label for="surname">Nom :</label>
<td><label for="confirm_password">Confirmer le mot de passe :</label></td> <input class="form-control" type="text" id="surname" name="surname"
<td><input style="width: 100%;" type="password" id="confirm_password" name="confirm_password" required/> value="<?php if (isset($user)) echo $user->surname ?>" required/>
</td> </div>
</tr>
<tr> <div class="form-group col-md-6">
<td><label for="surname">Nom :</label></td> <label for="first_name">Prénom :</label>
<td><input style="width: 100%;" type="text" id="surname" name="surname" <input class="form-control" type="text" id="first_name" name="first_name"
value="<?php if (isset($user)) echo $user->surname ?>" required/></td> value="<?php if (isset($user)) echo $user->first_name ?>" required/>
</tr> </div>
<tr> </div>
<td><label for="first_name">Prénom :</label></td>
<td><input style="width: 100%;" type="text" id="first_name" name="first_name" <div class="form-row">
value="<?php if (isset($user)) echo $user->first_name ?>" required/></td> <div class="form-group col-md-12">
</tr> <label for="email">E-mail :</label>
<tr> <input class="form-control" type="email" id="email" name="email"
<td><label for="role">Rôle :</label></td> value="<?php if (isset($user)) echo $user->email ?>"
<td><select style="width: 100%;" id="role" name="role" onchange="selectRole()"> required/>
<option value="participant"><?= Role::getTranslatedName(Role::PARTICIPANT) ?></option> </div>
<option value="encadrant"><?= Role::getTranslatedName(Role::ENCADRANT) ?></option> </div>
</select></td>
</tr>
<tr> <div class="form-row">
<td><label id="school_label" for="school">Établissement dans lequel l'élève étudie :</label></td> <div class="form-group col-md-6">
<td><input style="width: 100%;" type="text" id="school" name="school" <label for="password">Mot de passe :</label>
value="<?php if (isset($user)) echo $user->school ?>"/></td> <input class="form-control" type="password" id="password" name="password" required/>
</tr> </div>
<tr> <div class="form-group col-md-6">
<td><label id="class_label" for="class">Classe :</label></td> <label for="confirm_password">Confirmer le mot de passe :</label>
<td><select style="width: 100%;" id="class" name="class"> <input class="form-control" type="password" id="confirm_password" name="confirm_password" required/>
<option value="terminale"><?= SchoolClass::getTranslatedName(SchoolClass::TERMINALE) ?></option> </div>
<option value="premiere"><?= SchoolClass::getTranslatedName(SchoolClass::PREMIERE) ?></option> </div>
<option value="seconde"><?= SchoolClass::getTranslatedName(SchoolClass::SECONDE) ?></option>
</select></td> <div class="form-row">
</tr> <div class="form-group col-md-6">
<tr> <label id="school_label" for="school">Établissement dans lequel l'élève étudie :</label>
<td><label id="description_label" for="description">Description :</label></td> <input class="form-control" type="text" id="school" name="school"
<td><textarea style="width: 100%;" id="description" value="<?php if (isset($user)) echo $user->school ?>"/>
name="description"><?php if (isset($user)) echo $user->description ?></textarea> </div>
</td> <div class="form-group col-md-6">
</tr> <label id="class_label" for="class">Classe :</label>
<tr> <select id="class" name="class" class="custom-select">
<td colspan="2"><input style="width: 100%;" type="submit" value="S'inscrire"/></td> <option value="terminale"><?= SchoolClass::getTranslatedName(SchoolClass::TERMINALE) ?></option>
</tr> <option value="premiere"><?= SchoolClass::getTranslatedName(SchoolClass::PREMIERE) ?></option>
</table> <option value="seconde"><?= SchoolClass::getTranslatedName(SchoolClass::SECONDE) ?></option>
</select>
</div>
</div>
<div class="form-group row">
<label id="description_label" for="description">Description :</label>
<textarea class="form-control" id="description"
name="description"><?php if (isset($user)) echo $user->description ?></textarea>
</div>
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" type="submit" value="S'inscrire"/>
</div>
</form> </form>
<script> <script>