Suppression de la fonction d'énigme bonus + changement du nom de l'app.
This commit is contained in:
parent
d2ea5ebbcd
commit
b2bdc6350f
11
answer.php
11
answer.php
@ -56,17 +56,6 @@
|
||||
$stmt->bindValue(":puzzle_id", $art_id);
|
||||
$stmt->bindValue(":team_id", $team_id);
|
||||
$stmt->execute();
|
||||
|
||||
// On ajoute l'énigme bonus si toutes les autres sont résolues :
|
||||
$stmt = $database->pdo_teams->prepare("SELECT COUNT(*) FROM solved WHERE team_id == :team_id");
|
||||
$stmt->bindValue(":team_id", $team_id);
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->fetchAll()[0]["COUNT(*)"] == "12") { // Il y a 12 énigmes sans compter la bonus
|
||||
$stmt = $database->pdo_teams->prepare("UPDATE teams SET bonus = 1 WHERE id = :team_id");
|
||||
$stmt->bindValue(":team_id", $team_id);
|
||||
$stmt->execute();
|
||||
}
|
||||
}
|
||||
|
||||
$data["valid_qr"] = true;
|
||||
|
12
article.php
12
article.php
@ -27,18 +27,6 @@
|
||||
}
|
||||
|
||||
else {
|
||||
// On vérifie si l'énigme bonus n'est pas débloquée :
|
||||
if (!$database->checkTeamBonus($team_id)) {
|
||||
// Si c'est celle qui est sélectionnée, on retourne à la liste des énigmes :
|
||||
if ($art_id == $max_art) {
|
||||
header("Location: puzzles.php?team=" . $team_id);
|
||||
die();
|
||||
}
|
||||
|
||||
// On retire l'énigme bonus du total :
|
||||
$max_art--;
|
||||
}
|
||||
|
||||
// On indique si l'énigme est résolue :
|
||||
$stmt = $database->pdo_teams->prepare("SELECT * FROM solved WHERE (team_id == :team_id AND puzzle_id == :puzzle_id)");
|
||||
$stmt->bindValue(":team_id", $team_id);
|
||||
|
BIN
data/article.db
BIN
data/article.db
Binary file not shown.
BIN
data/teams.db
BIN
data/teams.db
Binary file not shown.
15
puzzles.php
15
puzzles.php
@ -31,20 +31,7 @@
|
||||
false
|
||||
);
|
||||
|
||||
// On vérifie si l'équipe a débloqué l'énigme bonus :
|
||||
$stmt = $database->pdo_teams->prepare("SELECT * FROM teams WHERE id = :id");
|
||||
$stmt->bindValue(":id", $team_id);
|
||||
$stmt->execute();
|
||||
|
||||
// Si c'est le cas, on affiche toutes les énigmes :
|
||||
if ($stmt->fetchAll()[0][1] == 1) {
|
||||
$stmt = $database->pdo_article->prepare("SELECT * FROM puzzles");
|
||||
}
|
||||
|
||||
// Sinon, on cache la bonus :
|
||||
else {
|
||||
$stmt = $database->pdo_article->prepare("SELECT * FROM puzzles WHERE id <> 13");
|
||||
}
|
||||
$stmt = $database->pdo_article->prepare("SELECT * FROM puzzles");
|
||||
|
||||
$stmt->execute();
|
||||
$puzzles = $stmt->fetchAll();
|
||||
|
@ -24,7 +24,6 @@
|
||||
$this->pdo_teams = new PDO("sqlite:" . dirname(__FILE__) . $data_path . "teams.db");
|
||||
$this->pdo_teams->query('CREATE TABLE IF NOT EXISTS "teams" (
|
||||
"id" INTEGER NOT NULL UNIQUE,
|
||||
"bonus" INTEGER NOT NULL,
|
||||
PRIMARY KEY("id" AUTOINCREMENT)
|
||||
)');
|
||||
|
||||
@ -57,12 +56,6 @@
|
||||
return $query->fetch()["COUNT(*)"];
|
||||
}
|
||||
|
||||
function checkTeamBonus(int $team) {
|
||||
// $team doit être une équipe existante :
|
||||
$query = $this->pdo_teams->query("SELECT bonus FROM teams WHERE id = " . $team);
|
||||
return $query->fetch()[0] == 1;
|
||||
}
|
||||
|
||||
// public function getTeamsNb() {
|
||||
// $query = $this->pdo_teams->query("SELECT COUNT(*) FROM teams");
|
||||
// return $query->fetch()["COUNT(*)"];
|
||||
|
@ -1,19 +1,19 @@
|
||||
<?php
|
||||
$tr = [
|
||||
"tab_title" => [
|
||||
"home" => "Home - Lycée Pange Code Hunt",
|
||||
"team_confirm" => "Team confirmation - Lycée Pange Code Hunt",
|
||||
"puzzles" => "Puzzles list - Lycée Pange Code Hunt",
|
||||
"article" => "Puzzle - Lycée Pange Code Hunt"
|
||||
"home" => "Home - Citizenship Code Hunt",
|
||||
"team_confirm" => "Team confirmation - Citizenship Code Hunt",
|
||||
"puzzles" => "Puzzles list - Citizenship Code Hunt",
|
||||
"article" => "Puzzle - Citizenship Code Hunt"
|
||||
],
|
||||
"page_title" => [
|
||||
"home" => "Code Hunt",
|
||||
"home" => "Citizenship Code Hunt",
|
||||
"team_confirm" => "Team confirmation",
|
||||
"puzzles" => "Puzzles list for team n°",
|
||||
"article" => "Puzzle n°"
|
||||
],
|
||||
"home" => [
|
||||
"subtitle" => "Welcome to the code hunt of Lycée Jean de Pange of Sarreguemines !",
|
||||
"subtitle" => "Welcome to the Citizenship Code Hunt !",
|
||||
"message" => "Enter your team number to begin :",
|
||||
"team" => "Team number...",
|
||||
"button" => "OK"
|
||||
@ -38,7 +38,7 @@
|
||||
"map_desc" => "Here is a map showing the location of the puzzles you already solved :"
|
||||
],
|
||||
"nav" => [
|
||||
"title" => "Code Hunt Pange",
|
||||
"title" => "Citizenship Code Hunt",
|
||||
"home" => "Home"
|
||||
],
|
||||
"footer" => [
|
||||
|
@ -1,19 +1,19 @@
|
||||
<?php
|
||||
$tr = [
|
||||
"tab_title" => [
|
||||
"home" => "Accueil - Chasse au code Lycée Pange",
|
||||
"team_confirm" => "Confirmation du choix d'équipe - Chasse au code Lycée Pange",
|
||||
"puzzles" => "Liste des énigmes - Chasse au code Lycée Pange",
|
||||
"article" => "Énigme - Chasse au code Lycée Pange"
|
||||
"home" => "Accueil - Jeu de Pistes de la Citoyenneté",
|
||||
"team_confirm" => "Confirmation du choix d'équipe - Jeu de Pistes de la Citoyenneté",
|
||||
"puzzles" => "Liste des énigmes - Jeu de Pistes de la Citoyenneté",
|
||||
"article" => "Énigme - Jeu de Pistes de la Citoyenneté"
|
||||
],
|
||||
"page_title" => [
|
||||
"home" => "Chasse au code",
|
||||
"home" => "Jeu de Pistes de la Citoyenneté",
|
||||
"team_confirm" => "Confirmation du choix d'équipe",
|
||||
"puzzles" => "Liste des puzzles pour l'équipe n°",
|
||||
"article" => "Énigme n°"
|
||||
],
|
||||
"home" => [
|
||||
"subtitle" => "Bienvenue à la chasse au code du Lycée Jean de Pange de Sarreguemines !",
|
||||
"subtitle" => "Bienvenue dans le Jeu de Pistes de la Citoyenneté !",
|
||||
"message" => "Pour commencer, veuillez entrer le numéro de votre équipe :",
|
||||
"team" => "Numéro d'équipe...",
|
||||
"button" => "Valider"
|
||||
@ -38,11 +38,11 @@
|
||||
"map_desc" => "Voici la carte des emplacements des énigmes que vous avez résolues :"
|
||||
],
|
||||
"nav" => [
|
||||
"title" => "Chasse au code Pange",
|
||||
"title" => "Jeu de Pistes de la Citoyenneté",
|
||||
"home" => "Accueil"
|
||||
],
|
||||
"footer" => [
|
||||
"text" => "Lycée Jean de Pange Sarreguemines<br><a href='https://forge.chapril.org/antux18/ChasseTresorPange'>Code source</a>"
|
||||
"text" => "Lycée Jean de Pange Sarreguemines<br><a href='https://forge.chapril.org/Antux/JeuPistesSarreguemines'>Code source</a>"
|
||||
]
|
||||
];
|
||||
?>
|
Loading…
Reference in New Issue
Block a user