mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 09:42:10 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			223 lines
		
	
	
		
			7.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			223 lines
		
	
	
		
			7.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<h2>Tournoi de <?php echo $data["name"] ?></h2>
 | 
						|
 | 
						|
<strong>Organisateur<?= sizeof($orgas) >= 2 ? 's' : '' ?> :</strong>
 | 
						|
<?php
 | 
						|
$s = "";
 | 
						|
for ($i = 0; $i < sizeof($orgas); ++$i) {
 | 
						|
	if ($_SESSION["role"] == "ORGANIZER" || $_SESSION["role"] == "ADMIN")
 | 
						|
		$s .= "<a href=\"$URL_BASE/informations/$orgas_id[$i]/$orgas[$i]\">$orgas[$i]</a>";
 | 
						|
	else
 | 
						|
		$s .= $orgas[$i];
 | 
						|
	$s .= ", ";
 | 
						|
}
 | 
						|
echo substr($s, 0, -2);
 | 
						|
?>
 | 
						|
<br />
 | 
						|
<strong>Nombre d'équipes maximal :</strong> <?php echo $data["size"] ?><br />
 | 
						|
<strong>Lieu :</strong> <?php echo $data["place"] ?><br />
 | 
						|
<strong>Prix par partipant :</strong> <?php echo $data["price"] == 0 ? "Gratuit" : $data["price"] . " €" ?><br />
 | 
						|
<strong>Dates :</strong> Du <?php echo echoDate($data["date_start"]) ?> au <?php echo echoDate($data["date_end"]) ?><br />
 | 
						|
<strong>Clôture des inscriptions :</strong> <?php echo echoDate($data["date_inscription"], true) ?><br />
 | 
						|
<strong>Date limite d'envoi des solutions :</strong> <?php echo echoDate($data["date_solutions"], true) ?><br />
 | 
						|
<strong>Date limite d'envoi des notes de synthèse :</strong> <?php echo echoDate($data["date_syntheses"], true) ?><br />
 | 
						|
<strong>Description :</strong> <?php echo $data["description"] ?><br />
 | 
						|
<?php
 | 
						|
if ($data["final"])
 | 
						|
	echo "<strong>Ce tournoi est la finale nationale du TFJM² 2020.</strong><br />";
 | 
						|
?>
 | 
						|
 | 
						|
<?php if (!isset($_GET["modifier"]) && ($_SESSION["role"] == "ADMIN" || $_SESSION["role"] == "ORGANIZER" && in_array($_SESSION["user_id"], $orgas_id))) { ?>
 | 
						|
	<a href="<?= $URL_BASE ?>/tournoi/<?= $data["name"] ?>/modifier">Éditer le tournoi</a>
 | 
						|
<?php } ?>
 | 
						|
 | 
						|
 | 
						|
<?php if (!isset($_GET["modifier"])) { ?>
 | 
						|
	<hr/>
 | 
						|
 | 
						|
	<h2>Équipes inscrites à ce tournoi :</h2>
 | 
						|
 | 
						|
	<table style="border: 1px solid black; width: 100%;">
 | 
						|
		<thead>
 | 
						|
		<tr>
 | 
						|
			<th style="border: 1px solid black; text-align: center">
 | 
						|
				Équipe
 | 
						|
			</th>
 | 
						|
			<th style="border: 1px solid black; text-align: center">
 | 
						|
				Trigramme
 | 
						|
			</th>
 | 
						|
			<th style="border: 1px solid black; text-align: center">
 | 
						|
				Date d'inscription
 | 
						|
			</th>
 | 
						|
			<th style="border: 1px solid black; text-align: center">
 | 
						|
				État de validation de l'inscription
 | 
						|
			</th>
 | 
						|
		</tr>
 | 
						|
		</thead>
 | 
						|
		<tbody>
 | 
						|
		<?php
 | 
						|
		while (($team_data = $teams_response->fetch()) != false) {
 | 
						|
			?>
 | 
						|
			<tr>
 | 
						|
				<td style="border: 1px solid black; text-align: center">
 | 
						|
					<?php
 | 
						|
					if (isset($_SESSION["role"]) && ($_SESSION["role"] == "ADMIN" || ($_SESSION["role"] == "ORGANIZER" && in_array($_SESSION["user_id"], $orgas_id))))
 | 
						|
						echo "<a href=\"$URL_BASE/equipe/" . $team_data["trigram"] . "\">" . $team_data["name"] . "</a>";
 | 
						|
					else
 | 
						|
						echo $team_data["name"];
 | 
						|
					?>
 | 
						|
				</td>
 | 
						|
				<td style="border: 1px solid black; text-align: center"><?php echo $team_data["trigram"] ?></td>
 | 
						|
				<td style="border: 1px solid black; text-align: center"><?php echo echoDate($team_data["inscription_date"]) ?></td>
 | 
						|
				<td style="border: 1px solid black; text-align: center">
 | 
						|
					<?php
 | 
						|
					switch ($team_data["validation_status"]) {
 | 
						|
						case "NOT_READY":
 | 
						|
							echo "Inscription non terminée";
 | 
						|
							break;
 | 
						|
						case "WAITING":
 | 
						|
							echo "En attente de validation";
 | 
						|
							break;
 | 
						|
						case "VALIDATED":
 | 
						|
							echo "Inscription validée";
 | 
						|
							break;
 | 
						|
						default:
 | 
						|
							echo "Statut inconnu";
 | 
						|
							break;
 | 
						|
					}
 | 
						|
					?>
 | 
						|
				</td>
 | 
						|
			</tr>
 | 
						|
			<?php
 | 
						|
		}
 | 
						|
		?>
 | 
						|
		</tbody>
 | 
						|
		<tfoot>
 | 
						|
		<tr>
 | 
						|
			<th style="border: 1px solid black; text-align: center">
 | 
						|
				Équipe
 | 
						|
			</th>
 | 
						|
			<th style="border: 1px solid black; text-align: center">
 | 
						|
				Trigramme
 | 
						|
			</th>
 | 
						|
			<th style="border: 1px solid black; text-align: center">
 | 
						|
				Date d'inscription
 | 
						|
			</th>
 | 
						|
			<th style="border: 1px solid black; text-align: center">
 | 
						|
				État de validation de l'inscription
 | 
						|
			</th>
 | 
						|
		</tr>
 | 
						|
		</tfoot>
 | 
						|
	</table>
 | 
						|
 | 
						|
	<?php
 | 
						|
}
 | 
						|
else {
 | 
						|
	?>
 | 
						|
	<form method="POST">
 | 
						|
		<input type="hidden" name="submitted" 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="<?= $data["name"] ?>" required />
 | 
						|
				</td>
 | 
						|
			</tr>
 | 
						|
			<?php if ($_SESSION["role"] == "ADMIN") { ?>
 | 
						|
				<tr>
 | 
						|
					<td>
 | 
						|
						<label for="organizer">Organisateur :</label>
 | 
						|
					</td>
 | 
						|
					<td>
 | 
						|
						<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["first_name"] . " " . $orga_data["surname"], $orgas) ? "selected" : "")
 | 
						|
									. ">" . $orga_data["first_name"] . " " . $orga_data["surname"] . "</option>\n";
 | 
						|
							}
 | 
						|
							?>
 | 
						|
						</select>
 | 
						|
					</td>
 | 
						|
				</tr>
 | 
						|
			<?php } ?>
 | 
						|
			<tr>
 | 
						|
				<td>
 | 
						|
					<label for="size">Nombre d'équipes :</label>
 | 
						|
				</td>
 | 
						|
				<td>
 | 
						|
					<input style="width: 100%;" type="number" id="size" name="size" min="3" max="12" value="<?= $data["size"] ?>" required />
 | 
						|
				</td>
 | 
						|
			</tr>
 | 
						|
			<tr>
 | 
						|
				<td>
 | 
						|
					<label for="place">Lieu :</label>
 | 
						|
				</td>
 | 
						|
				<td>
 | 
						|
					<input style="width: 100%;" type="text" id="place" name="place" value="<?= $data["place"] ?>" required />
 | 
						|
				</td>
 | 
						|
			</tr>
 | 
						|
			<tr>
 | 
						|
				<td>
 | 
						|
					<label for="price">Prix par participant</label>
 | 
						|
				</td>
 | 
						|
				<td>
 | 
						|
					<input style="width: 100%;" type="number" id="price" name="price" min="0" max="21" value="<?= $data["price"] ?>" required />
 | 
						|
				</td>
 | 
						|
			</tr>
 | 
						|
			<tr>
 | 
						|
				<td>
 | 
						|
					<label for="date_start">Dates :</label>
 | 
						|
				</td>
 | 
						|
				<td>
 | 
						|
					Du <input style="width: 45%;" type="date" id="date_start" name="date_start" value="<?= $data["date_start"] ?>" required />
 | 
						|
					au <input style="width: 45%;" type="date" id="date_end" name="date_end" value="<?= $data["date_end"] ?>" required />
 | 
						|
				</td>
 | 
						|
			</tr>
 | 
						|
			<tr>
 | 
						|
				<td>
 | 
						|
					<label for="date_inscription">Date limite d'inscription :</label>
 | 
						|
				</td>
 | 
						|
				<td>
 | 
						|
					<input style="width: 49%;" type="date" id="date_inscription" name="date_inscription" value="<?= substr($data["date_inscription"], 0, 10) ?>" required />
 | 
						|
					<input style="width: 49%;" type="time" id="time_inscription" name="time_inscription" value="<?= substr($data["date_inscription"], 11) ?>" required />
 | 
						|
				</td>
 | 
						|
			</tr>
 | 
						|
			<tr>
 | 
						|
				<td>
 | 
						|
					<label for="date_solutions">Date limite pour rendre les solutions :</label>
 | 
						|
				</td>
 | 
						|
				<td>
 | 
						|
					<input style="width: 49%;" type="date" id="date_solutions" name="date_solutions" value="<?= substr($data["date_solutions"], 0, 10) ?>" required />
 | 
						|
					<input style="width: 49%;" type="time" id="time_solutions" name="time_solutions" value="<?= substr($data["date_solutions"],11) ?>" required />
 | 
						|
				</td>
 | 
						|
			</tr>
 | 
						|
			<tr>
 | 
						|
				<td>
 | 
						|
					<label for="date_syntheses">Date limite pour rendre les notes de synthèse :</label>
 | 
						|
				</td>
 | 
						|
				<td>
 | 
						|
					<input style="width: 100%;" type="date" id="date_syntheses" name="date_syntheses" value="<?= substr($data["date_syntheses"], 0, 10) ?>" required />
 | 
						|
					<input style="width: 100%;" type="time" id="time_syntheses" name="time_syntheses" value="<?= substr($data["date_syntheses"], 11) ?>" required />
 | 
						|
				</td>
 | 
						|
			</tr>
 | 
						|
			<tr>
 | 
						|
				<td>
 | 
						|
					<label for="description">Description :</label>
 | 
						|
				</td>
 | 
						|
				<td>
 | 
						|
					<textarea style="width: 100%;" name="description" id="description" required><?= $data["description"] ?></textarea>
 | 
						|
				</td>
 | 
						|
			</tr>
 | 
						|
			<tr>
 | 
						|
				<td colspan="2">
 | 
						|
					<input style="width: 100%;" type="submit" name="edit_tournament" value="Modifier le tournoi" />
 | 
						|
				</td>
 | 
						|
			</tr>
 | 
						|
			</tbody>
 | 
						|
		</table>
 | 
						|
	</form>
 | 
						|
<?php } ?>
 | 
						|
 |