mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 03:42:11 +01:00 
			
		
		
		
	Fix broken send mail link
This commit is contained in:
		@@ -122,24 +122,34 @@ class UpdateTournament
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ($_SESSION["role"] == Role::ENCADRANT || $_SESSION["role"] == Role::ADMIN) {
 | 
			
		||||
if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN) {
 | 
			
		||||
	$emails = [];
 | 
			
		||||
	foreach ($tournament->getOrganizers() as $organizer)
 | 
			
		||||
		$emails[] = $organizer->getEmail();
 | 
			
		||||
	$emails_validated = [];
 | 
			
		||||
	foreach ($tournament->getOrganizers() as $organizer) {
 | 
			
		||||
        $emails[] = $organizer->getEmail();
 | 
			
		||||
        $emails_validated[] = $organizer->getEmail();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	foreach ($teams as $team) {
 | 
			
		||||
		foreach ($team->getEncadrants() as $encadrant_id) {
 | 
			
		||||
			$encadrant = User::fromId($encadrant_id);
 | 
			
		||||
			if ($encadrant != null)
 | 
			
		||||
				$emails[] = $encadrant->getEmail();
 | 
			
		||||
			if ($encadrant != null) {
 | 
			
		||||
                $emails[] = $encadrant->getEmail();
 | 
			
		||||
                if ($team->getValidationStatus() == ValidationStatus::VALIDATED)
 | 
			
		||||
                    $emails_validated[] = $encadrant->getEmail();
 | 
			
		||||
            }
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		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();
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,29 +3,39 @@
 | 
			
		||||
$tournaments = Tournament::getAllTournaments();
 | 
			
		||||
 | 
			
		||||
$emails = [];
 | 
			
		||||
$emails_validated = [];
 | 
			
		||||
 | 
			
		||||
if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN) {
 | 
			
		||||
	foreach ($tournaments as $tournament) {
 | 
			
		||||
		foreach ($tournament->getOrganizers() as $organizer)
 | 
			
		||||
			$emails[] = $organizer->getEmail();
 | 
			
		||||
        foreach ($tournament->getOrganizers() as $organizer) {
 | 
			
		||||
            $emails[] = $organizer->getEmail();
 | 
			
		||||
            $emails_validated[] = $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 ($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();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
			foreach ($team->getParticipants() as $participant_id) {
 | 
			
		||||
				$participant = User::fromId($participant_id);
 | 
			
		||||
				if ($participant != null) {
 | 
			
		||||
					$emails[] = $participant->getEmail();
 | 
			
		||||
					if ($participant->getResponsibleEmail() != null) {
 | 
			
		||||
						$emails[] = $participant->getResponsibleEmail();
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
            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();
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -60,7 +60,8 @@ if ($tournament->isFinal())
 | 
			
		||||
 | 
			
		||||
<?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>
 | 
			
		||||
        <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><br>
 | 
			
		||||
        <a href="mailto:contact@tfjm.org?<? foreach ($emails_validated as $email) echo "bcc=" . $email . "&" ?>subject=TFJM² <?= $YEAR ?>" target="_blank">Envoyer un mail à toutes les personnes inscrites au tournoi dans une équipe validée</a>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <a href="/tournoi/<?= $tournament->getName() ?>/modifier"><button class="btn btn-secondary btn-lg btn-block">Éditer le tournoi</button></a>
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,8 @@
 | 
			
		||||
 | 
			
		||||
<?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>
 | 
			
		||||
    <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><br>
 | 
			
		||||
    <a href="mailto:contact@tfjm.org?<? foreach ($emails_validated as $email) echo "bcc=" . $email . "&" ?>subject=TFJM² <?= $YEAR ?>" target="_blank">Envoyer un mail à toutes les personnes inscrites au tournoi dans une équipe validée</a>
 | 
			
		||||
</div>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user