mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 00:52:03 +01:00 
			
		
		
		
	Améliorations du code
This commit is contained in:
		@@ -1,10 +1,10 @@
 | 
			
		||||
<?php require_once "header.php" ?>
 | 
			
		||||
 | 
			
		||||
<h2>Informations sur l'équipe</h2>
 | 
			
		||||
    <h2>Informations sur l'équipe</h2>
 | 
			
		||||
 | 
			
		||||
Nom de l'équipe : <?= $team->getName() ?><br />
 | 
			
		||||
Trigramme : <?= $team->getTrigram() ?><br />
 | 
			
		||||
Tournoi : <a href="<?= $URL_BASE . "/tournoi/" . $tournament->getName() ?>"><?= $tournament->getName() ?></a><br />
 | 
			
		||||
    Nom de l'équipe : <?= $team->getName() ?><br/>
 | 
			
		||||
    Trigramme : <?= $team->getTrigram() ?><br/>
 | 
			
		||||
    Tournoi : <a href="<?= $URL_BASE . "/tournoi/" . $tournament->getName() ?>"><?= $tournament->getName() ?></a><br/>
 | 
			
		||||
<?php
 | 
			
		||||
for ($i = 1; $i <= 2; ++$i) {
 | 
			
		||||
	if ($team->getEncadrants()[$i] == NULL)
 | 
			
		||||
@@ -26,72 +26,37 @@ if ($team->isSelectedForFinal()) {
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
<hr />
 | 
			
		||||
    <hr/>
 | 
			
		||||
 | 
			
		||||
<h2>Autorisations</h2>
 | 
			
		||||
    <h2>Autorisations</h2>
 | 
			
		||||
 | 
			
		||||
<?php
 | 
			
		||||
while (($data = $documents_req->fetch()) !== false) {
 | 
			
		||||
	$file_id = $data["file_id"];
 | 
			
		||||
	$type = $data["type"];
 | 
			
		||||
	$user_id = $data["user"];
 | 
			
		||||
	$user_data = $DB->query("SELECT `surname`, `first_name` FROM `users` WHERE `id` = '$user_id';")->fetch();
 | 
			
		||||
	$surname = $user_data["surname"];
 | 
			
		||||
	$first_name = $user_data["first_name"];
 | 
			
		||||
	$version = $data["version"];
 | 
			
		||||
	switch ($data["type"]) {
 | 
			
		||||
		case "PARENTAL_CONSENT":
 | 
			
		||||
			$name = "Autorisation parentale";
 | 
			
		||||
			break;
 | 
			
		||||
		case "PHOTO_CONSENT":
 | 
			
		||||
			$name = "Autorisation de droit à l'image";
 | 
			
		||||
			break;
 | 
			
		||||
		case "SANITARY_PLUG":
 | 
			
		||||
			$name = "Fiche sanitaire";
 | 
			
		||||
			break;
 | 
			
		||||
	}
 | 
			
		||||
	echo "$name de $first_name $surname : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
<?php printDocuments($documents) ?>
 | 
			
		||||
 | 
			
		||||
    <form method="POST">
 | 
			
		||||
        <input style="width: 100%;" type="submit" name="download_zip" value="Télécharger l'archive"/>
 | 
			
		||||
    </form>
 | 
			
		||||
 | 
			
		||||
<?php if ($team->isSelectedForFinal()) { ?>
 | 
			
		||||
	<hr />
 | 
			
		||||
	<h2>Autorisations pour la finale</h2>
 | 
			
		||||
	<?php
 | 
			
		||||
	while (($data = $documents_req->fetch()) !== false) {
 | 
			
		||||
		$file_id = $data["file_id"];
 | 
			
		||||
		$type = $data["type"];
 | 
			
		||||
		$user_id = $data["user"];
 | 
			
		||||
		$user_data = $DB->query("SELECT `surname`, `first_name` FROM `users` WHERE `id` = '$user_id';")->fetch();
 | 
			
		||||
		$surname = $user_data["surname"];
 | 
			
		||||
		$first_name = $user_data["first_name"];
 | 
			
		||||
		$version = $data["version"];
 | 
			
		||||
		switch ($data["type"]) {
 | 
			
		||||
			case "PARENTAL_CONSENT":
 | 
			
		||||
				$name = "Autorisation parentale";
 | 
			
		||||
				break;
 | 
			
		||||
			case "PHOTO_CONSENT":
 | 
			
		||||
				$name = "Autorisation de droit à l'image";
 | 
			
		||||
				break;
 | 
			
		||||
			case "SANITARY_PLUG":
 | 
			
		||||
				$name = "Fiche sanitaire";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		echo "$name de $first_name $surname : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
    <hr/>
 | 
			
		||||
    <h2>Autorisations pour la finale</h2>
 | 
			
		||||
	<?php printDocuments($documents_final) ?>
 | 
			
		||||
    <form method="POST">
 | 
			
		||||
        <input style="width: 100%;" type="submit" name="download_zip_final" value="Télécharger l'archive"/>
 | 
			
		||||
    </form>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
 | 
			
		||||
if ($team->getValidationStatus() == ValidationStatus::WAITING && $_SESSION["role"] == Role::ADMIN) { ?>
 | 
			
		||||
	<form method="POST">
 | 
			
		||||
		<input style="width: 100%;" type="submit" name="validate" value="Valider l'équipe" />
 | 
			
		||||
	</form>
 | 
			
		||||
<?php if ($team->getValidationStatus() == ValidationStatus::WAITING && $_SESSION["role"] == Role::ADMIN) { ?>
 | 
			
		||||
    <form method="POST">
 | 
			
		||||
        <input style="width: 100%;" type="submit" name="validate" value="Valider l'équipe"/>
 | 
			
		||||
    </form>
 | 
			
		||||
	<?php
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (!$team->isSelectedForFinal() && isset($_SESSION["user_id"]) && $_SESSION["role"] == Role::ADMIN) { ?>
 | 
			
		||||
	<form method="POST">
 | 
			
		||||
		<input style="width: 100%;" type="submit" name="select" value="Sélectionner pour la finale nationale" />
 | 
			
		||||
	</form>
 | 
			
		||||
if (!$team->isSelectedForFinal() && $_SESSION["role"] == Role::ADMIN) { ?>
 | 
			
		||||
    <hr/>
 | 
			
		||||
    <form method="POST">
 | 
			
		||||
        <input style="width: 100%;" type="submit" name="select" value="Sélectionner pour la finale nationale"/>
 | 
			
		||||
    </form>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
 | 
			
		||||
<?php require_once "footer.php" ?>
 | 
			
		||||
@@ -13,21 +13,7 @@ Numéro de téléphone : <?= $user->getPhoneNumber() ?><br />
 | 
			
		||||
 | 
			
		||||
<?php if ($user->getRole() == Role::PARTICIPANT) { ?>
 | 
			
		||||
	Lycée : <?= $user->getSchool() ?><br />
 | 
			
		||||
	Classe : <?php switch ($user->getClass()) {
 | 
			
		||||
		case "TERMINALE":
 | 
			
		||||
			echo "Terminale";
 | 
			
		||||
			break;
 | 
			
		||||
		case "PREMIERE":
 | 
			
		||||
			echo "Première";
 | 
			
		||||
			break;
 | 
			
		||||
		case "SECONDE":
 | 
			
		||||
			echo "Seconde ou avant";
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			echo "A hacké le site";
 | 
			
		||||
			break;
 | 
			
		||||
	}
 | 
			
		||||
	?><br />
 | 
			
		||||
	Classe : <?php SchoolClass::getTranslatedName($user->getClass())	?><br />
 | 
			
		||||
	Nom du responsable légal : <?= $user->getResponsibleName() ?><br />
 | 
			
		||||
	Numéro de téléphone du responsable légal : <?= $user->getResponsiblePhone() ?><br />
 | 
			
		||||
	Adresse e-mail du responsable légal : <a href="mailto:<?= $user->getResponsibleEmail() ?>"><?= $user->getResponsibleEmail() ?></a>
 | 
			
		||||
@@ -38,34 +24,21 @@ Numéro de téléphone : <?= $user->getPhoneNumber() ?><br />
 | 
			
		||||
echo "<hr />";
 | 
			
		||||
 | 
			
		||||
if ($user->getRole() == Role::ADMIN || $user->getRole() == Role::ORGANIZER) {
 | 
			
		||||
	while (($tournament_data = $tournaments_req->fetch()) !== false) {
 | 
			
		||||
		echo "Organise le tournoi <a href=\"$URL_BASE/tournoi/" . $tournament_data["name"] . "\">" . $tournament_data["name"] . "</a><br />";
 | 
			
		||||
	foreach ($tournaments as $tournament) {
 | 
			
		||||
		echo "Organise le tournoi <a href=\"$URL_BASE/tournoi/" . $tournament->getName(). "\">" . $tournament->getName() . "</a><br />";
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
elseif ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
 | 
			
		||||
	<h2>Autorisations</h2>
 | 
			
		||||
	<?php
 | 
			
		||||
	while (($data = $documents_req->fetch()) !== false) {
 | 
			
		||||
		$file_id = $data["file_id"];
 | 
			
		||||
		$type = $data["type"];
 | 
			
		||||
		$user_id = $data["user"];
 | 
			
		||||
		$user_data = $DB->query("SELECT `surname`, `first_name` FROM `users` WHERE `id` = '$user_id';")->fetch();
 | 
			
		||||
		$surname = $user_data["surname"];
 | 
			
		||||
		$first_name = $user_data["first_name"];
 | 
			
		||||
		$version = $data["version"];
 | 
			
		||||
		switch ($data["type"]) {
 | 
			
		||||
			case "PARENTAL_CONSENT":
 | 
			
		||||
				$name = "Autorisation parentale";
 | 
			
		||||
				break;
 | 
			
		||||
			case "PHOTO_CONSENT":
 | 
			
		||||
				$name = "Autorisation de droit à l'image";
 | 
			
		||||
				break;
 | 
			
		||||
			case "SANITARY_PLUG":
 | 
			
		||||
				$name = "Fiche sanitaire";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		echo "$name de $first_name $surname : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
 | 
			
		||||
	}
 | 
			
		||||
    <?php
 | 
			
		||||
    printDocuments($documents);
 | 
			
		||||
 | 
			
		||||
    if ($team->isSelectedForFinal()) { ?>
 | 
			
		||||
        <hr />
 | 
			
		||||
        <h2>Autorisations pour la finale</h2>
 | 
			
		||||
        <?php
 | 
			
		||||
        printDocuments($documents_final);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
require_once "footer.php";
 | 
			
		||||
@@ -10,11 +10,11 @@ if (isset($error_message)) {
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
<h2>Informations sur l'équipe</h2>
 | 
			
		||||
    <h2>Informations sur l'équipe</h2>
 | 
			
		||||
 | 
			
		||||
Nom de l'équipe : <?= $team->getName() ?><br/>
 | 
			
		||||
Trigramme : <?= $team->getTrigram() ?><br/>
 | 
			
		||||
Tournoi : <a href="<?= $tournament->getName() ?>"><?= $tournament->getName() ?></a><br/>
 | 
			
		||||
    Nom de l'équipe : <?= $team->getName() ?><br/>
 | 
			
		||||
    Trigramme : <?= $team->getTrigram() ?><br/>
 | 
			
		||||
    Tournoi : <a href="<?= $tournament->getName() ?>"><?= $tournament->getName() ?></a><br/>
 | 
			
		||||
<?php
 | 
			
		||||
for ($i = 1; $i <= 2; ++$i) {
 | 
			
		||||
	if ($team->getEncadrants()[$i] == NULL)
 | 
			
		||||
@@ -31,7 +31,7 @@ for ($i = 1; $i <= 6; ++$i) {
 | 
			
		||||
	echo "Participant $i : <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
 | 
			
		||||
    Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
 | 
			
		||||
<?php if ($team->isSelectedForFinal()) {
 | 
			
		||||
	$final_name = $FINAL->getName();
 | 
			
		||||
	echo "<strong>Équipe sélectionnée pour la <a href=\"$URL_BASE/tournoi/$final_name\">finale nationale</a>.</strong><br />";
 | 
			
		||||
@@ -39,133 +39,125 @@ Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
 | 
			
		||||
 | 
			
		||||
<?php if (isset($_GET["modifier"])) { ?>
 | 
			
		||||
 | 
			
		||||
	<form method="POST">
 | 
			
		||||
		<input type="hidden" name="team_edit" value="true"/>
 | 
			
		||||
		<table style="width: 100%;">
 | 
			
		||||
			<tbody>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td style="width: 30%;">
 | 
			
		||||
					<label for="name">Nom :</label>
 | 
			
		||||
				</td>
 | 
			
		||||
				<td style="width: 70%;">
 | 
			
		||||
					<input style="width: 100%;" type="text" id="name" name="name" value="<?= $team->getName() ?>"/>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td>
 | 
			
		||||
					<label for="trigram">Trigramme :</label>
 | 
			
		||||
				</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<input style="width: 100%;" type="text" id="trigram" name="trigram"
 | 
			
		||||
						   value="<?= $team->getTrigram() ?>"/>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td>
 | 
			
		||||
					<label for="tournament">Tournoi :</label>
 | 
			
		||||
				</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<select style="width: 100%;" id="tournament" name="tournament">
 | 
			
		||||
    <form method="POST">
 | 
			
		||||
        <input type="hidden" name="team_edit" value="true"/>
 | 
			
		||||
        <table style="width: 100%;">
 | 
			
		||||
            <tbody>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td style="width: 30%;">
 | 
			
		||||
                    <label for="name">Nom :</label>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td style="width: 70%;">
 | 
			
		||||
                    <input style="width: 100%;" type="text" id="name" name="name" value="<?= $team->getName() ?>"/>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <label for="trigram">Trigramme :</label>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input style="width: 100%;" type="text" id="trigram" name="trigram"
 | 
			
		||||
                           value="<?= $team->getTrigram() ?>"/>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <label for="tournament">Tournoi :</label>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <select style="width: 100%;" id="tournament" name="tournament">
 | 
			
		||||
						<?php
 | 
			
		||||
						while (($data = $tournaments_response->fetch()) !== FALSE) {
 | 
			
		||||
							echo "<option value=\"" . $data["id"] . "\">" . $data["name"] . "</option>\n";
 | 
			
		||||
						}
 | 
			
		||||
						foreach ($tournaments as $tournament)
 | 
			
		||||
							echo "<option value=\"" . $tournament->getId() . "\">" . $tournament->getName() . "</option>\n";
 | 
			
		||||
						?>
 | 
			
		||||
					</select>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td colspan="2">
 | 
			
		||||
					<input style="width: 100%;" type="submit" value="Modifier l'équipe"/>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			</tbody>
 | 
			
		||||
		</table>
 | 
			
		||||
	</form>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td colspan="2">
 | 
			
		||||
                    <input style="width: 100%;" type="submit" value="Modifier l'équipe"/>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            </tbody>
 | 
			
		||||
        </table>
 | 
			
		||||
    </form>
 | 
			
		||||
 | 
			
		||||
<?php } else { ?>
 | 
			
		||||
 | 
			
		||||
	<?php if ($_SESSION["team_validation_status"] == ValidationStatus::NOT_READY) { ?>
 | 
			
		||||
		<!--suppress HtmlUnknownTarget -->
 | 
			
		||||
		<a href="<?= $URL_BASE ?>/mon_equipe/modifier">Modifier mon équipe</a>
 | 
			
		||||
        <!--suppress HtmlUnknownTarget -->
 | 
			
		||||
        <a href="<?= $URL_BASE ?>/mon_equipe/modifier">Modifier mon équipe</a>
 | 
			
		||||
	<?php } ?>
 | 
			
		||||
	<hr/>
 | 
			
		||||
	<h2>Mes autorisations</h2>
 | 
			
		||||
    <hr/>
 | 
			
		||||
    <h2>Mes autorisations</h2>
 | 
			
		||||
	<?php
 | 
			
		||||
	while (($data = $documents_req->fetch()) !== false) {
 | 
			
		||||
		$file_id = $data["file_id"];
 | 
			
		||||
		$type = $data["type"];
 | 
			
		||||
		$version = $data["version"];
 | 
			
		||||
		switch ($data["type"]) {
 | 
			
		||||
			case "PARENTAL_CONSENT":
 | 
			
		||||
				$name = "Autorisation parentale";
 | 
			
		||||
				break;
 | 
			
		||||
			case "PHOTO_CONSENT":
 | 
			
		||||
				$name = "Autorisation de droit à l'image";
 | 
			
		||||
				break;
 | 
			
		||||
			case "SANITARY_PLUG":
 | 
			
		||||
				$name = "Fiche sanitaire";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		echo "$name : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
 | 
			
		||||
	printDocuments($documents);
 | 
			
		||||
 | 
			
		||||
	if ($team->isSelectedForFinal()) { ?>
 | 
			
		||||
        <hr/>
 | 
			
		||||
        <h2>Mes autorisations pour la finale</h2>
 | 
			
		||||
		<?php
 | 
			
		||||
        printDocuments($documents_final);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
 | 
			
		||||
		<form method="post" enctype="multipart/form-data">
 | 
			
		||||
			<input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
 | 
			
		||||
			<table style="width: 100%;">
 | 
			
		||||
				<tbody>
 | 
			
		||||
				<tr>
 | 
			
		||||
					<td>
 | 
			
		||||
						<label for="type">Type de document :</label>
 | 
			
		||||
					</td>
 | 
			
		||||
					<td>
 | 
			
		||||
						<select style="width: 100%;" id="type" name="type">
 | 
			
		||||
        <hr />
 | 
			
		||||
        <form method="post" enctype="multipart/form-data">
 | 
			
		||||
            <input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
 | 
			
		||||
            <table style="width: 100%;">
 | 
			
		||||
                <tbody>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <label for="type">Type de document :</label>
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <select style="width: 100%;" 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>
 | 
			
		||||
						</select>
 | 
			
		||||
					</td>
 | 
			
		||||
				</tr>
 | 
			
		||||
				<tr>
 | 
			
		||||
					<td>
 | 
			
		||||
						<label for="file">Fichier :</label>
 | 
			
		||||
					</td>
 | 
			
		||||
					<td>
 | 
			
		||||
						<input style="width: 100%;" type="file" id="file" name="document"/>
 | 
			
		||||
					</td>
 | 
			
		||||
				</tr>
 | 
			
		||||
				<tr>
 | 
			
		||||
					<td colspan="2">
 | 
			
		||||
						<input style="width: 100%;" type="submit" name="send_document" value="Envoyer le document"/>
 | 
			
		||||
					</td>
 | 
			
		||||
				</tr>
 | 
			
		||||
				</tbody>
 | 
			
		||||
			</table>
 | 
			
		||||
		</form>
 | 
			
		||||
                            <option value="photo_consent">Autorisation de droit à l'image</option>
 | 
			
		||||
                            <option value="sanitary_plug">Fiche sanitaire</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <label for="file">Fichier :</label>
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <input style="width: 100%;" type="file" id="file" name="document"/>
 | 
			
		||||
                    </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td colspan="2">
 | 
			
		||||
                        <input style="width: 100%;" type="submit" name="send_document" value="Envoyer le document"/>
 | 
			
		||||
                    </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
                </tbody>
 | 
			
		||||
            </table>
 | 
			
		||||
        </form>
 | 
			
		||||
	<?php } ?>
 | 
			
		||||
	<hr/>
 | 
			
		||||
	<?php if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
 | 
			
		||||
		<table style="width: 100%;">
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td style="width: 50%;">
 | 
			
		||||
					<form method="post">
 | 
			
		||||
						<input style="width: 100%;" type="submit" name="leave_team" value="Quitter l'équipe"/>
 | 
			
		||||
					</form>
 | 
			
		||||
				</td>
 | 
			
		||||
        <hr/>
 | 
			
		||||
        <table style="width: 100%;">
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td style="width: 50%;">
 | 
			
		||||
                    <form method="post">
 | 
			
		||||
                        <input style="width: 100%;" type="submit" name="leave_team" value="Quitter l'équipe"/>
 | 
			
		||||
                    </form>
 | 
			
		||||
                </td>
 | 
			
		||||
				<?php
 | 
			
		||||
				$can_validate = checkCanValidate();
 | 
			
		||||
				if ($can_validate) { ?>
 | 
			
		||||
					<td style="width: 50%;">
 | 
			
		||||
						<form method="post">
 | 
			
		||||
							<input style="width: 100%;" type="submit" name="request_validation"
 | 
			
		||||
								   value="Demander la validation"/>
 | 
			
		||||
						</form>
 | 
			
		||||
					</td>
 | 
			
		||||
                    <td style="width: 50%;">
 | 
			
		||||
                        <form method="post">
 | 
			
		||||
                            <input style="width: 100%;" type="submit" name="request_validation"
 | 
			
		||||
                                   value="Demander la validation"/>
 | 
			
		||||
                        </form>
 | 
			
		||||
                    </td>
 | 
			
		||||
				<?php } ?>
 | 
			
		||||
			</tr>
 | 
			
		||||
		</table>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </table>
 | 
			
		||||
	<?php } ?>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,56 +7,70 @@ if (isset($error_message)) {
 | 
			
		||||
	} else {
 | 
			
		||||
		echo "<h2>Le fichier a été correctement envoyé !</h2>";
 | 
			
		||||
	}
 | 
			
		||||
}?>
 | 
			
		||||
} ?>
 | 
			
		||||
 | 
			
		||||
<?php if (date("yyyy-mm-dd") < $tournament->getSolutionsDate()) { ?>
 | 
			
		||||
	<form method="post" enctype="multipart/form-data">
 | 
			
		||||
		<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
 | 
			
		||||
		<table style="width: 100%;">
 | 
			
		||||
			<tbody>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td>
 | 
			
		||||
					<label for="problem">Problème :</label>
 | 
			
		||||
				</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<select style="width: 100%;" id="problem" name="problem">
 | 
			
		||||
    <form method="post" enctype="multipart/form-data">
 | 
			
		||||
        <input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
 | 
			
		||||
        <table style="width: 100%;">
 | 
			
		||||
            <tbody>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <label for="problem">Problème :</label>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <select style="width: 100%;" id="problem" name="problem">
 | 
			
		||||
						<?php
 | 
			
		||||
						for ($i = 1; $i <= 9; ++$i) {
 | 
			
		||||
							echo "<option value=\"$i\">$i</option>\n";
 | 
			
		||||
						}
 | 
			
		||||
						?>
 | 
			
		||||
					</select>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td>
 | 
			
		||||
					<label for="file">Fichier :</label>
 | 
			
		||||
				</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<input type="file" id="file" name="solution" />
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td colspan="2">
 | 
			
		||||
					<input style="width: 100%;" type="submit" name="send_solution" value="Envoyer" />
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			</tbody>
 | 
			
		||||
		</table>
 | 
			
		||||
	</form>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <label for="file">Fichier :</label>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="file" id="file" name="solution"/>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td colspan="2">
 | 
			
		||||
                    <input style="width: 100%;" type="submit" name="send_solution" value="Envoyer"/>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            </tbody>
 | 
			
		||||
        </table>
 | 
			
		||||
    </form>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
 | 
			
		||||
	<hr />
 | 
			
		||||
    <hr/>
 | 
			
		||||
 | 
			
		||||
	<h2>Solutions soumises :</h2>
 | 
			
		||||
    <h2>Solutions soumises :</h2>
 | 
			
		||||
 | 
			
		||||
<?php
 | 
			
		||||
while (($data = $solutions_req->fetch()) !== false) {
 | 
			
		||||
	$file_id = $data["file_id"];
 | 
			
		||||
	$problem = $data["problem"];
 | 
			
		||||
	$version = $data["version"];
 | 
			
		||||
/** @var Solution $sol */
 | 
			
		||||
foreach ($solutions as $sol) {
 | 
			
		||||
	$file_id = $sol->getFileId();
 | 
			
		||||
	$problem = $sol->getProblem();
 | 
			
		||||
	$version = $sol->getVersion();
 | 
			
		||||
	echo "Problème $problem (Version $version) : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ($team->isSelectedForFinal()) { ?>
 | 
			
		||||
    <hr/>
 | 
			
		||||
 | 
			
		||||
    <h2>Solutions soumises pour la finale :</h2>
 | 
			
		||||
	<?php
 | 
			
		||||
	/** @var Solution $sol */
 | 
			
		||||
	foreach ($solutions_final as $sol) {
 | 
			
		||||
		$file_id = $sol->getFileId();
 | 
			
		||||
		$problem = $sol->getProblem();
 | 
			
		||||
		$version = $sol->getVersion();
 | 
			
		||||
		echo "Problème $problem (Version $version) : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
require_once "footer.php";
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								server_files/views/solutions_orga.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								server_files/views/solutions_orga.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
require_once "server_files/views/header.php";
 | 
			
		||||
 | 
			
		||||
foreach ($tournaments as $tournament) {
 | 
			
		||||
	echo "<h1>Tournoi de " . $tournament->getName() . "</h1>\n";
 | 
			
		||||
	$sols = $tournament->getAllSolutions();
 | 
			
		||||
	/** @var Solution $sol */
 | 
			
		||||
	foreach ($sols as $sol) {
 | 
			
		||||
		$file_id = $sol->getFileId();
 | 
			
		||||
		$problem = $sol->getProblem();
 | 
			
		||||
		$version = $sol->getVersion();
 | 
			
		||||
		$team = Team::fromId($sol->getTeamId());
 | 
			
		||||
		$team_name = $team->getName();
 | 
			
		||||
		$team_trigram = $team->getTrigram();
 | 
			
		||||
		echo "Problème n°$problem de l'équipe $team_name ($team_trigram), version $version : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	echo "<form method=\"POST\">\n";
 | 
			
		||||
	echo "<input type=\"hidden\" name=\"tournament\" value=\"" . $tournament->getId() . "\" />\n";
 | 
			
		||||
	echo "<input style=\"width: 100%\" type=\"submit\" name=\"download_zip\" value=\"Télécharger l'archive\" />\n";
 | 
			
		||||
	echo "</form><hr />\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
require_once "server_files/views/footer.php";
 | 
			
		||||
@@ -41,7 +41,7 @@ if (isset($error_message)) {
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td colspan="2">
 | 
			
		||||
					<input style="width: 100%;" type="submit" name="send_synthese" value="Envoyer" />
 | 
			
		||||
					<input style="width: 100%;" type="submit" name="send_synthesis" value="Envoyer" />
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			</tbody>
 | 
			
		||||
@@ -54,11 +54,26 @@ if (isset($error_message)) {
 | 
			
		||||
	<h2>Notes de synthèse soumises :</h2>
 | 
			
		||||
 | 
			
		||||
<?php
 | 
			
		||||
while (($data = $syntheses_req->fetch()) !== false) {
 | 
			
		||||
	$file_id = $data["file_id"];
 | 
			
		||||
	$dest = $data["dest"];
 | 
			
		||||
	$version = $data["version"];
 | 
			
		||||
	echo "Note de synthèse pour " . ($dest == "OPPOSANT" ? "l'opposant" : "le rapporteur") . " (Version $version) : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
 | 
			
		||||
/** @var Synthesis $synthesis */
 | 
			
		||||
foreach ($syntheses as $synthesis) {
 | 
			
		||||
	$file_id = $synthesis->getFileId();
 | 
			
		||||
	$dest = $synthesis->getDest();
 | 
			
		||||
	$version = $synthesis->getVersion();
 | 
			
		||||
	echo "Note de synthèse pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur") . " (version $version) : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ($team->isSelectedForFinal()) { ?>
 | 
			
		||||
    <hr/>
 | 
			
		||||
 | 
			
		||||
    <h2>Notes de synthèse soumises pour la finale :</h2>
 | 
			
		||||
	<?php
 | 
			
		||||
	/** @var Synthesis $sol */
 | 
			
		||||
	foreach ($syntheses_final as $synthesis) {
 | 
			
		||||
		$file_id = $synthesis->getFileId();
 | 
			
		||||
		$dest = $synthesis->getDest();
 | 
			
		||||
		$version = $synthesis->getVersion();
 | 
			
		||||
		echo "Note de synthèse pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur") . " (version $version) : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
require_once "footer.php";
 | 
			
		||||
							
								
								
									
										27
									
								
								server_files/views/syntheses_orga.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								server_files/views/syntheses_orga.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
require_once "server_files/views/header.php";
 | 
			
		||||
 | 
			
		||||
/** @var Tournament $tournament */
 | 
			
		||||
foreach ($tournaments as $tournament) {
 | 
			
		||||
	echo "<h1>Tournoi de " . $tournament->getName() . "</h1>\n";
 | 
			
		||||
	$syntheses = $tournament->getAllSyntheses();
 | 
			
		||||
	/** @var Synthesis $synthesis */
 | 
			
		||||
	foreach ($syntheses as $synthesis) {
 | 
			
		||||
		$file_id = $synthesis->getFileId();
 | 
			
		||||
		$dest = $synthesis->getDest();
 | 
			
		||||
		$version = $synthesis->getVersion();
 | 
			
		||||
		$team = Team::fromId($synthesis->getTeamId());
 | 
			
		||||
		$team_name = $team->getName();
 | 
			
		||||
		$team_trigram = $team->getTrigram();
 | 
			
		||||
		echo "Note de synthèse de l'équipe $team_name ($team_trigram) pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur")
 | 
			
		||||
			. ", version $version : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	echo "<form method=\"POST\">\n";
 | 
			
		||||
	echo "<input type=\"hidden\" name=\"tournament\" value=\"" . $tournament->getId() . "\" />\n";
 | 
			
		||||
	echo "<input style=\"width: 100%\" type=\"submit\" name=\"download_zip\" value=\"Télécharger l'archive\" />\n";
 | 
			
		||||
	echo "</form><hr />\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
require_once "server_files/views/footer.php";
 | 
			
		||||
@@ -31,7 +31,7 @@ if ($tournament->isFinal())
 | 
			
		||||
	echo "<strong>Ce tournoi est la finale nationale du TFJM² 2020.</strong><br />";
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
<?php if (!isset($_GET["modifier"]) && ($_SESSION["role"] == Role::ADMIN || $_SESSION["role"] == Role::ORGANIZER && in_array($_SESSION["user_id"], $orgas_id))) { ?>
 | 
			
		||||
<?php if (!isset($_GET["modifier"]) && ($_SESSION["role"] == Role::ADMIN || $_SESSION["role"] == Role::ORGANIZER && $tournament->organize($_SESSION["user_id"]))) { ?>
 | 
			
		||||
	<a href="<?= $URL_BASE ?>/tournoi/<?= $tournament->getName() ?>/modifier">Éditer le tournoi</a>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
 | 
			
		||||
@@ -60,38 +60,21 @@ if ($tournament->isFinal())
 | 
			
		||||
		</thead>
 | 
			
		||||
		<tbody>
 | 
			
		||||
		<?php
 | 
			
		||||
		/** @noinspection PhpUndefinedVariableInspection */
 | 
			
		||||
		while (($team_data = $teams_response->fetch()) != false) {
 | 
			
		||||
        /** @var Team $team */
 | 
			
		||||
		foreach ($teams as $team) {
 | 
			
		||||
			?>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td style="border: 1px solid black; text-align: center">
 | 
			
		||||
					<?php
 | 
			
		||||
					if (isset($_SESSION["role"]) && ($_SESSION["role"] == Role::ADMIN || ($_SESSION["role"] == Role::ORGANIZER && in_array($_SESSION["user_id"], $orgas_id))))
 | 
			
		||||
						echo "<a href=\"$URL_BASE/equipe/" . $team_data["trigram"] . "\">" . $team_data["name"] . "</a>";
 | 
			
		||||
					if (isset($_SESSION["role"]) && ($_SESSION["role"] == Role::ADMIN || ($_SESSION["role"] == Role::ORGANIZER && $tournament->organize($_SESSION["user_id"]))))
 | 
			
		||||
						echo "<a href=\"$URL_BASE/equipe/" . $team->getTrigram() . "\">" . $team->getName(). "</a>";
 | 
			
		||||
					else
 | 
			
		||||
						echo $team_data["name"];
 | 
			
		||||
					?>
 | 
			
		||||
				</td>
 | 
			
		||||
				<td style="border: 1px solid black; text-align: center"><?= $team_data["trigram"] ?></td>
 | 
			
		||||
				<td style="border: 1px solid black; text-align: center"><?= formatDate($team_data["inscription_date"]) ?></td>
 | 
			
		||||
				<td style="border: 1px solid black; text-align: center">
 | 
			
		||||
					<?php
 | 
			
		||||
					switch (ValidationStatus::fromName($team_data["validation_status"])) {
 | 
			
		||||
						case ValidationStatus::NOT_READY:
 | 
			
		||||
							echo "Inscription non terminée";
 | 
			
		||||
							break;
 | 
			
		||||
						case ValidationStatus::WAITING:
 | 
			
		||||
							echo "En attente de validation";
 | 
			
		||||
							break;
 | 
			
		||||
						case ValidationStatus::VALIDATED:
 | 
			
		||||
							echo "Inscription validée";
 | 
			
		||||
							break;
 | 
			
		||||
						default:
 | 
			
		||||
							echo "Statut inconnu";
 | 
			
		||||
							break;
 | 
			
		||||
					}
 | 
			
		||||
						echo $team->getName();
 | 
			
		||||
					?>
 | 
			
		||||
				</td>
 | 
			
		||||
				<td style="border: 1px solid black; text-align: center"><?= $team->getTrigram() ?></td>
 | 
			
		||||
				<td style="border: 1px solid black; text-align: center"><?= formatDate($team->getInscriptionDate()) ?></td>
 | 
			
		||||
				<td style="border: 1px solid black; text-align: center"><?= ValidationStatus::getTranslatedName($team->getValidationStatus()) ?></td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<?php
 | 
			
		||||
		}
 | 
			
		||||
@@ -140,7 +123,7 @@ else {
 | 
			
		||||
						<select style="width: 100%;" id="organizer" name="organizer[]" multiple size="4" required>
 | 
			
		||||
							<?php
 | 
			
		||||
							while (($orga_data = $orgas_response->fetch()) !== FALSE) {
 | 
			
		||||
								echo "<option value=\"" . $orga_data["id"] . "\" " . (in_array($orga_data["id"], $orgas_id) ? "selected" : "")
 | 
			
		||||
								echo "<option value=\"" . $orga_data["id"] . "\" " . ($tournament->organize($_SESSION["user_id"]) ? "selected" : "")
 | 
			
		||||
									. ">" . $orga_data["first_name"] . " " . $orga_data["surname"] . "</option>\n";
 | 
			
		||||
							}
 | 
			
		||||
							?>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
<table style="border: 1px solid black; width: 100%">
 | 
			
		||||
	<thead style="border: 1px solid black">
 | 
			
		||||
	<tr>
 | 
			
		||||
		<th style="border: 1px solid black; text-align: center">Lieu</th>
 | 
			
		||||
		<th style="border: 1px solid black; text-align: center">Nom</th>
 | 
			
		||||
		<th style="border: 1px solid black; text-align: center">Dates</th>
 | 
			
		||||
		<th style="border: 1px solid black; text-align: center">Inscription avant le</th>
 | 
			
		||||
		<th style="border: 1px solid black; text-align: center">Date de rendu des solutions</th>
 | 
			
		||||
@@ -14,29 +14,22 @@
 | 
			
		||||
	</thead>
 | 
			
		||||
	<tbody style="border: 1px solid black">
 | 
			
		||||
	<?php
 | 
			
		||||
	while (($data = $response->fetch()) !== FALSE) {
 | 
			
		||||
	foreach ($tournaments as $tournament) {
 | 
			
		||||
		?>
 | 
			
		||||
		<tr style="border: 1px solid black">
 | 
			
		||||
			<td style="border: 1px solid black; text-align: center"><a href="<?= $URL_BASE ?>/tournoi/<?= $data["name"] ?>"><?= $data["name"] ?></a></td>
 | 
			
		||||
			<td style="border: 1px solid black; text-align: center">Du <?= formatDate($data["date_start"]) ?> au <?= formatDate($data["date_end"]) ?></td>
 | 
			
		||||
			<td style="border: 1px solid black; text-align: center"><?= formatDate($data["date_inscription"]) ?></td>
 | 
			
		||||
			<td style="border: 1px solid black; text-align: center"><?= formatDate($data["date_solutions"]) ?></td>
 | 
			
		||||
			<td style="border: 1px solid black; text-align: center"><?= $data["size"] ?></td>
 | 
			
		||||
			<td style="border: 1px solid black; text-align: center"><a href="<?= $URL_BASE ?>/tournoi/<?= $tournament->getName() ?>"><?= $tournament->getName() ?></a></td>
 | 
			
		||||
			<td style="border: 1px solid black; text-align: center">Du <?= formatDate($tournament->getStartDate()) ?> au <?= formatDate($tournament->getEndDate()) ?></td>
 | 
			
		||||
			<td style="border: 1px solid black; text-align: center"><?= formatDate($tournament->getSolutionsDate()) ?></td>
 | 
			
		||||
			<td style="border: 1px solid black; text-align: center"><?= formatDate($tournament->getSynthesesDate()) ?></td>
 | 
			
		||||
			<td style="border: 1px solid black; text-align: center"><?= $tournament->getSize() ?></td>
 | 
			
		||||
		</tr>
 | 
			
		||||
		<?php
 | 
			
		||||
	}
 | 
			
		||||
	?>
 | 
			
		||||
	<tr style="border: 1px solid black">
 | 
			
		||||
		<td style="border: 1px solid black; text-align: center"><a href="<?= $URL_BASE ?>/tournoi/<?= $final_data["name"] ?>"><?= $final_data["name"] ?></a></td>
 | 
			
		||||
		<td colspan="2" style="border: 1px solid black; text-align: center">Du <?= formatDate($final_data["date_start"]) ?> au <?= formatDate($final_data["date_end"]) ?></td>
 | 
			
		||||
		<!-- <td style="border: 1px solid black; text-align: center"><?= formatDate($final_data["date_inscription"]) ?></td> -->
 | 
			
		||||
		<td style="border: 1px solid black; text-align: center"><?= formatDate($final_data["date_solutions"]) ?></td>
 | 
			
		||||
		<td style="border: 1px solid black; text-align: center"><?= $final_data["size"] ?></td>
 | 
			
		||||
	</tr>
 | 
			
		||||
	</tbody>
 | 
			
		||||
	<tfoot style="border: 1px solid black">
 | 
			
		||||
	<tr>
 | 
			
		||||
		<th style="border: 1px solid black; text-align: center">Lieu</th>
 | 
			
		||||
		<th style="border: 1px solid black; text-align: center">Nom</th>
 | 
			
		||||
		<th style="border: 1px solid black; text-align: center">Dates</th>
 | 
			
		||||
		<th style="border: 1px solid black; text-align: center">Inscription avant le</th>
 | 
			
		||||
		<th style="border: 1px solid black; text-align: center">Date de rendu des solutions</th>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user