1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 05:42:23 +00:00

Possibilité de voir les informations des organisateurs d'un tournoi (pour admins et autres orgas)

This commit is contained in:
Yohann 2019-09-02 19:52:13 +02:00
parent c2eba2bb2e
commit 864d94c51d

View File

@ -8,10 +8,10 @@ $response = $DB->prepare("SELECT * FROM `tournaments` WHERE `name` = ? AND `year
$response->execute([$tournament_name]);
$data = $response->fetch();
$orgas_req = $DB->query("SELECT `surname`, `first_name` FROM `users` JOIN `organizers` ON `users`.`id` = `organizer` WHERE `tournament` = " . $data["id"] . ";");
$orgas_req = $DB->query("SELECT `users`.`id` AS `id`, `surname`, `first_name` FROM `users` JOIN `organizers` ON `users`.`id` = `organizer` WHERE `tournament` = " . $data["id"] . ";");
$orgas = [];
while (($orga_data = $orgas_req->fetch()) !== false) {
$orgas[] = $orga_data["first_name"] . " " . $orga_data["surname"];
$orgas[] = [$orga_data["id"], $orga_data["first_name"] . " " . $orga_data["surname"]];
}
if (isset($_POST["edit_tournament"])) {
@ -126,8 +126,13 @@ function updateTournament() {
<strong>Organisateur<?= sizeof($orgas) >= 2 ? 's' : '' ?> :</strong>
<?php
$s = "";
foreach ($orgas as $orga)
$s .= $orga . ", ";
foreach ($orgas as $orga) {
if ($_SESSION["role"] == "ORGANIZER" || $_SESSION["role"] == "ADMIN")
$s .= "<a href=\"$URL_BASE/informations/$orga[0]/$orga[1]\">$orga[1]</a>";
else
$s .= $orga[1];
$s .= ", ";
}
echo substr($s, 0, -2);
?>
<br />