mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 17:02:28 +00:00
Collect emails
This commit is contained in:
parent
45426e6835
commit
a86bc3f124
@ -17,6 +17,7 @@ $DB_NAME = getenv("TFJM_DB_NAME");
|
|||||||
$DB_USER = getenv("TFJM_DB_USER");
|
$DB_USER = getenv("TFJM_DB_USER");
|
||||||
$DB_PASSWORD = getenv("TFJM_DB_PASSWORD");
|
$DB_PASSWORD = getenv("TFJM_DB_PASSWORD");
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$DB = new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME;charset=utf8", "$DB_USER", "$DB_PASSWORD", array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
$DB = new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME;charset=utf8", "$DB_USER", "$DB_PASSWORD", array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
||||||
}
|
}
|
||||||
|
@ -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";
|
require_once "server_files/views/tournoi.php";
|
||||||
|
@ -2,4 +2,31 @@
|
|||||||
|
|
||||||
$tournaments = Tournament::getAllTournaments();
|
$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";
|
require_once "server_files/views/tournois.php";
|
||||||
|
@ -59,6 +59,10 @@ if ($tournament->isFinal())
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if (!isset($_GET["modifier"]) && ($_SESSION["role"] == Role::ADMIN || $_SESSION["role"] == Role::ORGANIZER && $tournament->organize($_SESSION["user_id"]))) { ?>
|
<?php if (!isset($_GET["modifier"]) && ($_SESSION["role"] == Role::ADMIN || $_SESSION["role"] == Role::ORGANIZER && $tournament->organize($_SESSION["user_id"]))) { ?>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<a href="mailto:contact@tfjm.org?<? foreach ($emails as $email) echo "bcc=" . $email . "&" ?>subject=TFJM² <?= $YEAR ?>" target="_blank">Envoyer un mail à toutes les personnes inscrites au tournoi</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<a href="/tournoi/<?= $tournament->getName() ?>/modifier"><button class="btn btn-secondary btn-lg btn-block">Éditer le tournoi</button></a>
|
<a href="/tournoi/<?= $tournament->getName() ?>/modifier"><button class="btn btn-secondary btn-lg btn-block">Éditer le tournoi</button></a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
<h2 class="display-3">Liste des tournois</h2>
|
<h2 class="display-3">Liste des tournois</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<a href="mailto:contact@tfjm.org?<? foreach ($emails as $email) echo "bcc=" . $email . "&" ?>subject=TFJM² <?= $YEAR ?>" target="_blank">Envoyer un mail à toutes les personnes inscrites au tournoi</a>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<table class="table table-striped table-bordered table-hover">
|
<table class="table table-striped table-bordered table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
Loading…
Reference in New Issue
Block a user