query("SELECT `id`, `name` FROM `tournaments` WHERE "
. ($_SESSION["role"] == "ADMIN" ? "" : "`organizer` = '" . $_SESSION["user_id"] . "' AND ")
. "`year` = $YEAR ORDER BY `name`;");
while (($data_tournament = $req->fetch()) !== false) {
echo "
Tournoi de " . $data_tournament["name"] . "
\n";
$id = $data_tournament["id"];
$files_req = $DB->query("SELECT *, COUNT(`problem`) AS `version` FROM `solutions` WHERE `tournament` = '$id' GROUP BY `team`, `problem` ORDER BY `team`, `problem`, `uploaded_at` DESC;");
while (($data_file = $files_req->fetch()) !== false) {
$file_id = $data_file["file_id"];
$problem = $data_file["problem"];
$version = $data_file["version"];
$team_id = $data_file["team"];
$team_data = $DB->query("SELECT `name`, `trigram` FROM `teams` WHERE `id` = '$team_id' AND `year` = $YEAR;")->fetch();
$team_name = $team_data["name"];
$team_trigram = $team_data["trigram"];
echo "Problème n°$problem de l'équipe $team_name ($team_trigram), version $version : Télécharger
";
}
}
?>