mirror of
				https://gitlab.com/animath/si/plateforme-corres2math.git
				synced 2025-11-04 13:12:20 +01:00 
			
		
		
		
	Possibilité de ne pas choisir de problème immédiatement
This commit is contained in:
		@@ -50,7 +50,7 @@ $ROUTES["^mon-equipe/(modifier)/?$"] = ["server_files/controllers/mon_equipe.php
 | 
			
		||||
$ROUTES["^mon-equipe/?$"] = ["server_files/controllers/mon_equipe.php"];
 | 
			
		||||
$ROUTES["^mon-tournoi/?$"] = ["server_files/controllers/mon_tournoi.php"];
 | 
			
		||||
$ROUTES["^poser-questions-2$"] = ["server_files/controllers/poser_questions.php"];
 | 
			
		||||
$ROUTES["^probleme/([1-4])/?$"] = ["server_files/controllers/probleme.php", "probleme"];
 | 
			
		||||
$ROUTES["^probleme/([0-4])/?$"] = ["server_files/controllers/probleme.php", "probleme"];
 | 
			
		||||
$ROUTES["^profils-orphelins/?$"] = ["server_files/controllers/profils_orphelins.php"];
 | 
			
		||||
$ROUTES["^rejoindre-equipe/?$"] = ["server_files/controllers/rejoindre_equipe.php"];
 | 
			
		||||
$ROUTES["^repondre-questions-3$"] = ["server_files/controllers/repondre_questions.php"];
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ class NewTeam {
 | 
			
		||||
		ensure(preg_match("#^[A-Z]{3}$#", $this->trigram), "Le trigramme entré n'est pas valide.");
 | 
			
		||||
		ensure(!teamExists($this->name), "Une équipe existe déjà avec ce nom.");
 | 
			
		||||
		ensure(!trigramExists($this->trigram), "Une équipe a déjà choisi ce trigramme.");
 | 
			
		||||
		ensure(preg_match("#[1-4]#", $this->problem), "Le problème choisi n'a pas été reconnu.");
 | 
			
		||||
		ensure(preg_match("#[0-4]#", $this->problem), "Le problème choisi n'a pas été reconnu.");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function register() {
 | 
			
		||||
 
 | 
			
		||||
@@ -81,7 +81,7 @@ class MyTeam
 | 
			
		||||
		ensure(preg_match("#^[\p{L} ]+$#ui", $this->name), "Le nom de l'équipe ne doit pas comporter de caractères spéciaux.");
 | 
			
		||||
		ensure(preg_match("#^[A-Z]{3}$#", $this->trigram), "Le trigramme n'est pas valide.");
 | 
			
		||||
		ensure($this->trigram == $this->team->getTrigram() || !trigramExists($this->trigram), "Une équipe a déjà choisi ce trigramme.");
 | 
			
		||||
		ensure(preg_match("#^[1-4]$#", $this->problem), "Le problème indiqué n'existe pas.");
 | 
			
		||||
		ensure(preg_match("#^[0-4]$#", $this->problem), "Le problème indiqué n'existe pas.");
 | 
			
		||||
		ensure(date("Y-m-d H:i:s") <= $CONFIG->getInscriptionDate(), "Les inscriptions sont terminées.");
 | 
			
		||||
		ensure($this->team->getValidationStatus() == ValidationStatus::NOT_READY, "Votre équipe est déjà validée ou en cours de validation.");
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
$problem = htmlspecialchars($_GET["probleme"]);
 | 
			
		||||
 | 
			
		||||
if (!preg_match("#[1-4]#", $problem))
 | 
			
		||||
if (!preg_match("#[0-4]#", $problem))
 | 
			
		||||
	require_once "server_files/404.php";
 | 
			
		||||
 | 
			
		||||
if (isset($_GET["modifier"]) && $_SESSION["role"] != Role::ADMIN)
 | 
			
		||||
 
 | 
			
		||||
@@ -93,6 +93,7 @@ function canValidate(Team $team)
 | 
			
		||||
	$can_validate &= $team->getValidationStatus() == ValidationStatus::NOT_READY;
 | 
			
		||||
	$can_validate &= $team->getEncadrantId() != null;
 | 
			
		||||
	$can_validate &= $team->getParticipants()[2] != null;
 | 
			
		||||
	$can_validate &= preg_match("#[1-4]#", $team->getProblem());
 | 
			
		||||
 | 
			
		||||
	if ($team->getEncadrantId() != null) {
 | 
			
		||||
		$req = $DB->prepare("SELECT COUNT(*) AS `version` FROM `documents` WHERE `user` = ? AND `problem` = ?;");
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,7 @@ require_once "header.php";
 | 
			
		||||
    <div class="form-group row">
 | 
			
		||||
        <label for="problem">Problème :</label>
 | 
			
		||||
        <select id="problem" name="problem" class="custom-select">
 | 
			
		||||
            <option value="0">Choisir un problème (le problème peut-être choisi plus tard)</option>
 | 
			
		||||
			<?php
 | 
			
		||||
			for ($i = 1; $i <= 4; ++$i)
 | 
			
		||||
				echo "<option value='$i' " . (isset($new_team) && $new_team->problem == $i ? "selected" : "") . ">$i</option>";
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,8 @@ require_once "header.php";
 | 
			
		||||
        <strong>Trigramme :</strong> <?= $team->getTrigram() ?>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="alert alert-info">
 | 
			
		||||
        <strong>Problème :</strong> <a href="/probleme/<?= $team->getProblem() ?>"><?= $team->getProblem() ?></a>
 | 
			
		||||
        <strong>Problème :</strong> <a href="/probleme/<?= $team->getProblem() ?>">
 | 
			
		||||
            <?= $team->getProblem() == 0 ? "Pas de problème choisi" : $team->getProblem() ?></a>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="alert alert-info">
 | 
			
		||||
		<?php
 | 
			
		||||
@@ -80,6 +81,7 @@ require_once "header.php";
 | 
			
		||||
            <div class="form-group row">
 | 
			
		||||
                <label for="problem">Problème :</label>
 | 
			
		||||
                <select id="problem" name="problem" class="custom-select">
 | 
			
		||||
                    <option value="0">Choisir un problème (peut être choisi plus tard)</option>
 | 
			
		||||
					<?php
 | 
			
		||||
					for ($i = 1; $i <= 4; ++$i)
 | 
			
		||||
						echo "<option value='$i' " . ($team->getProblem() == $i ? "selected" : "") . ">$i</option>";
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user