plateforme-tfjm2/server_files/controllers/syntheses_orga.php

22 lines
796 B
PHP

<?php if (!isset($_SESSION["role"]) || $_SESSION["role"] != Role::ADMIN && $_SESSION["role"] != Role::ORGANIZER)
require_once "server_files/403.php";
if (isset($_POST["download_zip"])) {
$id = $_POST["tournament"];
$tournament = Tournament::fromId($id);
$file_name = getZipFile(DocumentType::SYNTHESIS, $id);
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=\"Notes de syntèses du tournoi de " . $tournament->getName() . ".zip\"");
header("Content-Length: " . filesize($file_name));
readfile($file_name);
exit();
}
$user = $_SESSION["user"];
$tournaments = $_SESSION["role"] == Role::ADMIN ? Tournament::getAllTournaments() : $user->getOrganizedTournaments();
require_once "server_files/views/syntheses_orga.php";