mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 12:32:18 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
$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();
 | 
						|
            $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();
 | 
						|
                    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();
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
require_once "server_files/views/tournois.php";
 |