1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-26 18:22:21 +00:00
plateforme-corres2math/server_files/views/inscription.php

153 lines
7.2 KiB
PHP
Raw Normal View History

<?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 } elseif(date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate()) { ?>
<div class="alert alert-danger">
La date limite d'inscription est dépassée.
</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>
2019-10-04 20:36:23 +00:00
<div class="alert alert-info">
L'adresse mail sert uniquement à recevoir les informations de déroulement des Correspondances.
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="email">E-mail :</label>
<input class="form-control" type="email" id="email" name="email"
2019-10-04 20:36:23 +00:00
value="<?php if (isset($user)) echo $user->email ?>" required/>
</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 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>
2019-10-04 20:36:23 +00:00
<div class="form-group col-md-6">
<label id="city_label" for="city">Ville de l'établissement :</label>
<input class="form-control" type="text" id="city" name="city"
value="<?php if (isset($user)) echo $user->city ?>"/>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label id="country_label" for="country">Pays :</label>
<input class="form-control" type="text" id="country" name="country"
value="<?php if (isset($user)) echo $user->country; else echo "France" ?>"/>
</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-group row">
2019-10-04 20:36:23 +00:00
<label id="description_label" for="description">Activité professionnelle :</label>
<textarea class="form-control" id="description"
name="description"><?php if (isset($user)) echo $user->description ?></textarea>
</div>
2019-10-04 20:36:23 +00:00
<label for="receive_animath_mails">J'accepte dêtre recontacté par l'association <em>Animath</em> au sujet
d'autres activités à l'issue des Correspondances (<em>facultatif</em>) :</label>
<input type="checkbox" id="receive_animath_mails" name="receive_animath_mails"
<?= isset($user) && $user->receive_animath_mails ? "checked" : "" ?> /><br /><br />
<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("class_label").style.display = "block";
document.getElementById("class").style.display = "block";
2019-10-04 20:36:23 +00:00
document.getElementById("city_label").style.display = "block";
document.getElementById("city").style.display = "block";
document.getElementById("country_label").style.display = "block";
document.getElementById("country").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";
2019-10-04 20:36:23 +00:00
document.getElementById("city_label").style.display = "none";
document.getElementById("city").style.display = "none";
document.getElementById("country_label").style.display = "none";
document.getElementById("country").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" ?>