104 lines
5.0 KiB
PHP
104 lines
5.0 KiB
PHP
<?php
|
|
require_once "header.php";
|
|
|
|
if ($has_error)
|
|
echo "<h2>Erreur : " . $error_message . "</h2>";
|
|
?>
|
|
|
|
<?php
|
|
/** @var NewUser $user */
|
|
if (isset($user) && !$has_error) {
|
|
?>
|
|
Votre inscription est validée ! Merci désormais de confirmer votre boîte mail pour valider votre adresse.
|
|
<?php } else if (isset($_SESSION["user_id"])) { ?>
|
|
<h2>Vous êtes déjà connecté !</h2>
|
|
<?php } else { ?>
|
|
|
|
<form method="POST">
|
|
<input type="hidden" name="submitted" value="true"/>
|
|
<table style="width: 100%;">
|
|
<tr>
|
|
<td style="width: 30%;"><label for="email">E-mail :</label></td>
|
|
<td style="width: 70%;"><input style="width: 100%;" type="email" id="email" name="email"
|
|
value="<?php if (isset($user)) echo $user->email ?>"
|
|
required/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="password">Mot de passe :</label></td>
|
|
<td><input style="width: 100%;" type="password" id="password" name="password" required/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="confirm_password">Confirmer le mot de passe :</label></td>
|
|
<td><input style="width: 100%;" type="password" id="confirm_password" name="confirm_password" required/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="surname">Nom :</label></td>
|
|
<td><input style="width: 100%;" type="text" id="surname" name="surname"
|
|
value="<?php if (isset($user)) echo $user->surname ?>" required/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="first_name">Prénom :</label></td>
|
|
<td><input style="width: 100%;" type="text" id="first_name" name="first_name"
|
|
value="<?php if (isset($user)) echo $user->first_name ?>" required/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="role">Rôle :</label></td>
|
|
<td><select style="width: 100%;" id="role" name="role" onchange="selectRole()">
|
|
<option value="participant"><?= Role::getTranslatedName(Role::PARTICIPANT) ?></option>
|
|
<option value="encadrant"><?= Role::getTranslatedName(Role::ENCADRANT) ?></option>
|
|
</select></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label id="school_label" for="school">Établissement dans lequel l'élève étudie :</label></td>
|
|
<td><input style="width: 100%;" type="text" id="school" name="school"
|
|
value="<?php if (isset($user)) echo $user->school ?>"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label id="class_label" for="class">Classe :</label></td>
|
|
<td><select style="width: 100%;" id="class" name="class">
|
|
<option value="terminale"><?= SchoolClass::getTranslatedName(SchoolClass::TERMINALE) ?></option>
|
|
<option value="premiere"><?= SchoolClass::getTranslatedName(SchoolClass::PREMIERE) ?></option>
|
|
<option value="seconde"><?= SchoolClass::getTranslatedName(SchoolClass::SECONDE) ?></option>
|
|
</select></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label id="description_label" for="description">Description :</label></td>
|
|
<td><textarea style="width: 100%;" id="description"
|
|
name="description"><?php if (isset($user)) echo $user->description ?></textarea>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2"><input style="width: 100%;" type="submit" value="S'inscrire"/></td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
|
|
<script>
|
|
function selectRole() {
|
|
switch (document.getElementById("role").value) {
|
|
case "participant":
|
|
document.getElementById("school_label").style.display = "block";
|
|
document.getElementById("school").style.display = "block";
|
|
document.getElementById("class_label").style.display = "block";
|
|
document.getElementById("class").style.display = "block";
|
|
document.getElementById("description_label").style.display = "none";
|
|
document.getElementById("description").style.display = "none";
|
|
break;
|
|
case "encadrant":
|
|
document.getElementById("school_label").style.display = "none";
|
|
document.getElementById("school").style.display = "none";
|
|
document.getElementById("class_label").style.display = "none";
|
|
document.getElementById("class").style.display = "none";
|
|
document.getElementById("description_label").style.display = "block";
|
|
document.getElementById("description").style.display = "block";
|
|
break;
|
|
}
|
|
}
|
|
|
|
selectRole();
|
|
</script>
|
|
|
|
<?php } ?>
|
|
|
|
<?php require_once "footer.php" ?>
|