test
continuous-integration/drone/push Build is passing Details

ServeurDeTest
Noé GARNIER 2 years ago
parent 90a799498b
commit 5d98003097

@ -348,18 +348,25 @@ class UserController
} }
} }
public function goToGameEnd(){
try {
global $rep, $vues, $error;
require ($rep . $vues['gameEnd']);
} catch (Exception $e) {
$error = $e->getMessage();
require($rep . $vues['erreur']);
}
}
// A appeler après avoir vérifié que la partie est finie
public function endGame(){ public function endGame(){
try { try {
global $rep, $vues, $error; global $rep, $vues, $error;
$model = new UserModel(); $model = new UserModel();
$idPartie = $_SESSION['idPartie']; $idPartie = $_SESSION['idPartie'];
$etat = $model->getEtatPartie($idPartie);
if ($etat != 2){
throw new Exception("La partie n'est pas terminée");
}
$lesInfos = $model->getEndGameInfo($idPartie); $lesInfos = $model->getEndGameInfo($idPartie);
$model->endGame($idPartie); $model->endGame($idPartie);
require ($rep . $vues['gameEnd']); $this->goToGameEnd();
} }
catch (Exception $e) { catch (Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();

Loading…
Cancel
Save