1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-26 05:02:23 +00:00

💄 Remold the old inscription form

Signed-off-by: Hadrien RENAUD <hadrien.renaud@polytechnique.edu>
This commit is contained in:
Hadrien RENAUD 2019-09-09 01:50:26 +02:00
parent eb2fb734c6
commit 49a2fbe83e

View File

@ -2,136 +2,169 @@
require_once "header.php"; require_once "header.php";
if ($has_error) if ($has_error)
echo "<h2>Erreur : " . $error_message . "</h2>"; echo "<div class=\"alert alert-danger\">Erreur : " . $error_message . "</div>";
?> ?>
<div class="mt-4 mb-4">
<h1 class="display-4">Formulaire d'inscription</h1>
</div>
<?php <?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-success">Vous êtes déjà connecté !</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-6">
</tr> <label for="email">E-mail :</label>
<tr> <input class="form-control" type="email" id="email" name="email"
<td><label for="birth_date">Date de naissance :</label></td> value="<?php if (isset($user)) echo $user->email ?>"
<td><input style="width: 100%;" type="date" id="birth_date" name="birth_date" required/>
value="<?php if (isset($user)) echo $user->birth_date ?>" required/></td> </div>
</tr> <div class="form-group col-md-6">
<tr> <label for="phone_number">Numéro de téléphone :</label>
<td><label for="gender">Sexe :</label></td> <input class="form-control" type="text" id="phone_number" name="phone_number"
<td><input type="radio" id="male" name="gender" value="M" value="<?php if (isset($user)) echo $user->phone_number ?>"/>
required <?= isset($_POST["gender"]) && $_POST["gender"] == "M" ? "checked" : "" ?> /><label </div>
for="male">Homme</label> </div>
<input type="radio" id="female" name="gender" value="F"
required <?= isset($_POST["gender"]) && $_POST["gender"] == "F" ? "checked" : "" ?> /><label <div class="form-row">
for="female">Femme</label></td> <div class="form-group col-md-6">
</tr> <label for="password">Mot de passe :</label>
<tr> <input class="form-control" type="password" id="password" name="password" required/>
<td><label for="address">Adresse :</label></td> </div>
<td><input style="width: 100%;" type="text" id="address" name="address" <div class="form-group col-md-6">
value="<?php if (isset($user)) echo $user->address ?>"/></td> <label for="confirm_password">Confirmer le mot de passe :</label>
</tr> <input class="form-control" type="password" id="confirm_password" name="confirm_password" required/>
<tr> </div>
<td><label for="postal_code">Code postal :</label></td> </div>
<td><input style="width: 100%;" type="number" id="postal_code" name="postal_code"
value="<?php if (isset($user)) echo $user->postal_code ?>" min="1000" <div class="form-row">
max="95999" required/></td> <div class="form-group col-md-6">
</tr> <label for="gender" class="mr-2">Sexe :</label>
<tr> <br/>
<td><label for="city">Ville :</label></td> <div class="custom-control custom-radio custom-control-inline">
<td><input style="width: 100%;" type="text" id="city" name="city" <input type="radio" class="custom-control-input" id="male" name="gender" value="M"
value="<?php if (isset($user)) echo $user->city ?>"/></td> required <?= isset($_POST["gender"]) && $_POST["gender"] == "M" ? "checked" : "" ?> />
</tr> <label for="male" class="custom-control-label">Homme</label>
<tr> </div>
<td><label for="country">Pays :</label></td> <div class="custom-control custom-radio custom-control-inline">
<td><input style="width: 100%;" type="text" id="country" name="country" <input type="radio" class="custom-control-input" id="female" name="gender" value="F"
value="<?= isset($user) ? $user->country : "France" ?>" required/></td> required <?= isset($_POST["gender"]) && $_POST["gender"] == "F" ? "checked" : "" ?> />
</tr> <label for="female" class="custom-control-label">Femme</label>
<tr> </div>
<td><label for="phone_number">Numéro de téléphone :</label></td> </div>
<td><input style="width: 100%;" type="text" id="phone_number" name="phone_number" <div class="form-group col-md-6">
value="<?php if (isset($user)) echo $user->phone_number ?>"/></td> <label for="birth_date">Date de naissance :</label>
</tr> <input class="form-control" type="date" id="birth_date" name="birth_date"
<tr> value="<?php if (isset($user)) echo $user->birth_date ?>" required/>
<td><label for="role">Rôle :</label></td> </div>
<td><select style="width: 100%;" id="role" name="role" onchange="selectRole()"> </div>
<option value="participant"><?= Role::getTranslatedName(Role::PARTICIPANT) ?></option>
<option value="encadrant"><?= Role::getTranslatedName(Role::ENCADRANT) ?></option> <div class="form-row">
</select></td> <div class="form-group col-md-5">
</tr> <label for="address">Adresse :</label>
<tr> <input class="form-control" type="text" id="address" name="address"
<td><label id="school_label" for="school">Établissement dans lequel l'élève étudie :</label></td> value="<?php if (isset($user)) echo $user->address ?>"/>
<td><input style="width: 100%;" type="text" id="school" name="school" </div>
value="<?php if (isset($user)) echo $user->school ?>"/></td> <div class="form-group col-md-2">
</tr> <label for="postal_code">Code postal :</label>
<tr> <input class="form-control" type="number" id="postal_code" name="postal_code"
<td><label id="class_label" for="class">Classe :</label></td> value="<?php if (isset($user)) echo $user->postal_code ?>" min="1000"
<td><select style="width: 100%;" id="class" name="class"> max="95999" required/>
<option value="terminale"><?= SchoolClass::getTranslatedName(SchoolClass::TERMINALE) ?></option> </div>
<option value="premiere"><?= SchoolClass::getTranslatedName(SchoolClass::PREMIERE) ?></option> <div class="form-group col-md-3">
<option value="seconde"><?= SchoolClass::getTranslatedName(SchoolClass::SECONDE) ?></option> <label for="city">Ville :</label>
</select></td> <input class="form-control" type="text" id="city" name="city"
</tr> value="<?php if (isset($user)) echo $user->city ?>"/>
<tr> </div>
<td><label id="responsible_name_label" for="responsible_name">Nom du responsable légal :</label></td> <div class="form-group col-md-2">
<td><input style="width: 100%;" type="text" id="responsible_name" name="responsible_name" <label for="country">Pays :</label>
value="<?php if (isset($user)) echo $user->responsible_name ?>"/> <input class="form-control" type="text" id="country" name="country"
</td> value="<?= isset($user) ? $user->country : "France" ?>" required/>
</tr> </div>
<tr> </div>
<td><label id="responsible_phone_label" for="responsible_phone">Téléphone du responsable légal :</label> <div class="form-row">
</td> <div class="form-group col-md-6">
<td><input style="width: 100%;" type="text" id="responsible_phone" name="responsible_phone" <label id="school_label" for="school">Établissement dans lequel l'élève étudie :</label>
value="<?php if (isset($user)) echo $user->responsible_phone ?>"/> <input class="form-control" type="text" id="school" name="school"
</td> value="<?php if (isset($user)) echo $user->school ?>"/>
</tr> </div>
<tr> <div class="form-group col-md-6">
<td><label id="responsible_email_label" for="responsible_email">Email du responsable légal :</label> <label id="class_label" for="class">Classe :</label>
</td> <select id="class" name="class" class="custom-select">
<td><input style="width: 100%;" type="text" id="responsible_email" name="responsible_email" <option value="terminale"><?= SchoolClass::getTranslatedName(SchoolClass::TERMINALE) ?></option>
value="<?php if (isset($user)) echo $user->responsible_email ?>"/> <option value="premiere"><?= SchoolClass::getTranslatedName(SchoolClass::PREMIERE) ?></option>
</td> <option value="seconde"><?= SchoolClass::getTranslatedName(SchoolClass::SECONDE) ?></option>
</tr> </select>
<tr> </div>
<td><label id="description_label" for="description">Description :</label></td> </div>
<td><textarea style="width: 100%;" id="description"
name="description"><?php if (isset($user)) echo $user->description ?></textarea> <div class="form-row">
</td> <div class="form-group col-md-4">
</tr> <label id="responsible_name_label" for="responsible_name">Nom du responsable légal :</label>
<tr> <input class="form-control" type="text" id="responsible_name" name="responsible_name"
<td colspan="2"><input style="width: 100%;" type="submit" value="S'inscrire"/></td> value="<?php if (isset($user)) echo $user->responsible_name ?>"/>
</tr>
</table> </div>
<div class="form-group col-md-4">
<label id="responsible_phone_label" for="responsible_phone">Téléphone du responsable légal :</label>
<input class="form-control" type="text" id="responsible_phone" name="responsible_phone"
value="<?php if (isset($user)) echo $user->responsible_phone ?>"/>
</div>
<div class="form-group col-md-4">
<label id="responsible_email_label" for="responsible_email">Email du responsable légal :</label>
<input class="form-control" type="text" id="responsible_email" name="responsible_email"
value="<?php if (isset($user)) echo $user->responsible_email ?>"/>
</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>