1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-02-11 14:21:19 +00:00

Pas d'inscription possible après la date limite

This commit is contained in:
galaxyoyo 2019-09-12 18:47:57 +02:00
parent 1edc2cbd60
commit 4926539e25
11 changed files with 153 additions and 128 deletions

View File

@ -36,4 +36,4 @@ ENV CORRES2MATH_LOCAL_PATH /var/www/html
ENV CORRES2MATH_MAIL_DOMAIN correspondances-maths.fr
ENV CORRES2MATH_URL_BASE https://inscription.correspondances-maths.fr
RUN chmod 0777 /var/inscription-corres2math
RUN chmod 0777 /var/www/html

View File

@ -33,6 +33,9 @@ class NewTeam {
}
public function makeVerifications() {
global $CONFIG;
ensure(date("Y-m-d H:i:s") < $CONFIG->getInscriptionDate(), "La date limite d'inscription est dépassée.");
ensure($_SESSION["team"] == null, "Vous êtes déjà dans une équipe.");
ensure($this->name != null && $this->name != "", "Vous devez spécifier un nom d'équipe.");
ensure(preg_match("#^[\p{L} ]+$#ui", $this->name), "Le nom de l'équite ne doit pas comporter de caractères spéciaux.");

View File

@ -37,6 +37,9 @@ class NewUser
public function makeVerifications()
{
global $CONFIG;
ensure(date("Y-m-d H:i:s") < $CONFIG->getInscriptionDate(), "Les inscriptions sont terminées.");
ensure(filter_var($this->email, FILTER_VALIDATE_EMAIL), "L'adresse e-mail entrée est invalide.");
$this->email = strtolower($this->email);
ensure(!userExists($this->email), "Un compte existe déjà avec cette adresse e-mail.");

View File

@ -31,6 +31,9 @@ class JoinTeam
public function makeVerifications()
{
global $CONFIG;
ensure(date("Y-m-d H:i:s") < $CONFIG->getInscriptionDate(), "La date limite d'inscription est dépassée.");
ensure(preg_match("#[a-z0-9]{6}#", $this->access_code), "Le code d'accès doit comporter 6 caractères alphanumériques.");
ensure($this->team != null, "Ce code d'accès est invalide.");
ensure($this->team->getValidationStatus() == ValidationStatus::NOT_READY, "Cette équipe est déjà validée ou en cours de validation, vous ne pouvez pas la rejoindre.");

View File

@ -99,9 +99,10 @@ function trigramExists($trigram)
function canValidate(Team $team)
{
global $DB;
global $DB, $CONFIG;
$can_validate = $team->getValidationStatus() == ValidationStatus::NOT_READY;
$can_validate = date("Y-m-d H:i:s") < $CONFIG->getInscriptionDate();
$can_validate &= $team->getValidationStatus() == ValidationStatus::NOT_READY;
$can_validate &= $team->getEncadrantId() != null;
$can_validate &= $team->getParticipants()[2] != null;
@ -142,7 +143,7 @@ function printDocuments($documents)
function getZipFile($problem, $team_id = -1)
{
global $LOCAL_PATH, $DB;
global $LOCAL_PATH;
$zip = new ZipArchive();

View File

@ -5,6 +5,8 @@ if (isset($new_team) && !$has_error) { ?>
Votre équipe a bien été créée ! Voici le code d'accès à transmettre aux autres membres de votre équipe : <strong><?= $new_team->access_code ?></strong>
<?php } elseif ($_SESSION["team"] != NULL) { ?>
<h2>Vous êtes déjà dans une équipe.</h2>
<?php } elseif(date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate()) { ?>
<h2>La date limite d'inscription est dépassée.</h2>
<?php } else { ?>
<?php if (isset($error_message) && $error_message) echo "<h2>Erreur : " . $error_message . "</h2>"; ?>

View File

@ -28,14 +28,18 @@
<li><a href="<?= $URL_BASE ?>/problemes">Liste des problèmes</a></li>
<?php if (!isset($_SESSION["user_id"])) { ?>
<li><a href="<?= $URL_BASE ?>/connexion">Connexion</a></li>
<?php if (date("Y-m-d H:i:s") < $CONFIG->getInscriptionDate()) { ?>
<li><a href="<?= $URL_BASE ?>/inscription">Inscription</a></li>
<?php } else { ?>
<?php }
} else { ?>
<li><a href="<?= $URL_BASE ?>/mon_compte">Mon compte</a></li>
<?php if ($_SESSION["role"] == Role::ENCADRANT || $_SESSION["role"] == Role::PARTICIPANT) { ?>
<?php if ($_SESSION["team"] == NULL) { ?>
<?php if ($_SESSION["team"] == NULL) {
if (date("Y-m-d H:i:s") < $CONFIG->getInscriptionDate()) { ?>
<li><a href="<?= $URL_BASE ?>/ajouter_equipe">Ajouter une équipe</a></li>
<li><a href="<?= $URL_BASE ?>/rejoindre_equipe">Rejoindre une équipe</a></li>
<?php } else { ?>
<?php }
} else { ?>
<li><a href="<?= $URL_BASE ?>/mon_equipe">Mon équipe</a></li>
<?php if ($_SESSION["team"]->getValidationStatus() == ValidationStatus::VALIDATED || true) { ?>
<?php } ?>

View File

@ -12,6 +12,8 @@ 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 } elseif(date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate()) { ?>
<h2>La date limite d'inscription est dépassée.</h2>
<?php } else { ?>
<form method="POST">

View File

@ -25,10 +25,14 @@ for ($i = 1; $i <= 5; ++$i) {
$id = $participant->getId();
echo "Participant $i : <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
}
?>
Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
<?php if (isset($_GET["modifier"])) { ?>
<?php if (date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate() && $team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
<strong>La date limite d'inscription est dépassée, vous ne pouvez plus demander la validation de votre équipe.</strong>
<?php } else {
if (isset($_GET["modifier"])) { ?>
<form method="POST">
<input type="hidden" name="team_edit" value="true"/>
@ -139,5 +143,6 @@ for ($i = 1; $i <= 5; ++$i) {
</table>
<?php } ?>
<?php } ?>
<?php } ?>
<?php require_once "footer.php" ?>

View File

@ -13,7 +13,7 @@
for ($i = 1; $i <= 4; ++$i) {
?>
<tr style="border: 1px solid black">
<td style="border: 1px solid black; text-align: center"><a href="<?= $URL_BASE ?>/probleme/<?= $i ?>"><?= $i ?></a></td>
<td style="border: 1px solid black; text-align: center"><a href="<?= $URL_BASE ?>/probleme/<?= $i ?>">Problème <?= $i ?></a></td>
</tr>
<?php
}

View File

@ -3,6 +3,8 @@ require_once "header.php" ;
if (isset($join_team) && !$has_error) { ?>
Vous avez bien rejoint l'équipe <?= $_SESSION["team"]->getName() ?> !
<?php } elseif(date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate()) { ?>
<h2>La date limite d'inscription est dépassée.</h2>
<?php } else { ?>
<?php if ($has_error) echo "<h2>Erreur : " . $error_message . "</h2>"; ?>