2019-08-26 16:27:55 +02:00
|
|
|
<?php
|
|
|
|
|
2019-09-07 01:33:05 +02:00
|
|
|
if (!isset($_SESSION["role"]) || $_SESSION["role"] != Role::ADMIN && $_SESSION["role"] != Role::ORGANIZER)
|
2019-09-07 13:42:36 +02:00
|
|
|
require_once "server_files/403.php";
|
2019-09-06 13:48:50 +02:00
|
|
|
|
2019-08-26 16:27:55 +02:00
|
|
|
if (isset($_POST["download_zip"])) {
|
|
|
|
$id = $_POST["tournament"];
|
2019-09-10 00:57:33 +02:00
|
|
|
$tournament = Tournament::fromId($id);
|
2019-08-26 16:27:55 +02:00
|
|
|
|
2019-09-09 12:15:48 +02:00
|
|
|
$file_name = getZipFile(DocumentType::SOLUTION, $id);
|
2019-08-26 16:27:55 +02:00
|
|
|
|
|
|
|
header("Content-Type: application/zip");
|
2019-09-08 01:35:05 +02:00
|
|
|
header("Content-Disposition: attachment; filename=\"Solutions du tournoi de " . $tournament->getName() . ".zip\"");
|
2019-09-09 12:15:48 +02:00
|
|
|
header("Content-Length: " . strval(filesize($file_name)));
|
2019-08-26 16:27:55 +02:00
|
|
|
|
2019-09-09 12:15:48 +02:00
|
|
|
readfile($file_name);
|
2019-08-26 16:27:55 +02:00
|
|
|
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2019-09-08 01:35:05 +02:00
|
|
|
$user = $_SESSION["user"];
|
|
|
|
$tournaments = $_SESSION["role"] == Role::ADMIN ? Tournament::getAllTournaments() : $user->getOrganizedTournaments();
|
2019-08-21 22:56:46 +02:00
|
|
|
|
2019-09-08 01:35:05 +02:00
|
|
|
require_once "server_files/views/solutions_orga.php";
|