Compare commits

..

94 Commits

Author SHA1 Message Date
Alix JEUDI--LEMOINE 1fe4450781 Ajout du GANTT réel
1 year ago
Victor SOULIER 2b5ccbf22c ajustement readme
1 year ago
Victor SOULIER 27b12978dd update README.md
1 year ago
Victor SOULIER 68dca83548 sync script sql
1 year ago
ShrayzzDev 56a04c44b8 [MOD] bd en accord avec mld
1 year ago
ShrayzzDev 13df6da749 [ADD] Attibuts action pendu mld
1 year ago
ShrayzzDev 0a1dadac9f [ADD] Actions dans mld pour les jeux
1 year ago
Alix JEUDI--LEMOINE 75a30d14b3 Ajout inserts dans Indice
1 year ago
Alix JEUDI--LEMOINE bad947201f Corrections erreurs SQL
1 year ago
Victor SOULIER 5388a2fd33 Suppression id_session : Invité
1 year ago
Victor SOULIER f4ca4e0b01 mise à jour mld selon mld graphique
1 year ago
Victor SOULIER b1d9710bb2 correction association inexistante
1 year ago
Victor SOULIER ebab9d0ef6 correction
1 year ago
Victor SOULIER 6dc89afbe8 Ajout script sql
1 year ago
Victor SOULIER ff05031fd1 dénormalisation sexe/scientifique
1 year ago
Victor SOULIER 3b8f2cd4a5 Correction liaison partie / joueur
1 year ago
Victor SOULIER 8e1563a01d Merge branch 'docs'
1 year ago
Victor SOULIER c1ef7420af déplacement documentation
1 year ago
Victor SOULIER 74fc8c2f3e suppression config idea
1 year ago
Victor SOULIER e1290e1a55 suppression code php
1 year ago
Victor SOULIER b6ec89cd27 Correction chemin critique
1 year ago
Victor SOULIER 795eaa4dab Ajout gwenael
1 year ago
Alix JEUDI--LEMOINE c85eec96ff Correction 2 erreurs SQL
1 year ago
Alix JEUDI--LEMOINE 47c187bb9c Supression print inutile
1 year ago
Alix JEUDI--LEMOINE 622625db79 Mauvais controlleur appelé
1 year ago
Alix JEUDI--LEMOINE bd77065902 Renommage conforme
1 year ago
Alix JEUDI--LEMOINE 2c96f7d7e8 Suppression constructeurs inutiles
1 year ago
Alix JEUDI--LEMOINE 4830ee3636 Ajout méthodes squelettes / déplacement des méthodes qui étaient au mauvais endroit (uniquement Controller)
1 year ago
Alix JEUDI--LEMOINE 8cd8b6dea1 Renommage des Controllers qui ne devraient pas exister le temps de corriger tout les problèmes
1 year ago
Alix JEUDI--LEMOINE a9054e8645 Ajout des squelettes des méthodes manquantes (en comparaison avec le diag de classes)
1 year ago
Alix JEUDI--LEMOINE 2ce216aea3 Ajout des Gateway manquantes (fonctions squelettes)
1 year ago
Alix JEUDI--LEMOINE f57fe59f9b Mise à jour de la conception / SOULIER + JEUDI + BEURET
1 year ago
Alix JEUDI--LEMOINE 585cb707ba Ajout SVG conception préliminaire
1 year ago
Victor SOULIER da0b1d33e3 ajout version préliminaire de la conception | SOULIER / JEUDI--LEMOINE
1 year ago
Gwenael PLANCHON e26e30b5ea Merge pull request 'verifier les données' (#7) from php_verifdonn into php
1 year ago
Tom 590fe5199e ADD: Bouton "Quitter" et affichage correct de la question dans la page scienceQuizz.html
1 year ago
Gwenael PLANCHON c4c29b85a5 idem edit
1 year ago
Gwenael PLANCHON 54198a8f42 fix erreur lors ajout sci
1 year ago
Gwenael PLANCHON 7cd4765547 verifier les données avant d'ajouter
1 year ago
Tom a90f6299dc FIX: Ajout de la gestion d'erreur d'addScientifiqueDecouvert()
1 year ago
Renaud BEURET a32abbff13 Merge branch 'php' of codefirst.iut.uca.fr:tom.biard/ScienceQuest into php
1 year ago
Renaud BEURET cd0a41b5dd ADD : Affichage de l'historique
1 year ago
Victor SOULIER 76d9db214b ADD : ajout scientifique découvert à l'utilisateur en fin de partie
1 year ago
Victor SOULIER e9badcc1d9 ADD : méthodes getFromEmail
1 year ago
Victor SOULIER e2e020b6b0 ADD : variable session role
1 year ago
Victor SOULIER f68c570426 ADD : getfrompseudo
1 year ago
Victor SOULIER 8002aeed16 ADD : getter et getFromEmail
1 year ago
Victor SOULIER d1810f07e8 FIX : var type
1 year ago
Tom f9ac7ef338 FIX: Science Quizz un pas de plus vers le fonctionnel !
1 year ago
Gwenael PLANCHON 0c50c491b0 fix liens liste
1 year ago
Gwenael PLANCHON 93f0bedbe4 Merge branch 'php' of https://codefirst.iut.uca.fr/git/tom.biard/ScienceQuest into php
1 year ago
Gwenael PLANCHON ab389aa003 ajouter register
1 year ago
Victor SOULIER 7118779d56 FIX : type de retour
1 year ago
Victor SOULIER 0ba42cba82 FIX : nom colonne
1 year ago
Tom 5e376620e6 Merge remote-tracking branch 'origin/php' into php
1 year ago
Tom f6583259d2 ADD(to fix): Jeu "Science Quizz"
1 year ago
Gwenael PLANCHON b862e388f4 fix erreur bizzare
1 year ago
Renaud BEURET 2d6e393e3f FIX : Connection admin
1 year ago
Renaud BEURET c275e41df0 merge
1 year ago
Renaud BEURET 7d8eb40879 ADD : liste de scientifique pour l'admin
1 year ago
Tom 9a535b017e FIX: Correction de l'ordre d'insert de la DB.
1 year ago
Tom c6d1570ea7 Merge remote-tracking branch 'origin/php' into php
1 year ago
Tom 65034a5163 UPDATE: Remplissage de la DB pour des tests plus intéressants.
1 year ago
Gwenael PLANCHON ceae92a88a ajouter deleteScientifique
1 year ago
Gwenael PLANCHON e327265d62 ajout possibilité de modifier scietififuqes
1 year ago
Gwenael PLANCHON c7255091ec ajout editScientifique
1 year ago
Gwenael PLANCHON e971de1295 ajout get/edit MdlScientifque
1 year ago
Gwenael PLANCHON 730e478691 reajouter logout
1 year ago
Tom cbd4862e6d DELETE: ScientistGateway.php et UserGateway.php supprimés
1 year ago
Tom 65a6115155 Merge remote-tracking branch 'origin/php' into php
1 year ago
Tom 1894de75c6 UPDATE:config.php inclu dans le .gitignore
1 year ago
Gwenael PLANCHON fe8842a190 fix dvue
1 year ago
Gwenael PLANCHON 960b8c8f65 Merge branch 'php' of https://codefirst.iut.uca.fr/git/tom.biard/ScienceQuest into php
1 year ago
Gwenael PLANCHON db24beba01 Merge branch 'php_add_ajoutersci' into php
1 year ago
Alix JEUDI--LEMOINE 7dd4ab9193 Ajout route index.php
1 year ago
Renaud BEURET c8323d3f50 finition correction altorouteur
1 year ago
Victor SOULIER a3a44e06d8 FIX : mkdir path config
1 year ago
Victor SOULIER 95faf5958d DELETE : class métier double
1 year ago
Victor SOULIER 5e29e91a78 FIX ; script installation boostrap
1 year ago
Victor SOULIER 4da1f2ed69 FIX : suppression fichiers unitilsés
1 year ago
Tom 04589aaf5c UPDATE: Changement du composer.json
1 year ago
Tom 0d872490b5 FIX: Correction des principaux warnings de tout les fichiers.
1 year ago
Gwenael PLANCHON e403b69a81 ajouter page admin "ajouter
1 year ago
Gwenael PLANCHON 40af2afbd1 modifier mdl et gateway
1 year ago
Gwenael PLANCHON 5078d4a91a ajouter isAdmin et isLogged aux sessions
1 year ago
Gwenael PLANCHON 5cdc0e6ddc ajouter getsexes
1 year ago
Alix JEUDI--LEMOINE eb0005d13d Ajout du rapport de gestion
1 year ago
Victortunes 4bfe0d8da6 FIX : agencement et répartition des tâches
1 year ago
Tom 0a314307c3 FIX: Changement du fichier project (ne fonctionne toujours pas correctement)
1 year ago
Alix JEUDI--LEMOINE 904512c54c Correction d'un problème sur le calendrier SAE + début ajout antécédents / affectation ressources
1 year ago
Alix JEUDI--LEMOINE f6c6264821 Première version du MS Project
1 year ago
Tom 72706dfff6 📝 V1.0 du WBS pour la création du projet "Science Quest"
1 year ago
Tom 730d03905a 📝 Ajout de la présentation générale du projet
1 year ago
Tom BIARD 655fd04254 Mise à jour de 'README.md'
1 year ago

8
.idea/.gitignore vendored

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/project/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/project/src/model/exception" isTestSource="false" packagePrefix="model" />
<sourceFolder url="file://$MODULE_DIR$/project/src/model/gateways" isTestSource="false" packagePrefix="model" />
<sourceFolder url="file://$MODULE_DIR$/project/src/model/mdl" isTestSource="false" packagePrefix="model" />
<sourceFolder url="file://$MODULE_DIR$/project/src/model/metier" isTestSource="false" packagePrefix="model" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
<serverData>
<paths name="ProjetPHP">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
</serverData>
</component>
</project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ScienceQuest.iml" filepath="$PROJECT_DIR$/.idea/ScienceQuest.iml" />
</modules>
</component>
</project>

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.4">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

@ -0,0 +1,73 @@
```plantuml
@startwbs
<style>
wbsDiagram {
.blue {
BackgroundColor lightblue
}
.green {
BackgroundColor lightgreen
}
.yellow {
BackgroundColor #ffbf87
}
.orange {
BackgroundColor lightyellow
}
.red {
BackgroundColor #FFB2B2
}
.pink {
BackgroundColor #ff99ee
}
.purple {
BackgroundColor #cfb3ff
}
}
</style>
* Projet "Science Quest" <<blue>>
** Établir la conception <<green>>
*** Créer le site Web <<yellow>>
**** Conception des mini-jeux <<orange>>
***** Conception du jeu "Qui-est-ce ?" <<red>>
***** Conception du jeu "Quizz" <<red>>
***** Conception du jeu "Pendu" <<red>>
*** Créer l'application Mobile <<yellow>>
**** Conception des mini-jeux <<orange>>
***** Conception du jeu "Qui-est-ce ?" <<red>>
***** Conception du jeu "Quizz" <<red>>
***** Conception du jeu "Pendu" <<red>>
** Démarrer le développement <<green>>
*** Développer le site Web <<yellow>>
**** Développement des mini-jeux <<orange>>
***** Développement du jeu "Qui-est-ce ?" <<red>>
***** Développement du jeu "Quizz" <<red>>
***** Développement du jeu "Pendu" <<red>>
*** Développer l'application Mobile <<yellow>>
**** Développement des mini-jeux <<orange>>
***** Développement du jeu "Qui-est-ce ?" <<red>>
***** Développement du jeu "Quizz" <<red>>
***** Développement du jeu "Pendu" <<red>>
** Tester l'application <<green>>
*** Tester le site Web <<yellow>>
**** Test des mini-jeux <<orange>>
***** Test du jeu "Qui-est-ce ?" <<red>>
***** Test du jeu "Quizz" <<red>>
***** Test du jeu "Pendu" <<red>>
*** Tester l'application Mobile <<yellow>>
**** Test des mini-jeux <<orange>>
***** Test du jeu "Qui-est-ce ?" <<red>>
***** Test du jeu "Quizz" <<red>>
***** Test du jeu "Pendu" <<red>>
** Création des livrables <<pink>>
*** Application client web <<purple>>
*** Application client mobile <<purple>>
*** Application admin web <<purple>>
*** Application app monitoring web <<purple>>
*** Conception et contenu de la base de données <<purple>>
*** Installation dun pare-feu <<purple>>
*** Installation dun service web <<purple>>
*** Installation dun SGBD <<purple>>
*** Installation des serveurs pour les services nommées ci-dessus et configurations <<purple>>
@endwbs

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 189 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

@ -2,7 +2,7 @@
@startuml @startuml
entity "Jeu" as jeu { entity "Jeu" as jeu {
<u>id : int <u>id : int
nom : string nom : string
nbrParties : int nbrParties : int
} }
@ -15,86 +15,116 @@ entity "Scientifique" as scientifique {
dateNaissance : date dateNaissance : date
descriptif : string descriptif : string
ratioTrouvee : float ratioTrouvee : float
#idThematique : int sexe: char
#idDifficulte : int #idThematique : int
#idSexe : int #idDifficulte : int
#idSexe : int
} }
entity "Thematique" as thematique { entity "Thematique" as thematique {
<u>id : int <u>id : int
libelle : string libelle : string
} }
entity "Difficulte" as difficulte { entity "Difficulte" as difficulte {
<u>id : int <u>id : int
libelle : string
}
entity "Sexe" as sexe {
<u>id : int
libelle : string libelle : string
} }
entity "Joueur" as joueur { entity "Joueur" as joueur {
<u>id : int <u>id : int
pseudo : string pseudo : string
#idPartie : int
} }
entity "Utilisateur" as utilisateur { entity "Utilisateur" as utilisateur {
<u>#idJoueur : int <u>#idJoueur : int
email : string email : string
motDePasse : string motDePasse : string
pseudo : string pseudo : string
} }
entity "Invite" as invite { entity "Invite" as invite {
<u>#idJoueur : int <u>#idJoueur : int
<u>idSession : int
} }
entity "Partie" as partie { entity "Partie" as partie {
<u>id : int <u>id : int
codeInvitation : string codeInvitation : string
#idJoueur : int isStarted: bool
#idJeu : int #idJeu : int
} }
entity "Admin" as admin { entity "Admin" as admin {
<u>id : int <u>id : int
email : string email : string
motDePasse : string motDePasse : string
} }
entity "Decouvrir" as decouvrir { entity "Decouvrir" as decouvrir {
<u>#idUtilisateur : int <u>#idUtilisateur : int
<u>#idScientifique : int <u>#idScientifique : int
} }
entity "Indice" as indice { entity "Indice" as indice {
<u>id : int <u>id : int
indice : string indice : string
#idScientifique : int #idScientifique : int
} }
entity "Reponse" as reponse { entity "Reponse" as reponse {
<u>id : int <u>id : int
reponse : string reponse : string
#idScientifique : int #idScientifique : int
#idQuestion : int #idQuestion : int
} }
entity "Question" as question { entity "Question" as question {
<u>id : int <u>id : int
question : string question : string
} }
entity "Action" as action {
<u>id : int
dateAction : date
}
entity "Jouer" as jouer {
#idAction
#idPartie
}
entity "ActionPendu" as actionPendu {
<u>#idAction
lettre : char
wordToFind : string
lifeLeft : int
}
entity "ActionKahoot" as actionKahoot {
<u>#idAction
numReponse: int
tempsReponse: int
#idJoueur
}
entity "ActionQuiEstCe" as actionQuiEstCe {
<u>#idAction
#idJoueur
}
actionPendu --> action
actionQuiEstCe --> action
actionQuiEstCe --> joueur
actionKahoot --> action
actionKahoot --> joueur
jouer --> action
jouer --> partie
partie --> jeu partie --> jeu
partie --> joueur partie <-- joueur
invite --> joueur invite --> joueur
utilisateur --> joueur utilisateur --> joueur
utilisateur --> scientifique
scientifique --> thematique scientifique --> thematique
scientifique --> sexe
scientifique --> difficulte scientifique --> difficulte
scientifique --> indice scientifique --> indice
question --> reponse question --> reponse
@ -102,4 +132,4 @@ reponse --> scientifique
decouvrir --> scientifique decouvrir --> scientifique
decouvrir --> utilisateur decouvrir --> utilisateur
jeu --> scientifique jeu --> scientifique
@enduml @enduml

@ -1,11 +1,10 @@
**Jeu(<ins>id</ins>, nom, nbrParties)** **Jeu(<ins>id</ins>, nom, nbrParties)**
- *id* : clef primaire de la table Jeu - *id* : clef primaire de la table Jeu
**Scientifique(<ins>id</ins>, nom, prenom, photo, dateNaissance, descriptif, ratioTrouvee, #idThematique, #idDifficulte, #idSexe)** **Scientifique(<ins>id</ins>, nom, prenom, photo, dateNaissance, descriptif, ratioTrouvee, sexe, #idThematique, #idDifficulte)**
- *id* : clef primaire de la table Scientifique - *id* : clef primaire de la table Scientifique
- *#idThematique* clef étrangère en référence à *id* de la table Thematique - *#idThematique* clef étrangère en référence à *id* de la table Thematique
- *#idDifficulte* clef étrangère en référence à *id* de la table Difficulté - *#idDifficulte* clef étrangère en référence à *id* de la table Difficulté
- *#idSexe* clef étrangère en référence à *id* de la table Sexe
**Thematique(<ins>id</ins>, libelle)** **Thematique(<ins>id</ins>, libelle)**
- *id* : clef primaire de la table Thematique - *id* : clef primaire de la table Thematique
@ -13,23 +12,20 @@
**Difficulté(<ins>id</ins>, libelle)** **Difficulté(<ins>id</ins>, libelle)**
- *id* : clef primaire de la table Difficulté - *id* : clef primaire de la table Difficulté
**Sexe(<ins>id</ins>, libelle)** **Joueur(<ins>id</ins>, pseudo, #idPartie)**
- *id* : clef primaire de la table Sexe
**Joueur(<ins>id</ins>, pseudo)**
- *id* : clef primaire de la table Joueur - *id* : clef primaire de la table Joueur
- *#idPartie* : clef étrangère en référence à *id* de la table Partie
**Utilisateur(<ins>#idJoueur</ins>, email, motDePasse, pseudo)** **Utilisateur(<ins>#idJoueur</ins>, email, motDePasse, pseudo)**
- *idJoueur* : clef primaire de la table Joueur - *idJoueur* : clef primaire de la table Joueur
- *#idJoueur* : clef étrangère en référence à *id* de la table Joueur - *#idJoueur* : clef étrangère en référence à *id* de la table Joueur
**Invite(<ins>#idJoueur</ins>, idSession)** **Invite(<ins>#idJoueur</ins>)**
- *idJoueur* : clef primaire de la table Joueur - *idJoueur* : clef primaire de la table Joueur
- *#idJoueur* : clef étrangère en référence à *id* de la table Joueur - *#idJoueur* : clef étrangère en référence à *id* de la table Joueur
**Partie(<ins>id</ins>, codeInvitation, #idJoueur, #idJeu)** **Partie(<ins>id</ins>, codeInvitation, #idJeu)**
- *id* : clef primaire de la table Partie - *id* : clef primaire de la table Partie
- *#idJoueur* : clef étrangère en référence à *id* de la table Joueur
- *#idJeu* : clef étrangère en référence à *id* de la table Jeu - *#idJeu* : clef étrangère en référence à *id* de la table Jeu
**Admin(<ins>#id</ins>, email, motDePasse)** **Admin(<ins>#id</ins>, email, motDePasse)**

@ -0,0 +1,181 @@
-- Testé sous pgsql 15
DROP TABLE IF EXISTS Reponse CASCADE;
DROP TABLE IF EXISTS Question CASCADE;
DROP TABLE IF EXISTS Admin CASCADE;
DROP TABLE IF EXISTS Partie CASCADE;
DROP TABLE IF EXISTS Jeu CASCADE;
DROP TABLE IF EXISTS Decouvrir CASCADE;
DROP TABLE IF EXISTS Utilisateur CASCADE;
DROP TABLE IF EXISTS Invite CASCADE;
DROP TABLE IF EXISTS Joueur CASCADE;
DROP TABLE IF EXISTS Indice CASCADE;
DROP TABLE IF EXISTS Scientifique CASCADE;
DROP TABLE IF EXISTS Thematique CASCADE;
DROP TABLE IF EXISTS Difficulte;
-- THEMATIQUE
CREATE TABLE Thematique(
id SERIAL PRIMARY KEY,
libelle varchar(128) NOT NULL UNIQUE
);
-- DIFFICULTE
CREATE TABLE Difficulte(
id SERIAL PRIMARY KEY,
libelle varchar(128) NOT NULL UNIQUE
);
-- SCIENTIFIQUE
CREATE TABLE Scientifique(
id SERIAL PRIMARY KEY,
nom varchar(128) NOT NULL,
prenom varchar(128) NOT NULL,
photo varchar(512) NOT NULL,
dateNaissance date NOT NULL,
descriptif text NOT NULL,
ratioTrouvee numeric(5,4),
sexe char(1) NOT NULL CHECK(sexe IN ('F', 'H')),
idThematique integer REFERENCES Thematique(id),
idDifficulte integer REFERENCES Difficulte(id)
);
-- INDICE
CREATE TABLE Indice(
id SERIAL PRIMARY KEY,
libelle varchar(512) NOT NULL,
idScientifique integer REFERENCES Scientifique(id)
);
-- QUESTION
CREATE TABLE Question(
id SERIAL PRIMARY KEY,
question varchar(256) NOT NULL UNIQUE
);
-- REPONSE
CREATE TABLE Reponse(
id SERIAL PRIMARY KEY,
reponse varchar(255) NOT NULL,
idQuestion integer REFERENCES Question(id),
idScientifique integer REFERENCES Scientifique(id)
);
-- ADMIN
CREATE TABLE Admin(
id SERIAL PRIMARY KEY,
email varchar(255) NOT NULL UNIQUE,
password varchar(255) NOT NULL
);
-- Jeu
CREATE TABLE Jeu(
id SERIAL PRIMARY KEY,
nom varchar(128) NOT NULL UNIQUE,
nbrParties integer NOT NULL DEFAULT 0
);
-- Partie
CREATE TABLE Partie(
id SERIAL PRIMARY KEY,
codeInvitation varchar(5) NOT NULL UNIQUE,
idJeu integer REFERENCES Jeu(id)
);
-- JOUEUR
CREATE TABLE Joueur(
id SERIAL PRIMARY KEY,
idPartie integer REFERENCES Partie(id),
pseudo varchar(255) NOT NULL UNIQUE
);
-- Invite
CREATE TABLE Invite(
idJoueur integer PRIMARY KEY REFERENCES Joueur(id)
);
-- Utilisateur
CREATE TABLE Utilisateur(
idJoueur integer PRIMARY KEY REFERENCES Joueur(id),
email varchar(255) NOT NULL UNIQUE,
password varchar(255) NOT NULL
);
-- Decouvrir
CREATE TABLE Decouvrir(
idUtilisateur integer REFERENCES Utilisateur(idJoueur),
idScientifique integer REFERENCES Scientifique(id),
PRIMARY KEY (idUtilisateur, idScientifique)
);
-- INSERTS
-- Scientifiques
INSERT INTO Difficulte(libelle) VALUES ('Facile'),('Intermédiaire'),('Difficile');
INSERT INTO Thematique(libelle) VALUES ('Nucléaire'),('Mathématiques');
INSERT INTO Scientifique(nom, prenom, photo, dateNaissance, descriptif, ratioTrouvee, idThematique, idDifficulte, sexe)
VALUES
('Marie', 'Curie', '', CURRENT_DATE, 'desc', 0.50, 1, 1, 'F'),
('Albert', 'Einstein', '', CURRENT_DATE, 'desc', 0.7540, 2, 1, 'H'),
('Sophie', 'Germain', '', CURRENT_DATE, 'desc', 0.1432, 2, 2, 'F');
-- Jeu
INSERT INTO Jeu(nom) VALUES ('Qui-est-ce ?'),('Science Quizz'), ('Pendu');
-- Questions
INSERT INTO Question(question)
VALUES
('Qui a reçu le prix Nobel de chimie en 1911, pour avoir réussi à isoler un gramme de radium ?'),
('Quel mathématicien a dit : « Dieu existe, cest les mathématiques » ?'),
('Quel mathématicienne utilisa comme nom d"emprunt « Antoine Auguste Le Blanc » ?');
-- Indices
INSERT INTO Indice (libelle, idscientifique) VALUES
('Indice pour aider', 1),
('S''appelle Marie', 1);
-- Réponses
INSERT INTO Reponse(reponse, idQuestion, idScientifique)
VALUES
('Marie Curie', 1, 1),
('Albert Einstein', 2, 2),
('Sophie Germain', 3, 3);
-- Utilisateurs
INSERT INTO Joueur(pseudo) VALUES ('moi, le meilleur joueur du monde'); --id = 1
INSERT INTO Utilisateur(idJoueur,email,password) VALUES (1, 'joueur','$2y$10$juGnlWC9cS19popEKLZsYeir0Jl39k6hDl0dpaCix00FDcdiEbtmS');
-- mdp = test
-- Découvrir
INSERT INTO decouvrir(idUtilisateur,idScientifique) VALUES (1,1);
-- Admin
INSERT INTO Admin(id,email,password) VALUES (1, 'admin','$2y$10$juGnlWC9cS19popEKLZsYeir0Jl39k6hDl0dpaCix00FDcdiEbtmS');
-- mdp = test
-- Partie
INSERT INTO Partie(codeInvitation, idJeu) VALUES ('abcde', 1);

Before

Width:  |  Height:  |  Size: 159 KiB

After

Width:  |  Height:  |  Size: 159 KiB

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

@ -1,3 +1,26 @@
# Neutral # Science Quest
Mise en situation d'une entreprise fictive établissant un lien avec un Product Owner (PO) ayant pour but de réaliser son projet durant 100 heures dédiées tout au long de l'année. ## Accés rapide
- ### [Android](https://codefirst.iut.uca.fr/git/tom.biard/ScienceQuest/src/branch/Android/android)
- ### [API](https://codefirst.iut.uca.fr/git/tom.biard/ScienceQuest/src/branch/Springboot/SpringBootProject/)
- ### [Site Internet](https://codefirst.iut.uca.fr/git/tom.biard/ScienceQuest/src/branch/front/science-quest)
- ### [Documents](https://codefirst.iut.uca.fr/git/tom.biard/ScienceQuest/src/branch/master/Documentation)
## Description
Dans le cadre de lapprentissage au sein du BUT Informatique de Clermont-Ferrand, un projet est établi tout au long de lannée afin de mettre en place une simulation dentreprise gérée par les étudiants. Il répond à un besoin établi par un client, un professeur de lIUT, ici **Mme Anaïs Durand** dans le rôle du Product Owner, tout cela encadré par notre tutrice de projet **Mme Audrey Pouclet**.
Le projet repose sur la création dun **site internet ayant pour but premier de faire découvrir des personnalités scientifiques féminines peu connues à travers des activités vidéoludiques** sous forme de mini-jeux, seul où à plusieurs, destinées aux enfants.
Les mini-jeux retenus sont les suivants:
- **Quizz (style Kahoot)** Des questions sont posées aux participants et ceux-ci doivent choisir une des 4 réponses proposées dans le temps imparti. Si la réponse est bonne le joueur gagne des points, le joueur ayant le plus de points gagne la partie !
- **Pendu (jeu solo)**
Le système tire un scientifique au hasard selon les paramètres de la partie.
Le joueur voit alors une photo du scientifique en plus de plusieurs indices (tel que sa nationalité ou encore sa date de naissance).
A partir de ces informations le joueur devra retrouver le nom du scientifique sous la forme dun pendu

@ -1,4 +0,0 @@
vendor/
composer.lock
js/bootstrap*.js*
css/bootstrap*.css*

@ -1,3 +0,0 @@
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]

@ -1,22 +0,0 @@
{
"autoload": {
"psr-4": {
"controller\\": "controller/",
"config\\": "config/",
"model\\": ["model/", "model/mdl/", "model/gateways/", "model/metier/", "model/exception/"]
}
},
"require": {
"altorouter/altorouter": "^2.0",
"twig/twig": "^3.7",
"twbs/bootstrap": "^5.3"
},
"scripts": {
"post-update-cmd": [
"rm -f ./js/bootstrap*.js*",
"rm -f ./css/bootstrap*.css*",
"cp ./vendor/twbs/bootstrap/dist/js/* ./js/",
"cp ./vendor/twbs/bootstrap/dist/css/* ./css/"
]
}
}

@ -1,365 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "8ac61264e1d011c0b663d8c3dbdfc99f",
"packages": [
{
"name": "altorouter/altorouter",
"version": "2.0.2",
"source": {
"type": "git",
"url": "https://github.com/dannyvankooten/AltoRouter.git",
"reference": "f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dannyvankooten/AltoRouter/zipball/f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2",
"reference": "f6fede4f94ced7c22ba63a9b8af0bf2dc38e3cb2",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
},
"require-dev": {
"codeclimate/php-test-reporter": "dev-master",
"phpunit/phpunit": "5.7.*",
"squizlabs/php_codesniffer": "3.4.2"
},
"type": "library",
"autoload": {
"classmap": [
"AltoRouter.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Danny van Kooten",
"email": "dannyvankooten@gmail.com",
"homepage": "http://dannyvankooten.com/"
},
{
"name": "Koen Punt",
"homepage": "https://github.com/koenpunt"
},
{
"name": "niahoo",
"homepage": "https://github.com/niahoo"
}
],
"description": "A lightning fast router for PHP",
"homepage": "https://github.com/dannyvankooten/AltoRouter",
"keywords": [
"lightweight",
"router",
"routing"
],
"support": {
"issues": "https://github.com/dannyvankooten/AltoRouter/issues",
"source": "https://github.com/dannyvankooten/AltoRouter/tree/2.0.2"
},
"time": "2020-03-09T08:34:59+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.28.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-ctype": "*"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.28-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2023-01-26T09:26:14+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.28.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "42292d99c55abe617799667f454222c54c60e229"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229",
"reference": "42292d99c55abe617799667f454222c54c60e229",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-mbstring": "*"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.28-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2023-07-28T09:04:16+00:00"
},
{
"name": "twbs/bootstrap",
"version": "v5.3.2",
"source": {
"type": "git",
"url": "https://github.com/twbs/bootstrap.git",
"reference": "344e912d04b5b6a04482113eff20ab416ff01048"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twbs/bootstrap/zipball/344e912d04b5b6a04482113eff20ab416ff01048",
"reference": "344e912d04b5b6a04482113eff20ab416ff01048",
"shasum": ""
},
"replace": {
"twitter/bootstrap": "self.version"
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Otto",
"email": "markdotto@gmail.com"
},
{
"name": "Jacob Thornton",
"email": "jacobthornton@gmail.com"
}
],
"description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
"homepage": "https://getbootstrap.com/",
"keywords": [
"JS",
"css",
"framework",
"front-end",
"mobile-first",
"responsive",
"sass",
"web"
],
"support": {
"issues": "https://github.com/twbs/bootstrap/issues",
"source": "https://github.com/twbs/bootstrap/tree/v5.3.2"
},
"time": "2023-09-14T14:19:27+00:00"
},
{
"name": "twig/twig",
"version": "v3.7.1",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "a0ce373a0ca3bf6c64b9e3e2124aca502ba39554"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/a0ce373a0ca3bf6c64b9e3e2124aca502ba39554",
"reference": "a0ce373a0ca3bf6c64b9e3e2124aca502ba39554",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-ctype": "^1.8",
"symfony/polyfill-mbstring": "^1.3"
},
"require-dev": {
"psr/container": "^1.0|^2.0",
"symfony/phpunit-bridge": "^5.4.9|^6.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Twig\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Twig Team",
"role": "Contributors"
},
{
"name": "Armin Ronacher",
"email": "armin.ronacher@active-4.com",
"role": "Project Founder"
}
],
"description": "Twig, the flexible, fast, and secure template language for PHP",
"homepage": "https://twig.symfony.com",
"keywords": [
"templating"
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.7.1"
},
"funding": [
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
"type": "tidelift"
}
],
"time": "2023-08-28T11:09:02+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.6.0"
}

Binary file not shown.

@ -1,86 +0,0 @@
<?php
namespace config;
use model\ValidationException;
class Validation
{
public static function val_action($action)
{
if (!isset($action)) {
throw new ValidationException('pas d\'action');
}
}
public static function val_form(string &$jeu, string &$difficulty, &$dVueErreur)
{
if ($jeu == '' || !filter_var($jeu, FILTER_SANITIZE_STRING)) {
$dVueErreur[] = 'Aucun jeu selectionné';
$jeu = 0;
throw new ValidationException("Erreur jeu");
}
if ($difficulty == '' || !filter_var($difficulty, FILTER_VALIDATE_INT)) {
$dVueErreur[] = "Aucune difficultée séléctionnée";
$difficulty = 0;
throw new ValidationException("Erreur difficulté");
}
}
public static function valUserLogin(string &$user, &$dVueErreur)
{
if ($user == '' || !filter_var($user, FILTER_SANITIZE_STRING)) {
$dVueErreur[] = 'Identifiant invalide';
$jeu = 0;
throw new ValidationException("Erreur identifiant");
}
}
public static function valCodeInvitation(string &$codeInvitation, &$dVueErreur){
if($codeInvitation == ''){
$dVueErreur[] = 'Code d\'invitation invalide';
throw new ValidationException("Code d'invitation invalide");
}
return htmlspecialchars($codeInvitation);
}
public static function valPseudo(string &$pseudo, &$dVueErreur){
$pseudo = trim($pseudo);
$pseudo = htmlspecialchars($pseudo);
$pseudo = filter_var($pseudo, FILTER_UNSAFE_RAW);
if($pseudo == '' ){
$dVueErreur[] = 'Pseudo invalide';
throw new ValidationException("Pseudo invalide");
}
return $pseudo;
}
public static function valRole(&$role, &$dVueErreur){
if(! $role instanceof \model\Joueur){
$role = NULL;
$dVueErreur[] = 'Role invalide';
throw new ValidationException('Role invalide');
}
return $role;
}
public static function valConfigurationJeu(&$configurationJeu, &$dVueErreur){
if(! $configurationJeu instanceof \model\ConfigurationJeu){
$role = NULL;
$dVueErreur[] = 'Configuration du jeu invalide';
throw new ValidationException('Configuration du jeu');
}
return $configurationJeu;
}
public static function valMdlPendu(&$pendu, &$dVueErreur){
if(! $pendu instanceof \model\MdlPendu){
$role = NULL;
$dVueErreur[] = 'Erreur mauvais jeu en utilisation';
throw new ValidationException('Erreur mauvais jeu en utilisation');
}
return $pendu;
}
}

@ -1,10 +0,0 @@
<?php
namespace config;
$config = [
"rep" => __DIR__.'/../',
"db" => ["dsn" => 'pgsql:host=localhost;dbname=dbrebeuret',
"login" => 'rebeuret',
"mdp" => 'achanger']
];

@ -1,59 +0,0 @@
<?php
namespace controller;
use Exception;
//gerer la connexion des admins
class AdminController {
public function __construct(string $action){
global $twig;
//on initialise un tableau d'erreur pour etre utilisé par la vue erreur
$dVueEreur = [];
//verifier si l'utilisateur est connecté et admin
if(isset($_SESSION["isAdmin"])){
if($_SESSION["isAdmin"]==true){
//donner la page admin a l'admin
try {
switch($action) {
case '':
echo "accueil admin";exit;
// echo $twig->render('admin/accueil.html');
break;
case 'stats':
echo "stats admin";exit;
// echo $twig->render('admin/stats.html');
break;
case 'ajouterScientifiques':
echo "page ajout scientifiques admin";exit;
// echo $twig->render('admin/ajouter.html');
break;
//mauvaise action
default:
$dVueErreur[] = "Erreur d'appel php";
echo $twig->render('accueil.html', ['dVueErreur' => $dVueErreur]);
break;
}
} catch (\PDOException $e) {
$dVueErreur[] = 'Erreur avec la base de données !';
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
} catch (\Exception $e2) {
$dVueErreur[] = 'Erreur inattendue !';
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
}
}
}
//verifier si l'utilisateur est connecté mais pas admin
if(isset($_SESSION["isLogged"])){
if($_SESSION["isLogged"]==true) {
//dire acces interdit au non admins
array_push($dVueEreur, "Erreur 403 : Acces interdit");
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
exit(0);
}
}
//renvoyer a la page de connexion pour les non connectés
echo $twig->render('login.html');
exit(0);
}
}
?>

@ -1,129 +0,0 @@
<?php
namespace controller;
use config\Validation;
use http\Params;
use model\Connection;
use model\LoginException;
use model\MdlAdmin;
use model\MdlUser;
class FrontController
{
private Connection $con;
public function __construct()
{
global $twig, $router;
global $basePath;
//altorouter
$router = new \AltoRouter();
$router->setBasePath($basePath);
$router->map('GET|POST','/[a:action]?','UserController');
$router->map('GET|POST','/admin/[a:action]','AdminController');
$router->map('GET|POST', '/validationFormulaire', 'validationFormulaire');
$router->map('GET|POST', '/logout', 'disconnect');
// Tableau qui contient les messages d'erreur
$dVueErreur = [];
$dVue = [];
$dVue['basePath'] = $basePath;
session_start();
if(isset($_SESSION['pseudo']))
$dVue['pseudo'] = $_SESSION['pseudo'];
try {
$match = $router->match();
if (!$match) {
throw new \Exception('Wrong call');
}
switch($match['target']) {
case 'UserController':
$this->callController('UserController',$match);
break;
case 'AdminController':
$action = $match['params']['action'];
if (!MdlAdmin::isAdmin()) {
$action = 'login';
}
$this->callController('AdminController',$action);
case 'PseudoController':
$this->callController('PseudoController',$match);
break;
case 'validationFormulaire':
$this->ValidationFormulaire($dVueErreur, $dVue);
break;
//mauvaise action
default:
$dVueErreur[] = "Erreur d'appel php";
echo $twig->render('accueil.html', ['dVueErreur' => $dVueErreur]);
break;
}
} catch (\PDOException $e) {
$dVueErreur[] = 'Erreur avec la base de données !';
$dVueErreur[] = $e->getMessage();
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
} catch (LoginException $e) {
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
echo $twig->render('login.html');
} catch (\Exception $e2) {
$dVueErreur[] = 'Erreur inattendue !'.$e2->getMessage();
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
}
exit(0);
}
private function callController(string $cont, array $match) {
global $twig;
$controller = '\\controller\\'.$cont;
$controller = new $controller;
$action = $match['params']['action'] ?? 'accueil';
if (is_callable(array($controller,$action))) {
call_user_func_array(array($controller,$action),array($match['params']));
} else {
echo $twig->render('erreur.html', ['dVueErreur' => array('Page inconnue')]);
}
}
public function ValidationFormulaire(array &$dVueErreur, array &$dVue)
{
global $twig;
$id_jeu = $_POST['jeu'] ?? '';
$id_difficulte = $_POST['difficulte'] ?? '';
try{
\config\Validation::val_form($id_jeu, $id_difficulte, $dVueErreur);
}catch (\model\ValidationException $ex){
$this->CreateParty($dVueErreur);
}catch (\Exception $ex){
$this->CreateParty($dVueErreur);
}
if(count($dVueErreur) == 0){
$jeu = (new \model\MdlJeu())->getFromId($id_jeu);
$difficulte = (new \model\MdlDifficulte())->getFromId($id_difficulte);
$_SESSION['configuration'] = new \model\ConfigurationJeu($jeu, $difficulte);
header("Location: /pseudo");
#echo $twig->render('accueil.html', ['dVue' => $dVue, 'dVueErreur' => $dVueErreur]);
}else{
$this->CreateParty($dVueErreur);
}
}
}

@ -1,40 +0,0 @@
<?php
namespace controller;
use config\Validation;
use Exception;
use model\ValidationException;
class JouerController{
public function __construct(){
global $twig, $config;
$dVue = [];
$dVueErreur = [];
if(isset($_SESSION["configuration"]) && isset($_SESSION['role'])){
try{
$role = $_SESSION['role'];
$role = Validation::valRole($role, $dVueErreur);
$configurationJeu = $_SESSION['configuration'];
$configurationJeu = Validation::valConfigurationJeu($configurationJeu, $dVueErreur);
}catch(ValidationException $e){
header('Location: .');
}
if(count($dVueErreur) == 0){
$idJeu = $configurationJeu->getJeu()->getId();
switch($idJeu){
case 3:
new PenduController($role, $configurationJeu);
break;
default:
throw new Exception("Jeu non défini !");
break;
}
}
}else{
header("Location: .");
}
}
}

@ -1,86 +0,0 @@
<?php
namespace controller;
use model\ConfigurationJeu;
use model\Joueur;
use model\MdlPendu;
use model\MdlScientifique;
use config\Validation;
use model\ValidationException;
class PenduController{
private array $dVue;
private array $dVueErreur;
private MdlPendu $pendu;
public function __construct(Joueur $role, ConfigurationJeu $configJeu)
{
$this->dVue = [];
$this->dVueErreur = [];
if(isset($_SESSION['pendu']) && Validation::valMdlPendu($_SESSION['pendu'], $this->dVueErreur)){
$this->pendu = $_SESSION['pendu'];
}else{
$this->reinit();
}
if(isset($_POST['lettre'])){
try{
$this->pendu->jouerLettre($_POST['lettre']);
}catch (ValidationException $e){
$this->dVueErreur[] = $e->getMessage();
}
}
if($this->pendu->aGagne()){
$this->renderAgagne();
}elseif($this->pendu->aPerdu()){
$this->renderAPerdu();
}else{
$this->renderJeu();
}
}
private function reinit(){
$mdlScientifique = new MdlScientifique();
$scientifique = $mdlScientifique->getRandom();
$this->pendu = new MdlPendu($scientifique);
$_SESSION['pendu'] = $this->pendu;
}
private function renderJeu(){
global $twig, $config;
$this->dVue['decouvert'] = $this->pendu->getDecouvert();
$this->dVue['essaisRestant'] = $this->pendu->getEssaisRestant();
$lettreUtilisees = $this->pendu->getLettreUtilisees();
sort($lettreUtilisees);
$this->dVue['lettresUtilisees'] = $lettreUtilisees;
echo $twig->render($config['templates']['pendu'], ['dVue' => $this->dVue, 'dVueErreur'=>$this->dVueErreur]);
}
private function renderAgagne(){
$this->dVue['messageScore'] = "Vous avez gagné !";
$this->renderScore();
}
private function renderAPerdu(){
$this->dVue['messageScore'] = "Vous avez perdu !";
$this->renderScore();
}
private function renderScore(){
global $twig, $config;
$this->dVue['nbTours'] = $this->pendu->getNbTours();
$this->dVue['nbFails'] = $this->pendu->getNbFails();
$scientifique = $this->pendu->getScientifique();
$dScientifique = [];
$dScientifique['nom'] = $scientifique->getNom();
$dScientifique['prenom'] = $scientifique->getPrenom();
$dScientifique['sexe'] = $scientifique->getSexe()->getLibelle();
$dScientifique['thematique'] = $scientifique->getThematique()->getLibelle();
$dScientifique['dateNaiss'] = $scientifique->getDateNaiss()->format('d/m/Y');
$this->dVue['scientifique'] = $dScientifique;
unset($_SESSION['pendu']);
echo $twig->render($config['templates']['penduScore'], ["dVue" => $this->dVue]);
}
}

@ -1,43 +0,0 @@
<?php
namespace controller;
use config\Validation;
use model\IdSessionDoubleException;
use model\PseudoDejaPrisException;
use model\ValidationException;
use model\MdlInvite;
class PseudoController{
public function __construct(){
global $twig, $config;
$dVue = [];
$dVueErreur = [];
if(isset($_POST["pseudo"])){
try{
$mdlInvite = new MdlInvite();
$pseudo = $_POST["pseudo"];
$pseudo = Validation::valPseudo($pseudo, $dVueErreur);
$role = $mdlInvite->insertInvite($pseudo, session_id());
}catch(ValidationException $e){
}catch(PseudoDejaPrisException $e){
$dVueErreur[] = "Pseudo déjà pris";
}catch(IdSessionDoubleException $e){
try{
$role = $mdlInvite->setPseudo($e->getIdJoueur(), $pseudo);
}catch(PseudoDejaPrisException $e){
$dVueErreur[] = "Pseudo déjà pris";
}
}
if(isset($role)){
$_SESSION['role'] = $role;
header('Location: jouer');
}
}
echo $twig->render($config['templates']['pseudo'], ["dVue" => $dVue, "dVueErreur" => $dVueErreur]);
}
}

@ -1,79 +0,0 @@
<?php
namespace controller;
use config\Validation;
use model\Connection;
use model\GameGateway;
use model\ValidationException;
class UserController {
public function accueil(array $params) {
global $twig;
echo $twig->render('accueil.html');
}
public function joinParty(array $params) {
global $twig;
if(isset($_POST['codeInvitation'])){
$codeInvitation = $_POST['codeInvitation'];
Validation::valCodeInvitation($codeInvitation, $dVueErreur);
echo $twig->render('join.html');
}
}
public function jouer(array $params) {
global $twig, $config;
$dVue = [];
$dVueErreur = [];
if(isset($_SESSION["configuration"]) && isset($_SESSION['role'])){
try{
$role = $_SESSION['role'];
$role = Validation::valRole($role, $dVueErreur);
$configurationJeu = $_SESSION['configuration'];
$configurationJeu = Validation::valConfigurationJeu($configurationJeu, $dVueErreur);
}catch(ValidationException $e){
header('Location: .');
}
if(count($dVueErreur) == 0){
$idJeu = $configurationJeu->getJeu()->getId();
switch($idJeu){
case 3:
new PenduController($role, $configurationJeu);
break;
default:
throw new Exception("Jeu non défini !");
break;
}
}
}else{
header("Location: .");
}
}
public function createParty(array $params) : void
{
global $twig;
global $dVueErreur;
$listJeu = (new \model\MdlJeu())->getAll();
$listDifficulte = (new \model\MdlDifficulte())->getAll();
$dVueCreateJeu = [];
foreach($listJeu as $jeu){
$dVueCreateJeu[] = ['id' => $jeu->getId(), 'nom' => $jeu->getNom()];
}
$dVueCreateDifficulte = [];
foreach($listDifficulte as $difficulte){
$dVueCreateDifficulte[] = ['id' => $difficulte->getId(), 'libelle' => $difficulte->getLibelle()];
}
echo $twig->render('create.html', ["dVueErreur" => $dVueErreur, 'dVueCreate' => ["jeux" => $dVueCreateJeu, "difficultes" => $dVueCreateDifficulte]]);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,597 +0,0 @@
/*!
* Bootstrap Reboot v5.3.2 (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
:root,
[data-bs-theme=light] {
--bs-blue: #0d6efd;
--bs-indigo: #6610f2;
--bs-purple: #6f42c1;
--bs-pink: #d63384;
--bs-red: #dc3545;
--bs-orange: #fd7e14;
--bs-yellow: #ffc107;
--bs-green: #198754;
--bs-teal: #20c997;
--bs-cyan: #0dcaf0;
--bs-black: #000;
--bs-white: #fff;
--bs-gray: #6c757d;
--bs-gray-dark: #343a40;
--bs-gray-100: #f8f9fa;
--bs-gray-200: #e9ecef;
--bs-gray-300: #dee2e6;
--bs-gray-400: #ced4da;
--bs-gray-500: #adb5bd;
--bs-gray-600: #6c757d;
--bs-gray-700: #495057;
--bs-gray-800: #343a40;
--bs-gray-900: #212529;
--bs-primary: #0d6efd;
--bs-secondary: #6c757d;
--bs-success: #198754;
--bs-info: #0dcaf0;
--bs-warning: #ffc107;
--bs-danger: #dc3545;
--bs-light: #f8f9fa;
--bs-dark: #212529;
--bs-primary-rgb: 13, 110, 253;
--bs-secondary-rgb: 108, 117, 125;
--bs-success-rgb: 25, 135, 84;
--bs-info-rgb: 13, 202, 240;
--bs-warning-rgb: 255, 193, 7;
--bs-danger-rgb: 220, 53, 69;
--bs-light-rgb: 248, 249, 250;
--bs-dark-rgb: 33, 37, 41;
--bs-primary-text-emphasis: #052c65;
--bs-secondary-text-emphasis: #2b2f32;
--bs-success-text-emphasis: #0a3622;
--bs-info-text-emphasis: #055160;
--bs-warning-text-emphasis: #664d03;
--bs-danger-text-emphasis: #58151c;
--bs-light-text-emphasis: #495057;
--bs-dark-text-emphasis: #495057;
--bs-primary-bg-subtle: #cfe2ff;
--bs-secondary-bg-subtle: #e2e3e5;
--bs-success-bg-subtle: #d1e7dd;
--bs-info-bg-subtle: #cff4fc;
--bs-warning-bg-subtle: #fff3cd;
--bs-danger-bg-subtle: #f8d7da;
--bs-light-bg-subtle: #fcfcfd;
--bs-dark-bg-subtle: #ced4da;
--bs-primary-border-subtle: #9ec5fe;
--bs-secondary-border-subtle: #c4c8cb;
--bs-success-border-subtle: #a3cfbb;
--bs-info-border-subtle: #9eeaf9;
--bs-warning-border-subtle: #ffe69c;
--bs-danger-border-subtle: #f1aeb5;
--bs-light-border-subtle: #e9ecef;
--bs-dark-border-subtle: #adb5bd;
--bs-white-rgb: 255, 255, 255;
--bs-black-rgb: 0, 0, 0;
--bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
--bs-body-font-family: var(--bs-font-sans-serif);
--bs-body-font-size: 1rem;
--bs-body-font-weight: 400;
--bs-body-line-height: 1.5;
--bs-body-color: #212529;
--bs-body-color-rgb: 33, 37, 41;
--bs-body-bg: #fff;
--bs-body-bg-rgb: 255, 255, 255;
--bs-emphasis-color: #000;
--bs-emphasis-color-rgb: 0, 0, 0;
--bs-secondary-color: rgba(33, 37, 41, 0.75);
--bs-secondary-color-rgb: 33, 37, 41;
--bs-secondary-bg: #e9ecef;
--bs-secondary-bg-rgb: 233, 236, 239;
--bs-tertiary-color: rgba(33, 37, 41, 0.5);
--bs-tertiary-color-rgb: 33, 37, 41;
--bs-tertiary-bg: #f8f9fa;
--bs-tertiary-bg-rgb: 248, 249, 250;
--bs-heading-color: inherit;
--bs-link-color: #0d6efd;
--bs-link-color-rgb: 13, 110, 253;
--bs-link-decoration: underline;
--bs-link-hover-color: #0a58ca;
--bs-link-hover-color-rgb: 10, 88, 202;
--bs-code-color: #d63384;
--bs-highlight-color: #212529;
--bs-highlight-bg: #fff3cd;
--bs-border-width: 1px;
--bs-border-style: solid;
--bs-border-color: #dee2e6;
--bs-border-color-translucent: rgba(0, 0, 0, 0.175);
--bs-border-radius: 0.375rem;
--bs-border-radius-sm: 0.25rem;
--bs-border-radius-lg: 0.5rem;
--bs-border-radius-xl: 1rem;
--bs-border-radius-xxl: 2rem;
--bs-border-radius-2xl: var(--bs-border-radius-xxl);
--bs-border-radius-pill: 50rem;
--bs-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
--bs-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
--bs-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
--bs-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075);
--bs-focus-ring-width: 0.25rem;
--bs-focus-ring-opacity: 0.25;
--bs-focus-ring-color: rgba(13, 110, 253, 0.25);
--bs-form-valid-color: #198754;
--bs-form-valid-border-color: #198754;
--bs-form-invalid-color: #dc3545;
--bs-form-invalid-border-color: #dc3545;
}
[data-bs-theme=dark] {
color-scheme: dark;
--bs-body-color: #dee2e6;
--bs-body-color-rgb: 222, 226, 230;
--bs-body-bg: #212529;
--bs-body-bg-rgb: 33, 37, 41;
--bs-emphasis-color: #fff;
--bs-emphasis-color-rgb: 255, 255, 255;
--bs-secondary-color: rgba(222, 226, 230, 0.75);
--bs-secondary-color-rgb: 222, 226, 230;
--bs-secondary-bg: #343a40;
--bs-secondary-bg-rgb: 52, 58, 64;
--bs-tertiary-color: rgba(222, 226, 230, 0.5);
--bs-tertiary-color-rgb: 222, 226, 230;
--bs-tertiary-bg: #2b3035;
--bs-tertiary-bg-rgb: 43, 48, 53;
--bs-primary-text-emphasis: #6ea8fe;
--bs-secondary-text-emphasis: #a7acb1;
--bs-success-text-emphasis: #75b798;
--bs-info-text-emphasis: #6edff6;
--bs-warning-text-emphasis: #ffda6a;
--bs-danger-text-emphasis: #ea868f;
--bs-light-text-emphasis: #f8f9fa;
--bs-dark-text-emphasis: #dee2e6;
--bs-primary-bg-subtle: #031633;
--bs-secondary-bg-subtle: #161719;
--bs-success-bg-subtle: #051b11;
--bs-info-bg-subtle: #032830;
--bs-warning-bg-subtle: #332701;
--bs-danger-bg-subtle: #2c0b0e;
--bs-light-bg-subtle: #343a40;
--bs-dark-bg-subtle: #1a1d20;
--bs-primary-border-subtle: #084298;
--bs-secondary-border-subtle: #41464b;
--bs-success-border-subtle: #0f5132;
--bs-info-border-subtle: #087990;
--bs-warning-border-subtle: #997404;
--bs-danger-border-subtle: #842029;
--bs-light-border-subtle: #495057;
--bs-dark-border-subtle: #343a40;
--bs-heading-color: inherit;
--bs-link-color: #6ea8fe;
--bs-link-hover-color: #8bb9fe;
--bs-link-color-rgb: 110, 168, 254;
--bs-link-hover-color-rgb: 139, 185, 254;
--bs-code-color: #e685b5;
--bs-highlight-color: #dee2e6;
--bs-highlight-bg: #664d03;
--bs-border-color: #495057;
--bs-border-color-translucent: rgba(255, 255, 255, 0.15);
--bs-form-valid-color: #75b798;
--bs-form-valid-border-color: #75b798;
--bs-form-invalid-color: #ea868f;
--bs-form-invalid-border-color: #ea868f;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
border: 0;
border-top: var(--bs-border-width) solid;
opacity: 0.25;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
color: var(--bs-heading-color);
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-left: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.1875em;
color: var(--bs-highlight-color);
background-color: var(--bs-highlight-bg);
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1));
text-decoration: underline;
}
a:hover {
--bs-link-color-rgb: var(--bs-link-hover-color-rgb);
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: var(--bs-font-monospace);
font-size: 1em;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: var(--bs-code-color);
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.1875rem 0.375rem;
font-size: 0.875em;
color: var(--bs-body-bg);
background-color: var(--bs-body-color);
border-radius: 0.25rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: var(--bs-secondary-color);
text-align: left;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator {
display: none !important;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: left;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: left;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
-webkit-appearance: textfield;
outline-offset: -2px;
}
/* rtl:raw:
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
::file-selector-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,594 +0,0 @@
/*!
* Bootstrap Reboot v5.3.2 (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
:root,
[data-bs-theme=light] {
--bs-blue: #0d6efd;
--bs-indigo: #6610f2;
--bs-purple: #6f42c1;
--bs-pink: #d63384;
--bs-red: #dc3545;
--bs-orange: #fd7e14;
--bs-yellow: #ffc107;
--bs-green: #198754;
--bs-teal: #20c997;
--bs-cyan: #0dcaf0;
--bs-black: #000;
--bs-white: #fff;
--bs-gray: #6c757d;
--bs-gray-dark: #343a40;
--bs-gray-100: #f8f9fa;
--bs-gray-200: #e9ecef;
--bs-gray-300: #dee2e6;
--bs-gray-400: #ced4da;
--bs-gray-500: #adb5bd;
--bs-gray-600: #6c757d;
--bs-gray-700: #495057;
--bs-gray-800: #343a40;
--bs-gray-900: #212529;
--bs-primary: #0d6efd;
--bs-secondary: #6c757d;
--bs-success: #198754;
--bs-info: #0dcaf0;
--bs-warning: #ffc107;
--bs-danger: #dc3545;
--bs-light: #f8f9fa;
--bs-dark: #212529;
--bs-primary-rgb: 13, 110, 253;
--bs-secondary-rgb: 108, 117, 125;
--bs-success-rgb: 25, 135, 84;
--bs-info-rgb: 13, 202, 240;
--bs-warning-rgb: 255, 193, 7;
--bs-danger-rgb: 220, 53, 69;
--bs-light-rgb: 248, 249, 250;
--bs-dark-rgb: 33, 37, 41;
--bs-primary-text-emphasis: #052c65;
--bs-secondary-text-emphasis: #2b2f32;
--bs-success-text-emphasis: #0a3622;
--bs-info-text-emphasis: #055160;
--bs-warning-text-emphasis: #664d03;
--bs-danger-text-emphasis: #58151c;
--bs-light-text-emphasis: #495057;
--bs-dark-text-emphasis: #495057;
--bs-primary-bg-subtle: #cfe2ff;
--bs-secondary-bg-subtle: #e2e3e5;
--bs-success-bg-subtle: #d1e7dd;
--bs-info-bg-subtle: #cff4fc;
--bs-warning-bg-subtle: #fff3cd;
--bs-danger-bg-subtle: #f8d7da;
--bs-light-bg-subtle: #fcfcfd;
--bs-dark-bg-subtle: #ced4da;
--bs-primary-border-subtle: #9ec5fe;
--bs-secondary-border-subtle: #c4c8cb;
--bs-success-border-subtle: #a3cfbb;
--bs-info-border-subtle: #9eeaf9;
--bs-warning-border-subtle: #ffe69c;
--bs-danger-border-subtle: #f1aeb5;
--bs-light-border-subtle: #e9ecef;
--bs-dark-border-subtle: #adb5bd;
--bs-white-rgb: 255, 255, 255;
--bs-black-rgb: 0, 0, 0;
--bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
--bs-body-font-family: var(--bs-font-sans-serif);
--bs-body-font-size: 1rem;
--bs-body-font-weight: 400;
--bs-body-line-height: 1.5;
--bs-body-color: #212529;
--bs-body-color-rgb: 33, 37, 41;
--bs-body-bg: #fff;
--bs-body-bg-rgb: 255, 255, 255;
--bs-emphasis-color: #000;
--bs-emphasis-color-rgb: 0, 0, 0;
--bs-secondary-color: rgba(33, 37, 41, 0.75);
--bs-secondary-color-rgb: 33, 37, 41;
--bs-secondary-bg: #e9ecef;
--bs-secondary-bg-rgb: 233, 236, 239;
--bs-tertiary-color: rgba(33, 37, 41, 0.5);
--bs-tertiary-color-rgb: 33, 37, 41;
--bs-tertiary-bg: #f8f9fa;
--bs-tertiary-bg-rgb: 248, 249, 250;
--bs-heading-color: inherit;
--bs-link-color: #0d6efd;
--bs-link-color-rgb: 13, 110, 253;
--bs-link-decoration: underline;
--bs-link-hover-color: #0a58ca;
--bs-link-hover-color-rgb: 10, 88, 202;
--bs-code-color: #d63384;
--bs-highlight-color: #212529;
--bs-highlight-bg: #fff3cd;
--bs-border-width: 1px;
--bs-border-style: solid;
--bs-border-color: #dee2e6;
--bs-border-color-translucent: rgba(0, 0, 0, 0.175);
--bs-border-radius: 0.375rem;
--bs-border-radius-sm: 0.25rem;
--bs-border-radius-lg: 0.5rem;
--bs-border-radius-xl: 1rem;
--bs-border-radius-xxl: 2rem;
--bs-border-radius-2xl: var(--bs-border-radius-xxl);
--bs-border-radius-pill: 50rem;
--bs-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
--bs-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
--bs-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
--bs-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075);
--bs-focus-ring-width: 0.25rem;
--bs-focus-ring-opacity: 0.25;
--bs-focus-ring-color: rgba(13, 110, 253, 0.25);
--bs-form-valid-color: #198754;
--bs-form-valid-border-color: #198754;
--bs-form-invalid-color: #dc3545;
--bs-form-invalid-border-color: #dc3545;
}
[data-bs-theme=dark] {
color-scheme: dark;
--bs-body-color: #dee2e6;
--bs-body-color-rgb: 222, 226, 230;
--bs-body-bg: #212529;
--bs-body-bg-rgb: 33, 37, 41;
--bs-emphasis-color: #fff;
--bs-emphasis-color-rgb: 255, 255, 255;
--bs-secondary-color: rgba(222, 226, 230, 0.75);
--bs-secondary-color-rgb: 222, 226, 230;
--bs-secondary-bg: #343a40;
--bs-secondary-bg-rgb: 52, 58, 64;
--bs-tertiary-color: rgba(222, 226, 230, 0.5);
--bs-tertiary-color-rgb: 222, 226, 230;
--bs-tertiary-bg: #2b3035;
--bs-tertiary-bg-rgb: 43, 48, 53;
--bs-primary-text-emphasis: #6ea8fe;
--bs-secondary-text-emphasis: #a7acb1;
--bs-success-text-emphasis: #75b798;
--bs-info-text-emphasis: #6edff6;
--bs-warning-text-emphasis: #ffda6a;
--bs-danger-text-emphasis: #ea868f;
--bs-light-text-emphasis: #f8f9fa;
--bs-dark-text-emphasis: #dee2e6;
--bs-primary-bg-subtle: #031633;
--bs-secondary-bg-subtle: #161719;
--bs-success-bg-subtle: #051b11;
--bs-info-bg-subtle: #032830;
--bs-warning-bg-subtle: #332701;
--bs-danger-bg-subtle: #2c0b0e;
--bs-light-bg-subtle: #343a40;
--bs-dark-bg-subtle: #1a1d20;
--bs-primary-border-subtle: #084298;
--bs-secondary-border-subtle: #41464b;
--bs-success-border-subtle: #0f5132;
--bs-info-border-subtle: #087990;
--bs-warning-border-subtle: #997404;
--bs-danger-border-subtle: #842029;
--bs-light-border-subtle: #495057;
--bs-dark-border-subtle: #343a40;
--bs-heading-color: inherit;
--bs-link-color: #6ea8fe;
--bs-link-hover-color: #8bb9fe;
--bs-link-color-rgb: 110, 168, 254;
--bs-link-hover-color-rgb: 139, 185, 254;
--bs-code-color: #e685b5;
--bs-highlight-color: #dee2e6;
--bs-highlight-bg: #664d03;
--bs-border-color: #495057;
--bs-border-color-translucent: rgba(255, 255, 255, 0.15);
--bs-form-valid-color: #75b798;
--bs-form-valid-border-color: #75b798;
--bs-form-invalid-color: #ea868f;
--bs-form-invalid-border-color: #ea868f;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
border: 0;
border-top: var(--bs-border-width) solid;
opacity: 0.25;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
color: var(--bs-heading-color);
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-right: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-right: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.1875em;
color: var(--bs-highlight-color);
background-color: var(--bs-highlight-bg);
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1));
text-decoration: underline;
}
a:hover {
--bs-link-color-rgb: var(--bs-link-hover-color-rgb);
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: var(--bs-font-monospace);
font-size: 1em;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: var(--bs-code-color);
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.1875rem 0.375rem;
font-size: 0.875em;
color: var(--bs-body-bg);
background-color: var(--bs-body-color);
border-radius: 0.25rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: var(--bs-secondary-color);
text-align: right;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator {
display: none !important;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: right;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: right;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
-webkit-appearance: textfield;
outline-offset: -2px;
}
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
::file-selector-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.rtl.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,182 +0,0 @@
-- Testé sous pgsql 15
DROP TABLE IF EXISTS Reponse;
DROP TABLE IF EXISTS Question;
DROP TABLE IF EXISTS Admin;
DROP TABLE IF EXISTS Partie;
DROP TABLE IF EXISTS Jeu;
DROP TABLE IF EXISTS Decouvrir;
DROP TABLE IF EXISTS Utilisateur;
DROP TABLE IF EXISTS Invite;
DROP TABLE IF EXISTS Joueur;
DROP TABLE IF EXISTS Indice;
DROP TABLE IF EXISTS Scientifique;
DROP TABLE IF EXISTS Thematique;
DROP TABLE IF EXISTS Difficulte;
DROP TABLE IF EXISTS Sexe;
-- THEMATIQUE
CREATE TABLE Thematique(
id SERIAL PRIMARY KEY,
libelle varchar(128) NOT NULL UNIQUE
);
-- DIFFICULTE
CREATE TABLE Difficulte(
id SERIAL PRIMARY KEY,
libelle varchar(128) NOT NULL UNIQUE
);
-- SEXE
CREATE TABLE Sexe(
id SERIAL PRIMARY KEY,
libelle varchar(128) NOT NULL UNIQUE
);
-- SCIENTIFIQUE
CREATE TABLE Scientifique(
id SERIAL PRIMARY KEY,
nom varchar(128) NOT NULL,
prenom varchar(128) NOT NULL,
photo varchar(512) NOT NULL,
dateNaissance date NOT NULL,
descriptif text NOT NULL,
ratioTrouvee numeric(5,4),
idThematique integer REFERENCES Thematique(id),
idDifficulte integer REFERENCES Difficulte(id),
idSexe integer REFERENCES Sexe(id)
);
-- INDICE
CREATE TABLE Indice(
id SERIAL PRIMARY KEY,
libelle varchar(512) NOT NULL UNIQUE,
idScientifique integer REFERENCES Scientifique(id)
);
-- QUESTION
CREATE TABLE Question(
id SERIAL PRIMARY KEY,
question varchar(256) NOT NULL UNIQUE
);
-- REPONSE
CREATE TABLE Reponse(
id SERIAL PRIMARY KEY,
reponse varchar(255) NOT NULL,
idQuestion integer REFERENCES Question(id),
idScientifique integer REFERENCES Scientifique(id)
);
-- ADMIN
CREATE TABLE Admin(
id SERIAL PRIMARY KEY,
email varchar(255) NOT NULL UNIQUE,
password varchar(255) NOT NULL
);
-- JOUEUR
CREATE TABLE Joueur(
id SERIAL PRIMARY KEY,
pseudo varchar(255) NOT NULL UNIQUE
);
-- Invite
CREATE TABLE Invite(
idJoueur integer PRIMARY KEY REFERENCES Joueur(id),
idSession varchar(255) NOT NULL UNIQUE
);
-- Utilisateur
CREATE TABLE Utilisateur(
idJoueur integer PRIMARY KEY REFERENCES Joueur(id),
email varchar(255) NOT NULL UNIQUE,
password varchar(255) NOT NULL
);
-- Decouvrir
CREATE TABLE Decouvrir(
idUtilisateur integer REFERENCES Utilisateur(idJoueur),
idScientifique integer REFERENCES Scientifique(id),
PRIMARY KEY (idUtilisateur, idScientifique)
);
-- Jeu
CREATE TABLE Jeu(
id SERIAL PRIMARY KEY,
nom varchar(128) NOT NULL UNIQUE,
nbrParties integer NOT NULL DEFAULT 0
);
-- Partie
CREATE TABLE Partie(
id SERIAL PRIMARY KEY,
codeInvitation varchar(10) NOT NULL UNIQUE,
idJoueur integer REFERENCES Joueur(id),
idJeu integer REFERENCES Jeu(id)
);
-- INSERTS
INSERT INTO Jeu(nom) VALUES ('Qui-est-ce ?'),('Kahoot'), ('Pendu');
INSERT INTO Difficulte(libelle) VALUES ('Facile'),('Intermédiaire'),('Difficile');
INSERT INTO Sexe(libelle) VALUES ('Homme'),('Femme');
INSERT INTO Thematique(libelle) VALUES ('Nucléaire'),('Mathématiques');
INSERT INTO Scientifique(nom, prenom, photo, dateNaissance, descriptif, ratioTrouvee, idThematique, idDifficulte, idSexe)
VALUES
('nomToto', 'prenomToto', '', CURRENT_DATE, 'desc', 0, 1, 1, 1),
('nomTiti', 'prenomTiti', '', CURRENT_DATE, 'desc', 0, 2, 2, 2);
INSERT INTO Joueur(id,pseudo) VALUES (1337, 'moi, le meilleur joueur du monde');
INSERT INTO Utilisateur(idJoueur,email,password) VALUES (1337, 'joueur','$2y$10$juGnlWC9cS19popEKLZsYeir0Jl39k6hDl0dpaCix00FDcdiEbtmS');
-- mdp = test
INSERT INTO Admin(id,email,password) VALUES (1, 'admin','$2y$10$juGnlWC9cS19popEKLZsYeir0Jl39k6hDl0dpaCix00FDcdiEbtmS');
-- mdp = test

@ -1,18 +0,0 @@
<?php
require_once(__DIR__.'/vendor/autoload.php');
require_once(__DIR__.'/config/config.php');
use controller\FrontController;
//twig
$loader = new \Twig\Loader\FilesystemLoader('templates');
$twig = new \Twig\Environment($loader, [
'cache' => false,
]);
$dVueErreur = array();
$basePath = preg_replace('/\/index.php/i', '', $_SERVER['PHP_SELF']);
$cont = new FrontController();

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,24 +0,0 @@
<?php
namespace model;
class IdSessionDoubleException extends \RuntimeException
{
private int $idJoueur;
private string $idSession;
public function __construct($idJoueur, $idSession)
{
parent::__construct();
$this->idJoueur=$idJoueur;
$this->idSession=$idSession;
}
public function getIdJoueur():int{
return $this->idJoueur;
}
public function getIdSession(): string{
return $this->idSession;
}
}

@ -1,7 +0,0 @@
<?php
namespace model;
class LoginException extends \Exception
{
}

@ -1,8 +0,0 @@
<?php
namespace model;
class PseudoDejaPrisException extends \RuntimeException
{
}

@ -1,5 +0,0 @@
<?php
namespace model;
class ValidationException extends \RuntimeException{
}

@ -1,111 +0,0 @@
<?php
namespace model;
class AdminGateway
{
private \PDO $con;
private \PDOStatement $stmt;
public function __construct(Connection $con)
{
$this->con=$con;
}
public function login(string $email, string $password): bool
{
$sql = "SELECT * FROM Admin WHERE email=:email";
$this->con->executeQuery($sql, array(
':email' => array($email, \PDO::PARAM_STR)
));
$result = $this->con->getOneResult();
if (!empty($result)) {
return password_verify($password,$result['password']);
}
return false;
}
public function addUser(string $email, string $password): void
{
$sql = "INSERT INTO Admin (email, password) VALUES (:email, :password)";
$stmt = $this->con->prepare($sql);
$stmt->bindValue(':email', $email);
$stmt->bindValue(':password', password_hash($password, PASSWORD_DEFAULT));
$stmt->execute();
}
public function deleteUser(int $id): void
{
$sql = "DELETE FROM Admin WHERE id=:id";
$stmt = $this->con->prepare($sql);
$stmt->bindValue(':id', $id);
$stmt->execute();
}
public function updateUser(int $id, string $email, string $password): void
{
$sql = "UPDATE Admin SET email=:email, password=:password WHERE id=:id";
$stmt = $this->con->prepare($sql);
$stmt->bindValue(':id', $id);
$stmt->bindValue(':email', $email);
$stmt->bindValue(':password', password_hash($password, PASSWORD_DEFAULT));
$stmt->execute();
}
public function getUser(int $id): User
{
$sql = "SELECT * FROM Admin WHERE id=:id";
$stmt = $this->con->prepare($sql);
$stmt->bindValue(':id', $id);
$stmt->execute();
$result = $stmt->fetch();
return new User($result['id'], $result['email'], $result['password']);
}
public function getUsers(): array
{
$sql = "SELECT * FROM Admin";
$stmt = $this->con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll();
$users = [];
foreach ($result as $user) {
$users[] = new User($user['id'], $user['email'], $user['password']);
}
return $users;
}
public function getHashedPasswordById(int $id): string
{
$sql = "SELECT password FROM Admin WHERE id=:id";
$stmt = $this->con->prepare($sql);
$stmt->bindValue(':id', $id);
$stmt->execute();
$result = $stmt->fetch();
return $result['password'];
}
public function getHashedPassword(int $email): string
{
$sql = "SELECT password FROM Admin WHERE email=:email";
$stmt = $this->con->prepare($sql);
$stmt->bindValue(':email', $email);
$stmt->execute();
$result = $stmt->fetch();
return $result['password'];
}
public function getUserId(string $email): int
{
$sql = "SELECT id FROM Admin WHERE email=:email";
$stmt = $this->con->prepare($sql);
$stmt->bindValue(':email', $email);
$stmt->execute();
$result = $stmt->fetch();
return $result['id'];
}
public function getUserByEmailAndPassword(string $email, string $password): User
{
$sql = "SELECT * FROM Admin WHERE email=:email AND password=:password";
$stmt = $this->con->prepare($sql);
$stmt->bindValue(':email', $email);
$stmt->bindValue(':password', password_hash($password, PASSWORD_DEFAULT));
$stmt->execute();
$result = $stmt->fetch();
return new User($result['id'], $result['email'], $result['password']);
}
}

@ -1,39 +0,0 @@
<?php
namespace model;
use PDO;
class Connection extends PDO {
private $stmt;
public function __construct(string $dsn, string $username, string $password) {
parent::__construct($dsn,$username,$password);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
/** * @param string $query
* @param array $parameters *
* @return bool Returns `true` on success, `false` otherwise
*/
public function executeQuery(string $query, array $parameters = []) : bool{
$this->stmt = parent::prepare($query);
foreach ($parameters as $name => $value) {
$this->stmt->bindValue($name, $value[0], $value[1]);
}
return $this->stmt->execute();
}
public function getResults() : array {
return $this->stmt->fetchall();
}
public function getOneResult() {
return $this->stmt->fetch();
}
}

@ -1,24 +0,0 @@
<?php
namespace model;
class DifficulteGateway
{
private $con;
function __construct(Connection $con) {
$this->con = $con;
}
public function getAll() : array
{
$this->con->executeQuery("SELECT id, libelle FROM Difficulte;");
return $this->con->getResults();
}
public function getFromId(int $id): array
{
$this->con->executeQuery("SELECT id, libelle FROM Difficulte WHERE id=:id;",
[':id' => [$id, $this->con::PARAM_INT]]);
return $this->con->getOneResult();
}
}

@ -1,28 +0,0 @@
<?php
namespace model;
class GameGateway
{
private $con;
function __construct(Connection $co) {
$this->con = $co;
}
public static function getGames() : array
{
// TODO: implémenter requête SQL
return array(
0 => ["Qui-est-ce ?", "Le qui est-ce...."],
1 => ["Kahoot", "Le Kahoot permet..."]
);
}
public function getGameByCode(int $code) : array {
$query = 'SELECT * FROM Partie WHERE codeInvitation=:id';
$this->con->executeQuery($query,array(
':id' => array($code,\PDO::PARAM_INT)
));
return $this->con->getResults();
}
}

@ -1,38 +0,0 @@
<?php
namespace model;
class InviteGateway extends JoueurGateway
{
function __construct(Connection $con) {
parent::__construct($con);
}
public function getFromIdSession($idSession): array|bool
{
$this->con->executeQuery("SELECT idJoueur, pseudo, idSession FROM Invite JOIN Joueur ON id=idJoueur WHERE idSession = :idSession;",
[":idSession" => [$idSession, $this->con::PARAM_STR]]);
return $this->con->getOneResult();
}
public function getFromId($id): array|bool
{
$this->con->executeQuery("SELECT idJoueur, pseudo, idSession FROM Invite JOIN Joueur ON id=idJoueur WHERE id = :id;",
[":id" => [$id, $this->con::PARAM_INT]]);
return $this->con->getOneResult();
}
public function insertInvite(string $pseudo, string $idSession): int{
$row = $this->getFromIdSession($idSession);
if($row != false){
throw new IdSessionDoubleException($row['idjoueur'], $row['idsession']);
}else{
$id = $this->insertJoueur($pseudo);
$this->con->executeQuery("INSERT INTO Invite(idJoueur, idSession) VALUES(:id, :idSession);",
[":id" => [$id, $this->con::PARAM_INT],
":idSession" => [$idSession, $this->con::PARAM_STR]]);
return $id;
}
}
}

@ -1,26 +0,0 @@
<?php
namespace model;
use PDO;
class JeuGateway
{
private $con;
function __construct(Connection $con) {
$this->con = $con;
}
public function getAll() : array
{
$this->con->executeQuery("SELECT id, nom, nbrparties FROM Jeu;");
return $this->con->getResults();
}
public function getFromId(int $id): array
{
$this->con->executeQuery("SELECT id, nom, nbrparties FROM Jeu WHERE id=:id;",
[':id' => [$id, $this->con::PARAM_INT]]);
return $this->con->getOneResult();
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save