2019-09-06 11:48:50 +00:00
|
|
|
<?php
|
|
|
|
|
2019-09-07 23:35:05 +00:00
|
|
|
$tournaments = Tournament::getAllTournaments();
|
2019-09-06 11:48:50 +00:00
|
|
|
|
2020-04-12 22:35:22 +00:00
|
|
|
$emails = [];
|
2020-04-27 12:25:40 +00:00
|
|
|
$emails_validated = [];
|
2020-04-12 22:35:22 +00:00
|
|
|
|
2020-04-13 01:41:15 +00:00
|
|
|
if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN) {
|
2020-04-12 22:35:22 +00:00
|
|
|
foreach ($tournaments as $tournament) {
|
2020-04-27 12:25:40 +00:00
|
|
|
foreach ($tournament->getOrganizers() as $organizer) {
|
|
|
|
$emails[] = $organizer->getEmail();
|
|
|
|
$emails_validated[] = $organizer->getEmail();
|
|
|
|
}
|
2020-04-12 22:35:22 +00:00
|
|
|
|
2020-04-27 12:25:40 +00:00
|
|
|
foreach ($tournament->getAllTeams() as $team) {
|
|
|
|
foreach ($team->getEncadrants() as $encadrant_id) {
|
|
|
|
$encadrant = User::fromId($encadrant_id);
|
|
|
|
if ($encadrant != null) {
|
|
|
|
$emails[] = $encadrant->getEmail();
|
|
|
|
if ($team->getValidationStatus() == ValidationStatus::VALIDATED)
|
|
|
|
$emails_validated[] = $encadrant->getEmail();
|
|
|
|
}
|
|
|
|
}
|
2020-04-12 22:35:22 +00:00
|
|
|
|
2020-04-27 12:25:40 +00:00
|
|
|
foreach ($team->getParticipants() as $participant_id) {
|
|
|
|
$participant = User::fromId($participant_id);
|
|
|
|
if ($participant != null) {
|
|
|
|
$emails[] = $participant->getEmail();
|
|
|
|
if ($team->getValidationStatus() == ValidationStatus::VALIDATED)
|
|
|
|
$emails_validated[] = $participant->getEmail();
|
|
|
|
if ($participant->getResponsibleEmail() != null) {
|
|
|
|
$emails[] = $participant->getResponsibleEmail();
|
|
|
|
if ($team->getValidationStatus() == ValidationStatus::VALIDATED)
|
|
|
|
$emails_validated[] = $participant->getResponsibleEmail();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-12 22:35:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-07 11:42:36 +00:00
|
|
|
require_once "server_files/views/tournois.php";
|