Merge branch 'main' of git.ale-pri.com:LesBikers/DeezCycle
This commit is contained in:
17
controleurs/creerPartie_controleur.php
Normal file
17
controleurs/creerPartie_controleur.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
|
||||
function creerPartie($nbCartesVertes, $nbCartesOranges, $nbCartesNoires) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
73
vues/creerPartie_vue.php
Normal file
73
vues/creerPartie_vue.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
function champs_cartes($nom, $titre) {
|
||||
|
||||
$nbCartes = 1;
|
||||
|
||||
if (isset($_POST[$nom])) {
|
||||
$nbCartes = (int) $_POST[$nom];
|
||||
}
|
||||
|
||||
echo '<select id="' . $nom . '" name="' . $nom . '">';
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
echo '<option value="' . $i . '"';
|
||||
if ($i == $nbCartes) {
|
||||
echo ' selected';
|
||||
}
|
||||
echo '>' . $i . '</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
|
||||
echo '<label for="' . $nom . '">' . $titre . '</label><br/>';
|
||||
|
||||
if (isset($_POST[$nom])) {
|
||||
return (int) $_POST[$nom];
|
||||
}
|
||||
|
||||
return (int) 0;
|
||||
}
|
||||
|
||||
function afficher_formulaire() {
|
||||
$total = 0;
|
||||
|
||||
echo '<form class="formulaire_partie" method="post" action="#">';
|
||||
|
||||
$total += champs_cartes('nbCartesVertes', 'Nombre de cartes vertes');
|
||||
$total += champs_cartes('nbCartesOranges', 'Nombre de cartes oranges');
|
||||
$total += champs_cartes('nbCartesNoires', 'Nombre de cartes noires');
|
||||
|
||||
|
||||
if($total > 0) {
|
||||
echo '<div>Total : ' . $total . '</div>';
|
||||
if ($total > 10) {
|
||||
echo '<div> Trop de cartes !!!!!!</div>';
|
||||
} else {
|
||||
echo '<input type="submit" name="creerPartie" value="Créer une partie" />';
|
||||
}
|
||||
}
|
||||
|
||||
echo '<input type="submit" name="validerCartes" value="Valider le nombre de cartes" />';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="panneau_details">
|
||||
|
||||
<h2>Créer une partie</h2>
|
||||
|
||||
<?php
|
||||
if (isset($_POST['creerPartie'])) {
|
||||
$total = (int)$_POST['nbCartesVertes'] + (int)$_POST['nbCartesOranges'] + (int)$_POST['nbCartesNoires'];
|
||||
if ($total <= 10) {
|
||||
creerPartie($_POST['nbCartesVertes'], $_POST['nbCartesOranges'], $_POST['nbCartesNoires']);
|
||||
echo '<div>Partie en cours de création ...</div>';
|
||||
} else {
|
||||
afficher_formulaire();
|
||||
}
|
||||
} else {
|
||||
afficher_formulaire();
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -32,7 +32,7 @@
|
||||
$donnees = ['idpartie', 'date_partie', 'horaire'];
|
||||
$parties = $parties['instances'][(int) $_POST["selectparty"] - 1];
|
||||
|
||||
$url = 'https://bdw.univ-lyon1.fr/p2203977/DeezCycle/vues/details_vue.php?';
|
||||
$url = 'vues/details_vue.php?';
|
||||
foreach ($donnees as $donnee) {
|
||||
$url .= $donnee . '=' . $parties[$donnee] . '&';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user