Add new PHP functions to retrieve game details and display them in the view

This commit is contained in:
2024-04-18 14:06:38 +02:00
parent 1ee5c9e7e4
commit 44809197cb
4 changed files with 120 additions and 2 deletions

View File

@@ -1,4 +1,48 @@
<div class="panneau_details">
<?php
function afficherTriplets(int $idplateau)
{
$triplets = get_triplet_cartes($idplateau);
echo '<div id="triplets">';
echo '</br>';
echo '<p>Cartes:</p>';
echo '<p>Cartes vertes: ' . $triplets['nb_verte'] . '</p>';
echo '<p>Cartes oranges: ' . $triplets['nb_orange'] . '</p>';
echo '<p>Cartes noires: ' . $triplets['nb_noire'] . '</p>';
echo '</div>';
}
function afficherRangPseudo(int $idpartie)
{
$rang = get_rang($idpartie);
$pseudo = get_pseudos($idpartie);
echo '<div id="rangPseudo">';
echo '</br>';
echo '<p>Joueurs:</p>';
foreach ($pseudo as $p){
echo '<p>Pseudo: ' . $p['pseudo'] . '</p>';
}
echo '</br>';
echo '<p>Classement:</p>';
foreach ($rang as $r){
echo '<p>Pseudo: ' . $r['pseudo'] . '</p>';
echo '<p>Rang: ' . $r['rang'] . '</p>';
}
echo '</div>';
}
function afficherPseudo(int $idpartie)
{
$pseudo = get_pseudos($idpartie);
echo '<div id="pseudo">';
foreach ($pseudo as $p){
echo '<p>Pseudo: ' . $p['pseudo'] . '</p>';
}
echo '</div>';
}
?>
<div class="panneau_details_2">
<h2>Affichage de la partie</h2>
@@ -14,6 +58,11 @@
}
}
echo '</div>';
echo afficherTriplets(get_plateau_id($_GET['idpartie']));
echo afficherRangPseudo($_GET['idpartie']);
?>
</tbody>
</table>

View File

@@ -32,7 +32,7 @@
$donnees = ['idpartie', 'date_partie', 'horaire'];
$parties = $parties['instances'][(int) $_POST["selectparty"] - 1];
$url = 'vues/details_vue.php?';
$url = 'index.php?page=details&';
foreach ($donnees as $donnee) {
$url .= $donnee . '=' . $parties[$donnee] . '&';
}