This repository has been archived on 2024-04-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
DeezCycle/vues/jouerPartie_vue.php

61 lines
1.1 KiB
PHP

<?php
function afficherCarte(string $nomcarte): void
{
echo '<img src="img/cartes/' . $nomcarte . '" alt="' . $nomcarte . '" width="200" height="320"/>';
}
function afficher_depart(): void
{
afficherCarte("carteDépart.png");
}
function afficher_arrivee(): void
{
afficherCarte("carteArrivée.png");
}
function afficherCartes(int $idpartie): void
{
$cartes = getCardsName($idpartie);
afficher_depart();
foreach ($cartes as $carte) {
afficherCarte($carte);
}
afficher_arrivee();
}
function formulaire_selection_partie()
{
$parties = get_parties_id();
echo '<form class="choisir_partie" method="post" action="#">';
echo '<select id="idpartie" name="idpartie">';
foreach ($parties as $partie) {
echo '<option value="' . $partie . '">' . $partie . '</option>';
}
echo '</select>';
echo '<input type="submit" name="soumettre" value="Valider"/>';
echo '</form>';
}
?>
<div class="panneau_details">
<h2>Jouer une partie</h2>
<div>
<?php
if (isset($_POST['idpartie'])) {
afficherCartes($_POST['idpartie']);
} else {
formulaire_selection_partie();
}
?>
</div>
</div>