plateforme-tfjm2/server_files/controllers/tournois.php

33 lines
884 B
PHP

<?php
$tournaments = Tournament::getAllTournaments();
$emails = [];
if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN) {
foreach ($tournaments as $tournament) {
foreach ($tournament->getOrganizers() as $organizer)
$emails[] = $organizer->getEmail();
foreach ($tournament->getAllTeams() as $team) {
foreach ($team->getEncadrants() as $encadrant_id) {
$encadrant = User::fromId($encadrant_id);
if ($encadrant != null)
$emails[] = $encadrant->getEmail();
}
foreach ($team->getParticipants() as $participant_id) {
$participant = User::fromId($participant_id);
if ($participant != null) {
$emails[] = $participant->getEmail();
if ($participant->getResponsibleEmail() != null) {
$emails[] = $participant->getResponsibleEmail();
}
}
}
}
}
}
require_once "server_files/views/tournois.php";