mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2024-12-05 02:06:52 +00:00
Mails groupés
This commit is contained in:
parent
79400ca298
commit
7e02a2dd2a
@ -237,4 +237,18 @@ class Team
|
||||
|
||||
return $docs;
|
||||
}
|
||||
|
||||
public function getAllEmails()
|
||||
{
|
||||
$emails = [];
|
||||
if ($this->getEncadrantId() != null)
|
||||
$emails[] = User::fromId($this->getEncadrantId())->getEmail();
|
||||
|
||||
foreach ($this->getParticipants() as $participantId) {
|
||||
if ($participantId != 0)
|
||||
$emails[] = User::fromId($participantId)->getEmail();
|
||||
}
|
||||
|
||||
return $emails;
|
||||
}
|
||||
}
|
||||
|
@ -13,4 +13,14 @@ $error_message = null;
|
||||
|
||||
$teams = Team::getAllTeams($problem);
|
||||
|
||||
$validated_emails = [];
|
||||
$not_validated_emails = [];
|
||||
|
||||
foreach ($teams as $team) {
|
||||
if ($team->getValidationStatus() == ValidationStatus::VALIDATED)
|
||||
$validated_emails = array_merge($validated_emails, $team->getAllEmails());
|
||||
else
|
||||
$not_validated_emails = array_merge($not_validated_emails, $team->getAllEmails());
|
||||
}
|
||||
|
||||
require_once "server_files/views/probleme.php";
|
||||
|
@ -54,15 +54,16 @@ for ($problem = 1; $problem <= 4; ++$problem)
|
||||
$videos[] = Video::getVideos(Reason::SOLUTION, $problem);
|
||||
|
||||
$waiting_teams = [];
|
||||
$waiting_emails = [];
|
||||
|
||||
switch (Phase::getCurrentPhase()) {
|
||||
case Phase::PHASE1:
|
||||
$req = $DB->query("SELECT DISTINCT `teams`.`id` FROM `teams` WHERE `validation_status` = '" . ValidationStatus::getName(ValidationStatus::VALIDATED) . "'"
|
||||
$req = $DB->query("SELECT DISTINCT `teams`.`id`, `teams`.`problem`, `teams`.`trigram` FROM `teams` WHERE `validation_status` = '" . ValidationStatus::getName(ValidationStatus::VALIDATED) . "'"
|
||||
. " AND `id` NOT IN (SELECT DISTINCT `team` FROM `videos` WHERE `reason` = 'SOLUTION' AND `validation` = " . Video::ACCEPTED . ")"
|
||||
. " AND `year` = $YEAR;");
|
||||
. " AND `year` = $YEAR ORDER BY `problem`, `trigram`;");
|
||||
break;
|
||||
case Phase::PHASE2:
|
||||
$req = $DB->query("SELECT DISTINCT `teams`.`id` FROM `teams`"
|
||||
$req = $DB->query("SELECT DISTINCT `teams`.`id`, `teams`.`problem`, `teams`.`trigram` FROM `teams`"
|
||||
. " WHERE `id` NOT IN (SELECT `q1`.`from` FROM `questions` AS `q1`"
|
||||
. " JOIN `questions` AS `q2` ON `q2`.`from` = `q1`.`from` AND `q2`.`number` = 2"
|
||||
. " JOIN `questions` AS `q3` ON `q3`.`from` = `q1`.`from` AND `q3`.`number` = 3"
|
||||
@ -77,10 +78,10 @@ switch (Phase::getCurrentPhase()) {
|
||||
. " OR `q5`.`question` IS NOT NULL"
|
||||
. " OR `q6`.`question` IS NOT NULL))"
|
||||
. " AND `validation_status` = '" . ValidationStatus::getName(ValidationStatus::VALIDATED) . "'"
|
||||
. " AND `year` = $YEAR;");
|
||||
. " AND `year` = $YEAR ORDER BY `problem`, `trigram`;");
|
||||
break;
|
||||
case Phase::PHASE3:
|
||||
$req = $DB->query("SELECT DISTINCT `teams`.`id` FROM `teams`"
|
||||
$req = $DB->query("SELECT DISTINCT `teams`.`id`, `teams`.`problem`, `teams`.`trigram` FROM `teams`"
|
||||
. " WHERE `id` NOT IN (SELECT `q1`.`to` FROM `questions` AS `q1`"
|
||||
. " JOIN `questions` AS `q2` ON `q2`.`to` = `q1`.`to` AND `q2`.`number` = 2"
|
||||
. " JOIN `questions` AS `q3` ON `q3`.`to` = `q1`.`to` AND `q3`.`number` = 3"
|
||||
@ -95,19 +96,23 @@ switch (Phase::getCurrentPhase()) {
|
||||
. " OR `q5`.`answer` IS NOT NULL"
|
||||
. " OR `q6`.`answer` IS NOT NULL))"
|
||||
. " AND `validation_status` = '" . ValidationStatus::getName(ValidationStatus::VALIDATED) . "'"
|
||||
. " AND `year` = $YEAR;");
|
||||
. " AND `year` = $YEAR ORDER BY `problem`, `trigram`;");
|
||||
break;
|
||||
case Phase::PHASE4:
|
||||
$req = $DB->query("SELECT DISTINCT `teams`.`id` FROM `teams` WHERE `validation_status` = '" . ValidationStatus::getName(ValidationStatus::VALIDATED) . "'"
|
||||
$req = $DB->query("SELECT DISTINCT `teams`.`id`, `teams`.`problem`, `teams`.`trigram` FROM `teams` WHERE `validation_status` = '" . ValidationStatus::getName(ValidationStatus::VALIDATED) . "'"
|
||||
. " AND (`id` NOT IN (SELECT DISTINCT `team` FROM `videos` WHERE `reason` = 'ANSWER1' AND `validation` = " . Video::ACCEPTED . ")"
|
||||
. " OR `id` NOT IN (SELECT DISTINCT `team` FROM `videos` WHERE `reason` = 'ANSWER2' AND `validation` = " . Video::ACCEPTED . "))"
|
||||
. " AND `year` = $YEAR;");
|
||||
. " AND `year` = $YEAR ORDER BY `problem`, `trigram`;");
|
||||
break;
|
||||
}
|
||||
|
||||
if (isset($req)) {
|
||||
while (($data = $req->fetch()) !== false)
|
||||
$waiting_teams[] = Team::fromId($data["id"]);
|
||||
$waiting_emails = [];
|
||||
while (($data = $req->fetch()) !== false) {
|
||||
$team = Team::fromId($data["id"]);
|
||||
$waiting_teams[] = $team;
|
||||
$waiting_emails = array_merge($waiting_emails, $team->getAllEmails());
|
||||
}
|
||||
}
|
||||
|
||||
require_once "server_files/views/suivi_correspondances.php";
|
@ -53,6 +53,10 @@
|
||||
<strong>Autorise Animath à diffuser les vidéos :</strong> <?= $team->allowPublish() ? "oui" : "non" ?>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<a href="mailto:contact@correspondances-maths.fr?<? foreach ($team->getAllEmails() as $email) echo "bcc=" . $email . "&" ?>subject=Correspondances de Jeunes Mathématicien·ne·s" target="_blank">Envoyer un mail à toute l'équipe</a>
|
||||
</div>
|
||||
|
||||
<? if ($team->getValidationStatus() == ValidationStatus::VALIDATED) { ?>
|
||||
<hr/>
|
||||
<!--suppress HtmlUnknownTarget -->
|
||||
|
@ -10,6 +10,11 @@
|
||||
|
||||
<h2>Équipes inscrites <?= $problem > 0 ? "pour ce problème" : "sans problème choisi" ?> :</h2>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<a href="mailto:contact@correspondances-maths.fr?<? foreach ($validated_emails as $email) echo "bcc=" . $email . "&" ?>subject=Correspondances de Jeunes Mathématicien·ne·s" target="_blank">Envoyer un mail à toutes les équipes validées</a><br />
|
||||
<a href="mailto:contact@correspondances-maths.fr?<? foreach ($not_validated_emails as $email) echo "bcc=" . $email . "&" ?>subject=Correspondances de Jeunes Mathématicien·ne·s" target="_blank">Envoyer un mail à toutes les équipes non validées</a>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -20,6 +20,7 @@ if (sizeof($waiting_teams) > 0) { ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<a href="mailto:contact@correspondances-maths.fr?<? foreach ($waiting_emails as $email) echo "bcc=" . $email . "&" ?>subject=Correspondances de Jeunes Mathématicien·ne·s" target="_blank">Leur envoyer un mail</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user