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

Changement confinement

This commit is contained in:
Yohann D'ANELLO
2020-04-13 03:41:15 +02:00
parent a86bc3f124
commit 50aec3c105
13 changed files with 104 additions and 25 deletions

View File

@ -68,6 +68,24 @@ if (isset($_POST["download_zip"])) {
exit();
}
if (isset($_POST["select_tournament"])) {
$new_tournament = Tournament::fromId($_POST["select_tournament"]);
ensure($new_tournament != null, "Le tournoi indiqué n'existe pas.");
$team->setTournamentId($new_tournament->getId());
$DB->prepare("UPDATE `documents` SET `tournament` = ? WHERE `team` = ?;")->execute([$tournament->getId(), $team->getId()]);
$DB->prepare("UPDATE `solutions` SET `tournament` = ? WHERE `team` = ?;")->execute([$tournament->getId(), $team->getId()]);
$DB->prepare("UPDATE `syntheses` SET `tournament` = ? WHERE `team` = ?;")->execute([$tournament->getId(), $team->getId()]);
foreach ($team->getParticipants() as $user) {
if ($user != null)
$DB->prepare("UPDATE `payments` SET `tournament` = ? WHERE `user` = ?;")->execute([$tournament->getId(), $user]);
}
foreach ($team->getEncadrants() as $user) {
if ($user != null)
$DB->prepare("UPDATE `payments` SET `tournament` = ? WHERE `user` = ?;")->execute([$tournament->getId(), $user]);
}
$tournament = $new_tournament;
}
class EditTeam
{
public $name;

View File

@ -78,12 +78,24 @@ class MyTeam
public function updateTeam()
{
global $URL_BASE;
global $URL_BASE, $DB;
$this->team->setName($this->name);
$this->team->setTrigram($this->trigram);
$this->team->setTournamentId($this->tournament_id);
$DB->prepare("UPDATE `documents` SET `tournament` = ? WHERE `team` = ?;")->execute([$this->tournament_id, $this->team->getId()]);
$DB->prepare("UPDATE `solutions` SET `tournament` = ? WHERE `team` = ?;")->execute([$this->tournament_id, $this->team->getId()]);
$DB->prepare("UPDATE `syntheses` SET `tournament` = ? WHERE `team` = ?;")->execute([$this->tournament_id, $this->team->getId()]);
foreach ($this->team->getParticipants() as $user) {
if ($user != null)
$DB->prepare("UPDATE `payments` SET `tournament` = ? WHERE `user` = ?;")->execute([$this->tournament_id, $user]);
}
foreach ($this->team->getEncadrants() as $user) {
if ($user != null)
$DB->prepare("UPDATE `payments` SET `tournament` = ? WHERE `user` = ?;")->execute([$this->tournament_id, $user]);
}
$_SESSION["tournament"] = $this->tournament;
header("Location: $URL_BASE/mon-equipe");

View File

@ -6,4 +6,11 @@ if (!isset($_SESSION["user_id"]) || $_SESSION["role"] != Role::ADMIN)
$orphans = isset($_GET["orphans"]);
$users = $orphans ? User::getOrphanUsers() : User::getAllUsers();
$emails = [];
if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN) {
foreach ($users as $user)
$emails[] = $user->getEmail();
}
require_once "server_files/views/profils.php";

View File

@ -4,7 +4,7 @@ $tournaments = Tournament::getAllTournaments();
$emails = [];
if ($_SESSION["role"] == Role::ENCADRANT || $_SESSION["role"] == Role::ADMIN) {
if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN) {
foreach ($tournaments as $tournament) {
foreach ($tournament->getOrganizers() as $organizer)
$emails[] = $organizer->getEmail();