Test affiche joueur dans la fille d'attente
continuous-integration/drone/push Build is passing Details

ServeurDeTest
Noé GARNIER 2 years ago
parent 56b506dbb9
commit 1ddd10d2a9

@ -37,7 +37,7 @@ $vues['enigmePage'] = 'View/src/pages/Enigme/EnigmePage.php';
$BUFFER_SIZE = 1024; $BUFFER_SIZE = 1024;
$serverAdress = "82.165.180.114"; $serverAdress = "82.165.180.114";
$port= "3000"; $port= "3000";
$playerNumberPerGame=2; $playerNumberPerGame=3;
//modules //modules
$modules = 'node_module/'; $modules = 'node_module/';

@ -290,6 +290,20 @@ class PartieGateway
} }
return 0; 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 public function showAll(): void
{ {
$query = "SELECT * FROM Partie"; $query = "SELECT * FROM Partie";

@ -191,6 +191,8 @@ class UserController
echo $idPartie . " idPartie\n"; echo $idPartie . " idPartie\n";
if($etat == 1){ if($etat == 1){
// header("Location: index.php?action=launchGame"); // header("Location: index.php?action=launchGame");
$lesJoeurs = $model->getLesJoueurs($idPartie);
sleep(30);
header("Location: index.php?action=goToPresentation"); header("Location: index.php?action=goToPresentation");
} }
else{ else{

@ -144,4 +144,13 @@ class UserModel
public function getEtatPartie($idPartie){ public function getEtatPartie($idPartie){
return $this->partie_gateway->getEtat($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;
}
} }

@ -41,19 +41,41 @@
<div class="row d-flex "> <div class="row d-flex ">
<div class="col d-flex flex-column align-items-center"> <div class="col d-flex flex-column align-items-center">
<div style="background-color: red; height: 75px; width: 75px;"></div> <div style="background-color: red; height: 75px; width: 75px;"></div>
<p class="pt-3">Player 1</p> <!-- <p class="pt-3">Player 1</p> -->
<?php echo ' <p class="pt-3">' . $_SESSION['utilisateur']->getPseudo().'</p>'; ?>
</div> </div>
<div class="col d-flex flex-column align-items-center"> <div class="col d-flex flex-column align-items-center">
<div style="background-color: blue; height: 75px; width: 75px;"></div> <div style="background-color: blue; height: 75px; width: 75px;"></div>
<p class="pt-3">Player 2</p> <?php
if (isset($lesJoeurs[1])){
echo ' <p class="pt-3">' . $lesJoeurs[1]->getPseudo().'</p>';
}
else{
echo ' <p class="pt-3">Player 2</p>';
}
?>
</div> </div>
<div class="col d-flex flex-column align-items-center"> <div class="col d-flex flex-column align-items-center">
<div style="background-color: yellow; height: 75px; width: 75px;"></div> <div style="background-color: yellow; height: 75px; width: 75px;"></div>
<p class="pt-3">Player 3</p> <?php
if (isset($lesJoeurs[2])){
echo ' <p class="pt-3">' . $lesJoeurs[2]->getPseudo().'</p>';
}
else{
echo ' <p class="pt-3">Player 2</p>';
}
?>
</div> </div>
<div class="col d-flex flex-column align-items-center"> <div class="col d-flex flex-column align-items-center">
<div style="background-color: green; height: 75px; width: 75px;"></div> <div style="background-color: green; height: 75px; width: 75px;"></div>
<p class="pt-3">Player 4</p> <?php
if (isset($lesJoeurs[3])){
echo ' <p class="pt-3">' . $lesJoeurs[3]->getPseudo().'</p>';
}
else{
echo ' <p class="pt-3">Player 2</p>';
}
?>
</div> </div>
</div> </div>
<div class="row"> <div class="row">

Loading…
Cancel
Save