diff --git a/server_files/controllers/equipe.php b/server_files/controllers/equipe.php index fa2c96e..0653f9b 100644 --- a/server_files/controllers/equipe.php +++ b/server_files/controllers/equipe.php @@ -11,7 +11,12 @@ if ($team === null) require_once "server_files/404.php"; if (isset($_POST["validate"])) { - $team->setValidationStatus(ValidationStatus::VALIDATED); + $team->setValidationStatus(ValidationStatus::VALIDATED); + Mailer::sendValidateTeam($team); +} +elseif (isset($_POST["unvalidate"])) { + $team->setValidationStatus(ValidationStatus::NOT_READY); + Mailer::sendUnvalidateTeam($team); } if (isset($_POST["download_zip"])) { diff --git a/server_files/services/mail.php b/server_files/services/mail.php index b244f68..07c854f 100644 --- a/server_files/services/mail.php +++ b/server_files/services/mail.php @@ -133,7 +133,7 @@ class Mailer $content = preg_replace("#{PROBLEM}#", $team->getProblem(), $content); $content = preg_replace("#{ACCESS_CODE}#", $team->getAccessCode(), $content); - self::sendMail($user->getEmail(), "Ajout d'une équipe Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content); + self::sendMail($user->getEmail(), "Ajout d'une équipe – Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content); } public static function sendJoinTeamMail(User $user, Team $team) @@ -147,9 +147,27 @@ class Mailer $content = preg_replace("#{TRIGRAM}#", $team->getTrigram(), $content); $content = preg_replace("#{PROBLEM}#", $team->getProblem(), $content); - self::sendMail($user->getEmail(), "Équipe rejointe Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content); + self::sendMail($user->getEmail(), "Équipe rejointe – Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content); } + public static function sendValidateTeam($team) + { + global $YEAR; + + $content = self::getTemplate("validate_team"); + + self::broadcastToTeam($team, "Équipe validée – Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content); + } + + public static function sendUnvalidateTeam($team) + { + global $YEAR; + + $content = self::getTemplate("unvalidate_team"); + + self::broadcastToTeam($team, "Équipe non validée – Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content); + } + public static function sendNewVideo(NewVideo $video, Team $team) { global $YEAR; @@ -159,7 +177,7 @@ class Mailer $content = preg_replace("#{TRIGRAM}#", $team->getTrigram(), $content); $content = preg_replace("#{PROBLEM}#", $team->getProblem(), $content); $content = preg_replace("#{VIDEO_LINK}#", $video->link, $content); - self::broadcastToAdmins("Nouvelle vidéo Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content); + self::broadcastToAdmins("Nouvelle vidéo – Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content); } public static function sendNewAnswer(NewAnswer $video, Team $team) @@ -174,7 +192,7 @@ class Mailer $content = preg_replace("#{DEST_TRIGRAM}#", $dest->getTrigram(), $content); $content = preg_replace("#{PROBLEM}#", $team->getProblem(), $content); $content = preg_replace("#{VIDEO_LINK}#", $video->link, $content); - self::broadcastToAdmins("Nouvelle vidéo de réponse Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content); + self::broadcastToAdmins("Nouvelle vidéo de réponse – Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content); } public static function validateVideo(Video $video) diff --git a/server_files/services/mail_templates/unvalidate_team.html b/server_files/services/mail_templates/unvalidate_team.html new file mode 100644 index 0000000..fca3bbe --- /dev/null +++ b/server_files/services/mail_templates/unvalidate_team.html @@ -0,0 +1,18 @@ + + +
+ +