2019-09-07 11:42:36 +00:00
|
|
|
<?php
|
|
|
|
require_once "header.php";
|
|
|
|
?>
|
2019-09-06 11:48:50 +00:00
|
|
|
|
2019-09-08 23:50:26 +00:00
|
|
|
<div class="mt-4 mb-4">
|
|
|
|
<h1 class="display-4">Formulaire d'inscription</h1>
|
|
|
|
</div>
|
|
|
|
|
2019-09-06 11:48:50 +00:00
|
|
|
<?php
|
2019-09-07 13:51:16 +00:00
|
|
|
/** @var NewUser $user */
|
|
|
|
if (isset($user) && !$has_error) {
|
2019-09-08 23:50:26 +00:00
|
|
|
?>
|
|
|
|
<div class="alert alert-success">
|
2019-12-19 12:02:01 +00:00
|
|
|
Vous êtes bien inscrit ! Merci désormais de confirmer votre boîte mail pour valider votre adresse. Pensez à vérifier
|
|
|
|
vos courriers indésirables.
|
2019-09-08 23:50:26 +00:00
|
|
|
</div>
|
2019-09-06 11:48:50 +00:00
|
|
|
<?php } else if (isset($_SESSION["user_id"])) { ?>
|
2019-12-19 12:02:01 +00:00
|
|
|
<div class="alert alert-danger">
|
|
|
|
Vous êtes déjà connecté !
|
|
|
|
</div>
|
2019-09-06 11:48:50 +00:00
|
|
|
<?php } else { ?>
|
|
|
|
|
2019-09-07 13:51:16 +00:00
|
|
|
<form method="POST">
|
2019-09-08 23:50:26 +00:00
|
|
|
<div class="form-group row">
|
2020-01-22 21:18:55 +00:00
|
|
|
<div class="form-group col-md-12">
|
|
|
|
<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>
|
2019-09-08 23:50:26 +00:00
|
|
|
</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">
|
2019-12-19 12:02:01 +00:00
|
|
|
<input class="btn btn-primary btn-lg btn-block" name="register" type="submit" value="S'inscrire"/>
|
2019-09-08 23:50:26 +00:00
|
|
|
</div>
|
2019-09-07 13:51:16 +00:00
|
|
|
</form>
|
2019-09-06 11:48:50 +00:00
|
|
|
|
2019-09-07 13:51:16 +00:00
|
|
|
<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;
|
|
|
|
}
|
2019-09-06 11:48:50 +00:00
|
|
|
}
|
|
|
|
|
2019-09-07 13:51:16 +00:00
|
|
|
selectRole();
|
|
|
|
</script>
|
2019-09-06 11:48:50 +00:00
|
|
|
|
2019-09-07 11:42:36 +00:00
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
<?php require_once "footer.php" ?>
|