diff --git a/WEB/Config/Config.php b/WEB/Config/Config.php index c7f98763..580d46cb 100644 --- a/WEB/Config/Config.php +++ b/WEB/Config/Config.php @@ -37,7 +37,7 @@ $vues['enigmePage'] = 'View/src/pages/Enigme/EnigmePage.php'; $BUFFER_SIZE = 1024; $serverAdress = "82.165.180.114"; $port= "3000"; -$playerNumberPerGame=2; +$playerNumberPerGame=3; //modules $modules = 'node_module/'; diff --git a/WEB/Controller/PartieGateway.php b/WEB/Controller/PartieGateway.php index c98b22f3..b03b3d3c 100644 --- a/WEB/Controller/PartieGateway.php +++ b/WEB/Controller/PartieGateway.php @@ -290,6 +290,20 @@ class PartieGateway } return 0; } + + public function getLesMailJoueurs($idPartie){ + $query = "SELECT utilisateur FROM Participer WHERE partie = :idPartie"; + $this->con->executeQuery($query, array( + "idPartie" => array($idPartie, SQLITE3_INTEGER) + ) + ); + $results = $this->con->getResults(); + $lesJoueurs = array(); + foreach ($results as $row){ + $lesJoueurs[] = $row['utilisateur']; + } + return $lesJoueurs; + } public function showAll(): void { $query = "SELECT * FROM Partie"; diff --git a/WEB/Controller/UserController.php b/WEB/Controller/UserController.php index 1bacce75..7098f692 100644 --- a/WEB/Controller/UserController.php +++ b/WEB/Controller/UserController.php @@ -191,6 +191,8 @@ class UserController echo $idPartie . " idPartie\n"; if($etat == 1){ // header("Location: index.php?action=launchGame"); + $lesJoeurs = $model->getLesJoueurs($idPartie); + sleep(30); header("Location: index.php?action=goToPresentation"); } else{ diff --git a/WEB/Model/UserModel.php b/WEB/Model/UserModel.php index ddc9219f..de336288 100644 --- a/WEB/Model/UserModel.php +++ b/WEB/Model/UserModel.php @@ -144,4 +144,13 @@ class UserModel public function getEtatPartie($idPartie){ return $this->partie_gateway->getEtat($idPartie); } + + public function getLesJoueurs($idPartie){ + $lesMailJoeurs = $this->partie_gateway->getLesMailJoueurs($idPartie); + $lesJoueurs = array(); + foreach ($lesMailJoeurs as $mail){ + $lesJoueurs[] = $this->utilisateur_gateway->getUtilisateurByEmail($mail); + } + return $lesJoueurs; + } } \ No newline at end of file diff --git a/WEB/View/src/pages/Multijoueur/FileAttente.php b/WEB/View/src/pages/Multijoueur/FileAttente.php index 88c60ec0..ff335743 100644 --- a/WEB/View/src/pages/Multijoueur/FileAttente.php +++ b/WEB/View/src/pages/Multijoueur/FileAttente.php @@ -41,19 +41,41 @@
-

Player 1

+ + ' . $_SESSION['utilisateur']->getPseudo().'

'; ?>
-

Player 2

+ ' . $lesJoeurs[1]->getPseudo().'

'; + } + else{ + echo '

Player 2

'; + } + ?>
-

Player 3

+ ' . $lesJoeurs[2]->getPseudo().'

'; + } + else{ + echo '

Player 2

'; + } + ?>
-

Player 4

+ ' . $lesJoeurs[3]->getPseudo().'

'; + } + else{ + echo '

Player 2

'; + } + ?>