1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-30 00:31:09 +02:00

Utilisation d'un dispatcher pour gérer les redirections

This commit is contained in:
galaxyoyo
2019-09-07 13:42:36 +02:00
parent ae648d7615
commit 4d3f6d1847
45 changed files with 246 additions and 190 deletions

View File

@ -1,20 +1,19 @@
<?php
require_once "../config.php";
if (!isset($_SESSION["team_id"]))
require_once "../403.php";
if (!isset($_SESSION["team"]))
require_once "server_files/403.php";
if (isset($_POST["send_solution"])) {
$error_message = saveSolution();
}
$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([$_SESSION["team_id"], $_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
/** @var Team $team */
$team = $_SESSION["team"];
$tournament_req = $DB->prepare("SELECT `date_solutions` FROM `tournaments` WHERE `id` = ?;");
$tournament_req->execute([$_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
$tournament_data = $tournament_req->fetch();
$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()]]);
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId());
function saveSolution() {
global $LOCAL_PATH, $DB;
@ -58,6 +57,4 @@ function saveSolution() {
return false;
}
require_once "../views/header.php";
require_once "../views/solutions.php";
require_once "../views/footer.php";
require_once "server_files/views/solutions.php";