mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 06:22:13 +01:00 
			
		
		
		
	Changement confinement
This commit is contained in:
		@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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");
 | 
			
		||||
 
 | 
			
		||||
@@ -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";
 | 
			
		||||
@@ -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();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user