Fin implémentation ordre des énigmes.

This commit is contained in:
antux18 2024-02-16 10:55:10 +01:00
parent a0e3ba8c09
commit 559d42fff1
2 changed files with 5 additions and 5 deletions

Binary file not shown.

View File

@ -41,12 +41,12 @@
$stmt = $database->pdo_teams->prepare("SELECT pzorder FROM teams WHERE id == :id"); $stmt = $database->pdo_teams->prepare("SELECT pzorder FROM teams WHERE id == :id");
$stmt->bindValue(":id", $team_id); $stmt->bindValue(":id", $team_id);
$stmt->execute(); $stmt->execute();
$order = $stmt->fetch(); $result = $stmt->fetch();
$order = $result["pzorder"];
echo (string) $order["pzorder"];
// Si un ordre d'énigmes n'a pas été défini au préalable pour cette équipe, on en choisit un au hasard : // Si un ordre d'énigmes n'a pas été défini au préalable pour cette équipe, on en choisit un au hasard :
if ($order == NULL) { if (is_null($order)) {
echo "lol";
$order = rand(0, sizeof($pzorder)); $order = rand(0, sizeof($pzorder));
$stmt = $database->pdo_teams->prepare("UPDATE teams SET pzorder = :order WHERE id == :id"); $stmt = $database->pdo_teams->prepare("UPDATE teams SET pzorder = :order WHERE id == :id");
$stmt->bindValue(":id", $team_id); $stmt->bindValue(":id", $team_id);
@ -83,7 +83,7 @@
<article> <article>
<p><?= $tr["puzzles"]["message"]?></p> <p><?= $tr["puzzles"]["message"]?></p>
<ul> <ul>
<?php foreach ($pzorder[$order["pzorder"]] as $pzid) : ?> <?php foreach ($pzorder[$order] as $pzid) : ?>
<?php foreach ($puzzles as $puzzle) : ?> <?php foreach ($puzzles as $puzzle) : ?>
<?php if ($puzzle["id"] == $pzid) : ?> <?php if ($puzzle["id"] == $pzid) : ?>
<li><a href="article.php?team=<?= $team_id ?>&id=<?= $puzzle["id"] ?>"><?= $tr["page_title"]["article"] . $puzzle["id"] . " : " . $puzzle["title"] ?></a></li> <li><a href="article.php?team=<?= $team_id ?>&id=<?= $puzzle["id"] ?>"><?= $tr["page_title"]["article"] . $puzzle["id"] . " : " . $puzzle["title"] ?></a></li>