mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 03:42:11 +01:00 
			
		
		
		
	Changement confinement
This commit is contained in:
		@@ -121,8 +121,7 @@ class User
 | 
			
		||||
	{
 | 
			
		||||
		global $DB, $YEAR;
 | 
			
		||||
		$users = [];
 | 
			
		||||
		$req = $DB->query("SELECT * FROM `users` WHERE (`role` = 'PARTICIPANT' OR `role` = 'ENCADRANT') "
 | 
			
		||||
			. "AND `year` = $YEAR ORDER BY `role`, `inscription_date`;");
 | 
			
		||||
		$req = $DB->query("SELECT * FROM `users` WHERE  `year` = $YEAR ORDER BY `role` DESC, `inscription_date`;");
 | 
			
		||||
 | 
			
		||||
		while (($data = $req->fetch()) !== false) {
 | 
			
		||||
			$orphan = new User();
 | 
			
		||||
@@ -455,8 +454,8 @@ class User
 | 
			
		||||
	    $team = Team::fromId($this->team_id);
 | 
			
		||||
	    $tournament = $team->getEffectiveTournament();
 | 
			
		||||
 | 
			
		||||
	    $req = $DB->prepare("SELECT `id` FROM `payments` WHERE `user` = ? AND `tournament` = ?;");
 | 
			
		||||
	    $req->execute([$this->id, $tournament->getId()]);
 | 
			
		||||
	    $req = $DB->prepare("SELECT `id` FROM `payments` WHERE `user` = ?;");
 | 
			
		||||
	    $req->execute([$this->id]);
 | 
			
		||||
 | 
			
		||||
	    if (($data = $req->fetch()) !== false)
 | 
			
		||||
	        return Payment::fromId($data["id"]);
 | 
			
		||||
 
 | 
			
		||||
@@ -68,6 +68,24 @@ if (isset($_POST["download_zip"])) {
 | 
			
		||||
	exit();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (isset($_POST["select_tournament"])) {
 | 
			
		||||
    $new_tournament = Tournament::fromId($_POST["select_tournament"]);
 | 
			
		||||
    ensure($new_tournament != null, "Le tournoi indiqué n'existe pas.");
 | 
			
		||||
    $team->setTournamentId($new_tournament->getId());
 | 
			
		||||
    $DB->prepare("UPDATE `documents` SET `tournament` = ? WHERE `team` = ?;")->execute([$tournament->getId(), $team->getId()]);
 | 
			
		||||
    $DB->prepare("UPDATE `solutions` SET `tournament` = ? WHERE `team` = ?;")->execute([$tournament->getId(), $team->getId()]);
 | 
			
		||||
    $DB->prepare("UPDATE `syntheses` SET `tournament` = ? WHERE `team` = ?;")->execute([$tournament->getId(), $team->getId()]);
 | 
			
		||||
    foreach ($team->getParticipants() as $user) {
 | 
			
		||||
        if ($user != null)
 | 
			
		||||
            $DB->prepare("UPDATE `payments` SET `tournament` = ? WHERE `user` = ?;")->execute([$tournament->getId(), $user]);
 | 
			
		||||
    }
 | 
			
		||||
    foreach ($team->getEncadrants() as $user) {
 | 
			
		||||
        if ($user != null)
 | 
			
		||||
            $DB->prepare("UPDATE `payments` SET `tournament` = ? WHERE `user` = ?;")->execute([$tournament->getId(), $user]);
 | 
			
		||||
    }
 | 
			
		||||
    $tournament = $new_tournament;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class EditTeam
 | 
			
		||||
{
 | 
			
		||||
	public $name;
 | 
			
		||||
 
 | 
			
		||||
@@ -78,12 +78,24 @@ class MyTeam
 | 
			
		||||
 | 
			
		||||
	public function updateTeam()
 | 
			
		||||
	{
 | 
			
		||||
		global $URL_BASE;
 | 
			
		||||
		global $URL_BASE, $DB;
 | 
			
		||||
 | 
			
		||||
		$this->team->setName($this->name);
 | 
			
		||||
		$this->team->setTrigram($this->trigram);
 | 
			
		||||
		$this->team->setTournamentId($this->tournament_id);
 | 
			
		||||
 | 
			
		||||
        $DB->prepare("UPDATE `documents` SET `tournament` = ? WHERE `team` = ?;")->execute([$this->tournament_id, $this->team->getId()]);
 | 
			
		||||
        $DB->prepare("UPDATE `solutions` SET `tournament` = ? WHERE `team` = ?;")->execute([$this->tournament_id, $this->team->getId()]);
 | 
			
		||||
        $DB->prepare("UPDATE `syntheses` SET `tournament` = ? WHERE `team` = ?;")->execute([$this->tournament_id, $this->team->getId()]);
 | 
			
		||||
        foreach ($this->team->getParticipants() as $user) {
 | 
			
		||||
            if ($user != null)
 | 
			
		||||
                $DB->prepare("UPDATE `payments` SET `tournament` = ? WHERE `user` = ?;")->execute([$this->tournament_id, $user]);
 | 
			
		||||
        }
 | 
			
		||||
        foreach ($this->team->getEncadrants() as $user) {
 | 
			
		||||
            if ($user != null)
 | 
			
		||||
                $DB->prepare("UPDATE `payments` SET `tournament` = ? WHERE `user` = ?;")->execute([$this->tournament_id, $user]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		$_SESSION["tournament"] = $this->tournament;
 | 
			
		||||
 | 
			
		||||
		header("Location: $URL_BASE/mon-equipe");
 | 
			
		||||
 
 | 
			
		||||
@@ -6,4 +6,11 @@ if (!isset($_SESSION["user_id"]) || $_SESSION["role"] != Role::ADMIN)
 | 
			
		||||
$orphans = isset($_GET["orphans"]);
 | 
			
		||||
$users = $orphans ? User::getOrphanUsers() : User::getAllUsers();
 | 
			
		||||
 | 
			
		||||
$emails = [];
 | 
			
		||||
 | 
			
		||||
if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN) {
 | 
			
		||||
    foreach ($users as $user)
 | 
			
		||||
        $emails[] = $user->getEmail();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
require_once "server_files/views/profils.php";
 | 
			
		||||
@@ -4,7 +4,7 @@ $tournaments = Tournament::getAllTournaments();
 | 
			
		||||
 | 
			
		||||
$emails = [];
 | 
			
		||||
 | 
			
		||||
if ($_SESSION["role"] == Role::ENCADRANT || $_SESSION["role"] == Role::ADMIN) {
 | 
			
		||||
if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN) {
 | 
			
		||||
	foreach ($tournaments as $tournament) {
 | 
			
		||||
		foreach ($tournament->getOrganizers() as $organizer)
 | 
			
		||||
			$emails[] = $organizer->getEmail();
 | 
			
		||||
 
 | 
			
		||||
@@ -123,7 +123,9 @@ function canValidate(Team $team, Tournament $tournament)
 | 
			
		||||
	$can_validate = $team->getValidationStatus() == ValidationStatus::NOT_READY;
 | 
			
		||||
	$can_validate &= $team->getEncadrants()[0] != NULL;
 | 
			
		||||
	$can_validate &= $team->getParticipants()[3] != NULL;
 | 
			
		||||
	for ($i = 1; $i <= 2; ++$i) {
 | 
			
		||||
 | 
			
		||||
    // Le TFJM² 2020 se déroulant en ligne, les papiers ne sont plus nécessaires
 | 
			
		||||
/*	for ($i = 1; $i <= 2; ++$i) {
 | 
			
		||||
		if ($team->getEncadrants()[$i - 1] === NULL)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
@@ -131,9 +133,11 @@ function canValidate(Team $team, Tournament $tournament)
 | 
			
		||||
		$req->execute([$team->getEncadrants()[$i - 1], $tournament->getId(), "PHOTO_CONSENT"]);
 | 
			
		||||
		$d = $req->fetch();
 | 
			
		||||
		$can_validate &= $d["version"] > 0;
 | 
			
		||||
	}
 | 
			
		||||
	}*/
 | 
			
		||||
 | 
			
		||||
	for ($i = 1; $i <= 6; ++$i) {
 | 
			
		||||
 | 
			
		||||
	// Le TFJM² 2020 se déroulant en ligne, les papiers ne sont plus nécessaires
 | 
			
		||||
/*	for ($i = 1; $i <= 6; ++$i) {
 | 
			
		||||
		if ($team->getParticipants()[$i] === NULL)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
@@ -154,12 +158,13 @@ function canValidate(Team $team, Tournament $tournament)
 | 
			
		||||
			$d = $req->fetch();
 | 
			
		||||
			$can_validate &= $d["version"] > 0;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	} */
 | 
			
		||||
 | 
			
		||||
	$req = $DB->prepare("SELECT COUNT(*) AS `version` FROM `documents` WHERE `team` = ? AND `tournament` = ? AND `type` = ?;");
 | 
			
		||||
    // La lettre de motivation n'est plus nécessaire, mais existe toujours
 | 
			
		||||
/*	$req = $DB->prepare("SELECT COUNT(*) AS `version` FROM `documents` WHERE `team` = ? AND `tournament` = ? AND `type` = ?;");
 | 
			
		||||
	$req->execute([$team->getId(), $tournament->getId(), "MOTIVATION_LETTER"]);
 | 
			
		||||
	$d = $req->fetch();
 | 
			
		||||
	$can_validate &= $d["version"] > 0;
 | 
			
		||||
	$can_validate &= $d["version"] > 0;*/
 | 
			
		||||
 | 
			
		||||
	return $can_validate;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <div class="alert alert-info">
 | 
			
		||||
        <?php if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
 | 
			
		||||
        <?php if ($team->getValidationStatus() != ValidationStatus::VALIDATED) { ?>
 | 
			
		||||
            <label for="tournament">Tournoi :</label>
 | 
			
		||||
            <form method="POST">
 | 
			
		||||
                <select class="custom-select" id="tournament" name="select_tournament" onchange="this.form.submit()">
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@
 | 
			
		||||
<body>
 | 
			
		||||
<div class="container.fluid bg-light">
 | 
			
		||||
    <nav class="navbar navbar-expand-lg navbar-light">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
        <div class="collapse navbar-collapse">
 | 
			
		||||
            <a class="navbar-brand" href="https://tfjm.org/">
 | 
			
		||||
                <img src="/logo.svg" alt="Logo TFJM²" id="navbar-logo">
 | 
			
		||||
            </a>
 | 
			
		||||
@@ -55,9 +55,9 @@
 | 
			
		||||
                                <a class="nav-link" href="/mon-equipe">Mon équipe</a>
 | 
			
		||||
                            </li>
 | 
			
		||||
                            <?php if ($_SESSION["team"]->getValidationStatus() == ValidationStatus::VALIDATED) { ?>
 | 
			
		||||
                                <li class="nav-item active">
 | 
			
		||||
                                <!-- <li class="nav-item active">
 | 
			
		||||
                                    <a class="nav-link" href="/paiement">Paiement</a>
 | 
			
		||||
                                </li>
 | 
			
		||||
                                </li> -->
 | 
			
		||||
                                <li class="nav-item active">
 | 
			
		||||
                                    <a class="nav-link" href="/solutions">Solutions</a>
 | 
			
		||||
                                </li>
 | 
			
		||||
@@ -84,6 +84,9 @@
 | 
			
		||||
                        </li>
 | 
			
		||||
                    <?php } ?>
 | 
			
		||||
                <?php } ?>
 | 
			
		||||
                <li class="nav-item active">
 | 
			
		||||
                    <a class="nav-link" href="https://www.helloasso.com/associations/animath/formulaires/5/widget">Faire un don</a>
 | 
			
		||||
                </li>
 | 
			
		||||
            </ul>
 | 
			
		||||
            <ul class="navbar-nav">
 | 
			
		||||
                <?php if (!isset($_SESSION["user_id"])) { ?>
 | 
			
		||||
@@ -109,9 +112,25 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<div class="container">
 | 
			
		||||
 | 
			
		||||
    <div class="mt-4 mb-4">
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <?php
 | 
			
		||||
 | 
			
		||||
    if ($_SESSION["role"] == Role::PARTICIPANT || $_SESSION["role"] == Role::ENCADRANT) {
 | 
			
		||||
        if ($_SESSION["team"] != null && $_SESSION["team"]->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
 | 
			
		||||
            <div class="alert alert-danger">
 | 
			
		||||
                Votre équipe n'est pas validée. Rendez-vous sur la page <a href="mon-equipe">Mon équipe</a> pour demander à
 | 
			
		||||
                valider votre équipe. Si vous aviez déjà effectué cette procédure par le passé, sachez qu'en raison du
 | 
			
		||||
                changement de format de l'édition 2020 du TFJM<sup>2</sup>, toutes les validations ont été retirées, et
 | 
			
		||||
                vous devez à nouveau demander à valider votre équipe. Plus d'informations sur <a href="/">la page d'accueil</a>.
 | 
			
		||||
            </div>
 | 
			
		||||
        <?php }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ?>
 | 
			
		||||
 | 
			
		||||
    <?php
 | 
			
		||||
    if (isset($has_error) && $has_error) { ?>
 | 
			
		||||
    <div class="alert alert-danger">
 | 
			
		||||
 
 | 
			
		||||
@@ -108,7 +108,7 @@ if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT
 | 
			
		||||
	    Adresse e-mail du responsable légal : <a href="mailto:<?= $user->getResponsibleEmail() ?>"><?= $user->getResponsibleEmail() ?></a>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <?php if ($user->getRole() == Role::PARTICIPANT && $user->getTeamId() > 0) { ?>
 | 
			
		||||
    <?php /*if ($user->getRole() == Role::PARTICIPANT && $user->getTeamId() > 0) { ?>
 | 
			
		||||
        <div class="alert alert-info">
 | 
			
		||||
            <strong>Récapitulatif du paiement :</strong><br /><br />
 | 
			
		||||
 | 
			
		||||
@@ -151,7 +151,11 @@ if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT
 | 
			
		||||
                <?php } ?>
 | 
			
		||||
            <?php } ?>
 | 
			
		||||
        </div>
 | 
			
		||||
    <?php } ?>
 | 
			
		||||
    <?php }*/ ?>
 | 
			
		||||
    <div class="alert alert-warning">
 | 
			
		||||
        En raison du changement de format du TFJM² 2020, le tournoi est devenu gratuit. Il n'y a plus d'informations de
 | 
			
		||||
        paiement à donner.
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
<?php } elseif ($user->getDescription() != "") { ?>
 | 
			
		||||
    <div class="alert alert-info">
 | 
			
		||||
 
 | 
			
		||||
@@ -211,6 +211,11 @@ if (!$has_error && (isset($my_account) || isset($new_password))) {
 | 
			
		||||
            être au format PDF.
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <div class="alert alert-danger">
 | 
			
		||||
            En raison du changement de format du TFJM² 2020, il n'y a plus de document nécessaire à envoyer. Seule la lettre de motivation
 | 
			
		||||
            pourra être considérée, même si son envoi n'est plus obligatoire. Merci de ne pas prêter attention à la partie qui suit.
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <div class="alert alert-info">
 | 
			
		||||
            <strong>Modèle de fiche sanitaire :</strong> <a href="/Fiche sanitaire.pdf">Télécharger</a><br />
 | 
			
		||||
            <?php if ($_SESSION["user"]->getBirthDate() > strval($YEAR - 18) . substr($tournament->getStartDate(), 4)) { ?>
 | 
			
		||||
@@ -234,10 +239,10 @@ if (!$has_error && (isset($my_account) || isset($new_password))) {
 | 
			
		||||
                    <label for="type">Type de document</label>
 | 
			
		||||
                    <select class="custom-select" id="type" name="type">
 | 
			
		||||
                        <?php if ($_SESSION["user"]->getBirthDate() > strval($YEAR - 18) . substr($tournament->getStartDate(), 4)) { ?>
 | 
			
		||||
                            <option value="parental_consent">Autorisation parentale</option>
 | 
			
		||||
                            <!-- <option value="parental_consent">Autorisation parentale</option> -->
 | 
			
		||||
                        <?php } ?>
 | 
			
		||||
                        <option value="photo_consent">Autorisation de droit à l'image</option>
 | 
			
		||||
                        <option value="sanitary_plug">Fiche sanitaire</option>
 | 
			
		||||
                        <!-- <option value="photo_consent">Autorisation de droit à l'image</option> -->
 | 
			
		||||
                        <!-- <option value="sanitary_plug">Fiche sanitaire</option> -->
 | 
			
		||||
                        <option value="motivation_letter">Lettre de motivation (pour toute l'équipe)</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -119,6 +119,12 @@ require_once "header.php";
 | 
			
		||||
                Les encadrants doivent également fournir une autorisation de droit à l'image.
 | 
			
		||||
            </div>
 | 
			
		||||
		<?php } ?>
 | 
			
		||||
        <hr>
 | 
			
		||||
        <div class="alert alert-danger">
 | 
			
		||||
            En raison du changement de format du TFJM² 2020, il n'y a plus de document obligatoire à envoyer. Les autorisations
 | 
			
		||||
            précédemment envoyées ont été détruites. Seules les lettres de motivation ont été conservées, mais leur envoi
 | 
			
		||||
            n'est plus obligatoire.
 | 
			
		||||
        </div>
 | 
			
		||||
	<?php }
 | 
			
		||||
    elseif ($team->getValidationStatus() == ValidationStatus::WAITING) { ?>
 | 
			
		||||
        <div class="alert alert-warning">
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,10 @@ require_once "header.php";
 | 
			
		||||
	Cette page recense tous les utilisateurs inscrits<?= $orphans ? " mais qui n'ont pas rejoint d'équipe" : "" ?>.
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<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</a>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<br />
 | 
			
		||||
 | 
			
		||||
<table class="table table-striped table-bordered table-hover">
 | 
			
		||||
 
 | 
			
		||||
@@ -4,13 +4,13 @@
 | 
			
		||||
	<h1 class="display-4">Tournoi de <?= $tournament->getName() ?></h1>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<div class="alert alert-info">
 | 
			
		||||
<!--<div class="alert alert-info">
 | 
			
		||||
    <strong>Instructions :</strong> <a href="/Instructions.pdf?blank=<?= $tournament->getName() ?>">Télécharger</a><br />
 | 
			
		||||
	<strong>Autorisation de droit à l'image - majeur :</strong> <a href="/Autorisation de droit à l'image.pdf?blank=<?= $tournament->getName() ?>">Télécharger</a><br />
 | 
			
		||||
	<strong>Autorisation de droit à l'image - mineur :</strong> <a href="/Autorisation de droit à l'image.pdf?mineur&blank=<?= $tournament->getName() ?>">Télécharger</a><br />
 | 
			
		||||
	<strong>Autorisation parentale :</strong> <a href="/Autorisation parentale.pdf?blank=<?= $tournament->getName() ?>">Télécharger</a><br />
 | 
			
		||||
	<strong>Fiche sanitaire :</strong> <a href="/Fiche sanitaire.pdf?blank=<?= $tournament->getName() ?>">Télécharger</a>
 | 
			
		||||
</div>
 | 
			
		||||
</div>-->
 | 
			
		||||
 | 
			
		||||
<div class="alert alert-info">
 | 
			
		||||
    <strong>Organisateur<?= sizeof($orgas) >= 2 ? 's' : '' ?> :</strong>
 | 
			
		||||
@@ -35,9 +35,9 @@
 | 
			
		||||
<div class="alert alert-info">
 | 
			
		||||
    <strong>Lieu :</strong> <?= $tournament->getPlace() ?>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="alert alert-info">
 | 
			
		||||
<!--<div class="alert alert-info">
 | 
			
		||||
    <strong>Prix par partipant :</strong> <?= $tournament->getPrice() == 0 ? "Gratuit" : $tournament->getPrice() . " €" ?>
 | 
			
		||||
</div>
 | 
			
		||||
</div>-->
 | 
			
		||||
<div class="alert alert-info">
 | 
			
		||||
    <strong>Dates :</strong> Du <?= formatDate($tournament->getStartDate()) ?> au <?= formatDate($tournament->getEndDate()) ?>
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user