mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-11-26 16:47:10 +00:00
209 lines
10 KiB
PHP
209 lines
10 KiB
PHP
<?php
|
|
require_once "header.php";
|
|
?>
|
|
|
|
<div class="mt-4 mb-4">
|
|
<h1 class="display-4">Formulaire d'inscription</h1>
|
|
</div>
|
|
|
|
<?php
|
|
/** @var NewUser $user */
|
|
if (isset($user) && !$has_error) {
|
|
?>
|
|
<div class="alert alert-success">
|
|
Vous êtes bien inscrit ! Merci désormais de confirmer votre boîte mail pour valider votre adresse. Pensez à vérifier
|
|
vos courriers indésirables.
|
|
</div>
|
|
<?php } else if (isset($_SESSION["user_id"])) { ?>
|
|
<div class="alert alert-danger">
|
|
Vous êtes déjà connecté !
|
|
</div>
|
|
<?php } else { ?>
|
|
|
|
<form method="POST">
|
|
<div class="form-group row">
|
|
<label for="role">Rôle :</label>
|
|
<select id="role" name="role" onchange="selectRole()" class="custom-select">
|
|
<option value="participant"><?= Role::getTranslatedName(Role::PARTICIPANT) ?></option>
|
|
<option value="encadrant"><?= Role::getTranslatedName(Role::ENCADRANT) ?></option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="surname">Nom :</label>
|
|
<input class="form-control" type="text" id="surname" name="surname"
|
|
value="<?php if (isset($user)) echo $user->surname ?>" required/>
|
|
</div>
|
|
|
|
<div class="form-group col-md-6">
|
|
<label for="first_name">Prénom :</label>
|
|
<input class="form-control" type="text" id="first_name" name="first_name"
|
|
value="<?php if (isset($user)) echo $user->first_name ?>" required/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="email">E-mail :</label>
|
|
<input class="form-control" type="email" id="email" name="email"
|
|
value="<?php if (isset($user)) echo $user->email ?>"
|
|
required/>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="phone_number">Numéro de téléphone :</label>
|
|
<input class="form-control" type="text" id="phone_number" name="phone_number"
|
|
value="<?php if (isset($user)) echo $user->phone_number ?>"/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="password">Mot de passe :</label>
|
|
<input class="form-control" type="password" id="password" name="password" required/>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="confirm_password">Confirmer le mot de passe :</label>
|
|
<input class="form-control" type="password" id="confirm_password" name="confirm_password" required/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="gender" class="mr-2">Sexe :</label>
|
|
<br/>
|
|
<div class="custom-control custom-radio custom-control-inline">
|
|
<input type="radio" class="custom-control-input" id="male" name="gender" value="M"
|
|
required <?= isset($_POST["gender"]) && $_POST["gender"] == "M" ? "checked" : "" ?> />
|
|
<label for="male" class="custom-control-label">Homme</label>
|
|
</div>
|
|
<div class="custom-control custom-radio custom-control-inline">
|
|
<input type="radio" class="custom-control-input" id="female" name="gender" value="F"
|
|
required <?= isset($_POST["gender"]) && $_POST["gender"] == "F" ? "checked" : "" ?> />
|
|
<label for="female" class="custom-control-label">Femme</label>
|
|
</div>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="birth_date">Date de naissance :</label>
|
|
<input class="form-control" type="date" id="birth_date" name="birth_date"
|
|
value="<?php if (isset($user)) echo $user->birth_date ?>" required/>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-5">
|
|
<label for="address">Adresse :</label>
|
|
<input class="form-control" type="text" id="address" name="address"
|
|
value="<?php if (isset($user)) echo $user->address ?>"/>
|
|
</div>
|
|
<div class="form-group col-md-2">
|
|
<label for="postal_code">Code postal :</label>
|
|
<input class="form-control" type="number" id="postal_code" name="postal_code"
|
|
value="<?php if (isset($user)) echo $user->postal_code ?>" min="1000"
|
|
max="95999" required/>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="city">Ville :</label>
|
|
<input class="form-control" type="text" id="city" name="city"
|
|
value="<?php if (isset($user)) echo $user->city ?>"/>
|
|
</div>
|
|
<div class="form-group col-md-2">
|
|
<label for="country">Pays :</label>
|
|
<input class="form-control" type="text" id="country" name="country"
|
|
value="<?= isset($user) ? $user->country : "France" ?>" required/>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label id="school_label" for="school">Établissement dans lequel l'élève étudie :</label>
|
|
<input class="form-control" type="text" id="school" name="school"
|
|
value="<?php if (isset($user)) echo $user->school ?>"/>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label id="class_label" for="class">Classe :</label>
|
|
<select id="class" name="class" class="custom-select">
|
|
<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>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label id="responsible_name_label" for="responsible_name">Nom du responsable légal :</label>
|
|
<input class="form-control" type="text" id="responsible_name" name="responsible_name"
|
|
value="<?php if (isset($user)) echo $user->responsible_name ?>"/>
|
|
|
|
</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" name="register" type="submit" value="S'inscrire"/>
|
|
</div>
|
|
</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("school").require = "true";
|
|
document.getElementById("class_label").style.display = "block";
|
|
document.getElementById("class").style.display = "block";
|
|
document.getElementById("responsible_name_label").style.display = "block";
|
|
document.getElementById("responsible_name").style.display = "block";
|
|
document.getElementById("responsible_phone_label").style.display = "block";
|
|
document.getElementById("responsible_phone").style.display = "block";
|
|
document.getElementById("responsible_email_label").style.display = "block";
|
|
document.getElementById("responsible_email").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("school").require = "false";
|
|
document.getElementById("class_label").style.display = "none";
|
|
document.getElementById("class").style.display = "none";
|
|
document.getElementById("responsible_name_label").style.display = "none";
|
|
document.getElementById("responsible_name").style.display = "none";
|
|
document.getElementById("responsible_phone_label").style.display = "none";
|
|
document.getElementById("responsible_phone").style.display = "none";
|
|
document.getElementById("responsible_email_label").style.display = "none";
|
|
document.getElementById("responsible_email").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" ?>
|