mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-25 16:57:26 +02:00
Collect emails
This commit is contained in:
@ -122,4 +122,28 @@ class UpdateTournament
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SESSION["role"] == Role::ENCADRANT || $_SESSION["role"] == Role::ADMIN) {
|
||||
$emails = [];
|
||||
foreach ($tournament->getOrganizers() as $organizer)
|
||||
$emails[] = $organizer->getEmail();
|
||||
|
||||
foreach ($teams 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/tournoi.php";
|
||||
|
@ -2,4 +2,31 @@
|
||||
|
||||
$tournaments = Tournament::getAllTournaments();
|
||||
|
||||
$emails = [];
|
||||
|
||||
if ($_SESSION["role"] == Role::ENCADRANT || $_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";
|
||||
|
Reference in New Issue
Block a user