mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 01:32:05 +01:00 
			
		
		
		
	Le tournoi de la finale nationale est désormais une variable globale
This commit is contained in:
		@@ -17,9 +17,9 @@ if (isset($_POST["validate"])) {
 | 
				
			|||||||
if (isset($_POST["select"])) {
 | 
					if (isset($_POST["select"])) {
 | 
				
			||||||
	$team->selectForFinal(true);
 | 
						$team->selectForFinal(true);
 | 
				
			||||||
	$team->setValidationStatus(ValidationStatus::NOT_READY);
 | 
						$team->setValidationStatus(ValidationStatus::NOT_READY);
 | 
				
			||||||
	$_SESSION["final"] = Tournament::getFinalTournament();
 | 
					
 | 
				
			||||||
	
 | 
						/** @noinspection SqlAggregates */
 | 
				
			||||||
	$sols_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? AND `tournament` = ? GROUP BY `problem`, `uploaded_at` ORDER BY `problem`, `uploaded_at` DESC;");
 | 
						$sols_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? AND `tournament` = ? GROUP BY `problem` ORDER BY `problem`, `uploaded_at` DESC;");
 | 
				
			||||||
	$sols_req->execute([$team->getId(), $team->getTournamentId()]);
 | 
						$sols_req->execute([$team->getId(), $team->getTournamentId()]);
 | 
				
			||||||
	while (($sol_data = $sols_req->fetch()) !== false) {
 | 
						while (($sol_data = $sols_req->fetch()) !== false) {
 | 
				
			||||||
		$old_id = $sol_data["file_id"];
 | 
							$old_id = $sol_data["file_id"];
 | 
				
			||||||
@@ -57,7 +57,7 @@ if (isset($_POST["select"])) {
 | 
				
			|||||||
		copy("$LOCAL_PATH/files/$old_id", "$LOCAL_PATH/files/$id");
 | 
							copy("$LOCAL_PATH/files/$old_id", "$LOCAL_PATH/files/$id");
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		$req = $DB->prepare("INSERT INTO `syntheses`(`file_id`, `team`, `tournament`, `dest`) VALUES (?, ?, ?, ?);");
 | 
							$req = $DB->prepare("INSERT INTO `syntheses`(`file_id`, `team`, `tournament`, `dest`) VALUES (?, ?, ?, ?);");
 | 
				
			||||||
		$req->execute([$id, $team->getId(), $_SESSION["final"]->getId(), $synthese_data["dest"]]);
 | 
							$req->execute([$id, $team->getId(), $FINAL->getId(), $synthese_data["dest"]]);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -66,7 +66,7 @@ $documents_req->execute([$team->getId(), $team->getId()]);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if ($team->isSelectedForFinal()) {
 | 
					if ($team->isSelectedForFinal()) {
 | 
				
			||||||
	$documents_final_req = $DB->prepare("SELECT `file_id`, `user`, `type`, COUNT(`type`) AS `version` FROM `documents` WHERE `team` = ? AND `tournament` != ? GROUP BY `user`, `type` ORDER BY `user`, `type` ASC, MAX(`uploaded_at`) DESC;");
 | 
						$documents_final_req = $DB->prepare("SELECT `file_id`, `user`, `type`, COUNT(`type`) AS `version` FROM `documents` WHERE `team` = ? AND `tournament` != ? GROUP BY `user`, `type` ORDER BY `user`, `type` ASC, MAX(`uploaded_at`) DESC;");
 | 
				
			||||||
	$documents_final_req->execute([$team->getId(), $_SESSION["final"]->getId()]);
 | 
						$documents_final_req->execute([$team->getId(), $FINAL->getId()]);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$tournament = Tournament::fromId($team->getTournamentId());
 | 
					$tournament = Tournament::fromId($team->getTournamentId());
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,7 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["team"]) && $_SESSION["team"]
 | 
				
			|||||||
	$tournament = Tournament::fromId($team->getTournamentId());
 | 
						$tournament = Tournament::fromId($team->getTournamentId());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$documents_req = $DB->prepare("SELECT `file_id`, `type`, COUNT(`type`) AS `version` FROM `documents` WHERE `user` = ? AND `tournament` = ? GROUP BY `type`, `uploaded_at` ORDER BY `type`, `uploaded_at` DESC;");
 | 
						$documents_req = $DB->prepare("SELECT `file_id`, `type`, COUNT(`type`) AS `version` FROM `documents` WHERE `user` = ? AND `tournament` = ? GROUP BY `type`, `uploaded_at` ORDER BY `type`, `uploaded_at` DESC;");
 | 
				
			||||||
	$documents_req->execute([$_SESSION["user_id"], $_SESSION[$team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $tournament->getId()]]);
 | 
						$documents_req->execute([$_SESSION["user_id"], $_SESSION[$team->isSelectedForFinal() ? $FINAL->getId() : $tournament->getId()]]);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
    require_once "server_files/403.php";
 | 
					    require_once "server_files/403.php";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,9 +11,9 @@ if (isset($_POST["send_solution"])) {
 | 
				
			|||||||
$team = $_SESSION["team"];
 | 
					$team = $_SESSION["team"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$solutions_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? AND `tournament` = ? GROUP BY `problem`, `uploaded_at` ORDER BY `problem`, `uploaded_at` DESC;");
 | 
					$solutions_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? AND `tournament` = ? GROUP BY `problem`, `uploaded_at` ORDER BY `problem`, `uploaded_at` DESC;");
 | 
				
			||||||
$solutions_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId()]]);
 | 
					$solutions_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $FINAL->getId() : $team->getTournamentId()]]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId());
 | 
					$tournament = Tournament::fromId($team->isSelectedForFinal() ? $FINAL->getId() : $team->getTournamentId());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function saveSolution() {
 | 
					function saveSolution() {
 | 
				
			||||||
    global $LOCAL_PATH, $DB;
 | 
					    global $LOCAL_PATH, $DB;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,9 +11,9 @@ if (isset($_POST["send_synthese"])) {
 | 
				
			|||||||
$team = $_SESSION["team"];
 | 
					$team = $_SESSION["team"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$syntheses_req = $DB->prepare("SELECT `file_id`, `dest`, COUNT(`dest`) AS `version` FROM `syntheses` WHERE `team` = ? AND `tournament` = ? GROUP BY `dest`, `uploaded_at` ORDER BY `dest`, `uploaded_at` DESC;");
 | 
					$syntheses_req = $DB->prepare("SELECT `file_id`, `dest`, COUNT(`dest`) AS `version` FROM `syntheses` WHERE `team` = ? AND `tournament` = ? GROUP BY `dest`, `uploaded_at` ORDER BY `dest`, `uploaded_at` DESC;");
 | 
				
			||||||
$syntheses_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId()]]);
 | 
					$syntheses_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $FINAL->getId() : $team->getTournamentId()]]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId());
 | 
					$tournament = Tournament::fromId($team->isSelectedForFinal() ? $FINAL->getId() : $team->getTournamentId());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function saveSynthese() {
 | 
					function saveSynthese() {
 | 
				
			||||||
    global $LOCAL_PATH, $DB;
 | 
					    global $LOCAL_PATH, $DB;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function loadUserValues() {
 | 
					$FINAL = Tournament::getFinalTournament();
 | 
				
			||||||
	$_SESSION["final"] = Tournament::getFinalTournament();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function loadUserValues() {
 | 
				
			||||||
	$_SESSION["user"] = $_SESSION["team"] = $_SESSION["tournament"] = null;
 | 
						$_SESSION["user"] = $_SESSION["team"] = $_SESSION["tournament"] = null;
 | 
				
			||||||
	unset($_SESSION["user"]);
 | 
						unset($_SESSION["user"]);
 | 
				
			||||||
	unset($_SESSION["role"]);
 | 
						unset($_SESSION["role"]);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,7 +21,7 @@ for ($i = 1; $i <= 6; ++$i) {
 | 
				
			|||||||
	echo "Participant $i : <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
 | 
						echo "Participant $i : <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
if ($team->isSelectedForFinal()) {
 | 
					if ($team->isSelectedForFinal()) {
 | 
				
			||||||
	$final_name = $_SESSION["final"]->getName();
 | 
						$final_name = $FINAL->getName();
 | 
				
			||||||
	echo "<strong>Équipe sélectionnée pour la <a href=\"$URL_BASE/tournoi/$final_name\">finale nationale</a>.</strong>";
 | 
						echo "<strong>Équipe sélectionnée pour la <a href=\"$URL_BASE/tournoi/$final_name\">finale nationale</a>.</strong>";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,7 +33,7 @@ for ($i = 1; $i <= 6; ++$i) {
 | 
				
			|||||||
?>
 | 
					?>
 | 
				
			||||||
Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
 | 
					Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
 | 
				
			||||||
<?php if ($team->isSelectedForFinal()) {
 | 
					<?php if ($team->isSelectedForFinal()) {
 | 
				
			||||||
	$final_name = $_SESSION["final"]->getName();
 | 
						$final_name = $FINAL->getName();
 | 
				
			||||||
	echo "<strong>Équipe sélectionnée pour la <a href=\"$URL_BASE/tournoi/$final_name\">finale nationale</a>.</strong><br />";
 | 
						echo "<strong>Équipe sélectionnée pour la <a href=\"$URL_BASE/tournoi/$final_name\">finale nationale</a>.</strong><br />";
 | 
				
			||||||
} ?>
 | 
					} ?>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -120,7 +120,7 @@ Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
 | 
				
			|||||||
					</td>
 | 
										</td>
 | 
				
			||||||
					<td>
 | 
										<td>
 | 
				
			||||||
						<select style="width: 100%;" id="type" name="type">
 | 
											<select style="width: 100%;" id="type" name="type">
 | 
				
			||||||
							<?php if ($_SESSION["user"]->getBirthDate() > strval($YEAR - 18) . substr($tournament_data["date_start"], 4)) { ?>
 | 
												<?php if ($_SESSION["user"]->getBirthDate() > strval($YEAR - 18) . substr($tournament->getStartDate(), 4)) { ?>
 | 
				
			||||||
								<option value="parental_consent">Autorisation parentale</option>
 | 
													<option value="parental_consent">Autorisation parentale</option>
 | 
				
			||||||
							<?php } ?>
 | 
												<?php } ?>
 | 
				
			||||||
							<option value="photo_consent">Autorisation de droit à l'image</option>
 | 
												<option value="photo_consent">Autorisation de droit à l'image</option>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user