on peut voir les cartes d'une partie
This commit is contained in:
61
vues/jouerPartie_vue.php
Normal file
61
vues/jouerPartie_vue.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user