|
|
|
@ -9,6 +9,8 @@ require_once __ROOT__.'/manager/repo/semestre.php';
|
|
|
|
|
// require_once __ROOT__.'/manager/repo/note.php';
|
|
|
|
|
debug();
|
|
|
|
|
|
|
|
|
|
class DBAccess{};
|
|
|
|
|
|
|
|
|
|
class DataBase{
|
|
|
|
|
|
|
|
|
|
/* ATTRIBUTS */
|
|
|
|
@ -17,7 +19,9 @@ class DataBase{
|
|
|
|
|
private $username;
|
|
|
|
|
private $password;
|
|
|
|
|
|
|
|
|
|
public $pdo;
|
|
|
|
|
private static $pdo;
|
|
|
|
|
|
|
|
|
|
private static $instance;
|
|
|
|
|
|
|
|
|
|
public function __construct($host, $dbname, $username, $password){
|
|
|
|
|
$this->host = $host;
|
|
|
|
@ -26,13 +30,22 @@ class DataBase{
|
|
|
|
|
$this->password = $password;
|
|
|
|
|
|
|
|
|
|
// password: Qt358nUdyeTxLDM8
|
|
|
|
|
$this->pdo = new PDO('mysql:host='.$host.';dbname='.$dbname, $username, $password);
|
|
|
|
|
DataBase::$pdo = new PDO('mysql:host='.$host.';dbname='.$dbname, $username, $password);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* retourne une instance de la classe */
|
|
|
|
|
public static function getInstance(){
|
|
|
|
|
return new DataBase("localhost", "sid2", "root", "");
|
|
|
|
|
if( DataBase::$instance == null )
|
|
|
|
|
DataBase::$instance = new DataBase("localhost", "sid2", "php", "Qt358nUdyeTxLDM8");
|
|
|
|
|
|
|
|
|
|
return DataBase::$instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* retourne la connection statique */
|
|
|
|
|
public static function getPDO(){
|
|
|
|
|
$instance = DataBase::getInstance();
|
|
|
|
|
return DataBase::$pdo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -69,7 +82,7 @@ class DataBase{
|
|
|
|
|
/*** création d'un utilisateur dans la bdd ***/
|
|
|
|
|
/*********************************************/
|
|
|
|
|
public function creerUtilisateur($identifiant, $prenom, $nom, $mail, $mdp, $droits){
|
|
|
|
|
$getLastCount = $this->pdo->query('SELECT count(identifiant) as count FROM utilisateur');
|
|
|
|
|
$getLastCount = DataBase::getPDO()->query('SELECT count(identifiant) as count FROM utilisateur');
|
|
|
|
|
$lastCount = (int) $getLastCount->fetch()['count'];
|
|
|
|
|
|
|
|
|
|
// on applique une normalisation
|
|
|
|
@ -78,7 +91,7 @@ class DataBase{
|
|
|
|
|
$mail = strtolower($mail); // email en minuscules
|
|
|
|
|
$mdp = sha1($mdp); // on hash le password
|
|
|
|
|
|
|
|
|
|
$req = $this->pdo->prepare("INSERT INTO utilisateur(identifiant, prenom, nom, mail, mdp, droits) VALUES(:identifiant, :prenom, :nom, :mail, :mdp, :droits)");
|
|
|
|
|
$req = DataBase::getPDO()->prepare("INSERT INTO utilisateur(identifiant, prenom, nom, mail, mdp, droits) VALUES(:identifiant, :prenom, :nom, :mail, :mdp, :droits)");
|
|
|
|
|
|
|
|
|
|
$req->execute(array(
|
|
|
|
|
':identifiant' => $identifiant,
|
|
|
|
@ -89,7 +102,7 @@ class DataBase{
|
|
|
|
|
':droits' => $droits
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$getNewCount = $this->pdo->query('SELECT count(identifiant) as count FROM utilisateur');
|
|
|
|
|
$getNewCount = DataBase::getPDO()->query('SELECT count(identifiant) as count FROM utilisateur');
|
|
|
|
|
$newCount = (int) $getNewCount->fetch()['count'];
|
|
|
|
|
|
|
|
|
|
if( $newCount > $lastCount ) // si on a bien ajouté un entrée
|
|
|
|
@ -108,7 +121,7 @@ class DataBase{
|
|
|
|
|
if( !($utilisateurUID=userRepo::UID($identifiant)) ) return 'unknown_user';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$getUtilisateurInfo = $this->pdo->prepare("SELECT identifiant, prenom, nom, mail, droits FROM utilisateur WHERE identifiant = :identifiant");
|
|
|
|
|
$getUtilisateurInfo = DataBase::getPDO()->prepare("SELECT identifiant, prenom, nom, mail, droits FROM utilisateur WHERE identifiant = :identifiant");
|
|
|
|
|
$getUtilisateurInfo->execute(array( ':identifiant' => $utilisateurUID ));
|
|
|
|
|
|
|
|
|
|
return $getUtilisateurInfo->fetch(); // retourne les info, si pas de résultat, retourne [FAUX]
|
|
|
|
@ -182,7 +195,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// si le groupe existe => on récupère ses utilisateurs
|
|
|
|
|
$appartenance = $this->pdo->prepare("SELECT u.identifiant, u.prenom, u.nom, u.mail, u.droits, s.nom as semestre ".
|
|
|
|
|
$appartenance = DataBase::getPDO()->prepare("SELECT u.identifiant, u.prenom, u.nom, u.mail, u.droits, s.nom as semestre ".
|
|
|
|
|
"FROM utilisateur as u, groupe as g, semestre as s, appartenance as app ".
|
|
|
|
|
"WHERE u.identifiant = app.id_etudiant ".
|
|
|
|
|
"AND g.id_groupe = app.id_groupe ".
|
|
|
|
@ -219,7 +232,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// on cherche tout les groupes du même semestre de la même année
|
|
|
|
|
$getGroupesUID = $this->pdo->prepare("SELECT DISTINCT g.nom, s.rang, s.nom as semestre ".
|
|
|
|
|
$getGroupesUID = DataBase::getPDO()->prepare("SELECT DISTINCT g.nom, s.rang, s.nom as semestre ".
|
|
|
|
|
"FROM groupe as g, semestre as s, appartenance as app ".
|
|
|
|
|
"WHERE g.id_groupe = app.id_groupe ".
|
|
|
|
|
"AND s.id_semestre = app.id_semestre ".
|
|
|
|
@ -260,7 +273,7 @@ class DataBase{
|
|
|
|
|
if( $pGroupe != null ){ $groupeOpt = $pGroupe; } // si le groupe est donné, on le définit
|
|
|
|
|
|
|
|
|
|
/*** on cherche un semestre avec ce rang et cette année (qui est unique) ***/
|
|
|
|
|
$checkAnnee = $this->pdo->prepare("SELECT id_semestre as id FROM semestre WHERE annee = :annee");
|
|
|
|
|
$checkAnnee = DataBase::getPDO()->prepare("SELECT id_semestre as id FROM semestre WHERE annee = :annee");
|
|
|
|
|
$checkAnnee->execute(array(
|
|
|
|
|
':annee' => $annee
|
|
|
|
|
));
|
|
|
|
@ -270,7 +283,7 @@ class DataBase{
|
|
|
|
|
return 'unknown_year';
|
|
|
|
|
|
|
|
|
|
// on cherche tout les groupes du même semestre de la même année
|
|
|
|
|
$getGroupesUID = $this->pdo->prepare("SELECT DISTINCT g.nom, s.rang, s.nom as semestre ".
|
|
|
|
|
$getGroupesUID = DataBase::getPDO()->prepare("SELECT DISTINCT g.nom, s.rang, s.nom as semestre ".
|
|
|
|
|
"FROM groupe as g, semestre as s, appartenance as app ".
|
|
|
|
|
"WHERE g.id_groupe = app.id_groupe ".
|
|
|
|
|
"AND s.id_semestre = app.id_semestre ".
|
|
|
|
@ -316,7 +329,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche un semestre avec ce rang et cette année (qui est unique) ***/
|
|
|
|
|
$checkAnnee = $this->pdo->prepare("SELECT id_semestre as id FROM semestre WHERE annee = :annee");
|
|
|
|
|
$checkAnnee = DataBase::getPDO()->prepare("SELECT id_semestre as id FROM semestre WHERE annee = :annee");
|
|
|
|
|
$checkAnnee->execute(array(
|
|
|
|
|
':annee' => $annee
|
|
|
|
|
));
|
|
|
|
@ -331,7 +344,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// on cherche tout les groupes du même semestre de la même année
|
|
|
|
|
$getGroupesUID = $this->pdo->prepare("SELECT DISTINCT s.nom as semestre, s.rang, g.nom as nom ".
|
|
|
|
|
$getGroupesUID = DataBase::getPDO()->prepare("SELECT DISTINCT s.nom as semestre, s.rang, g.nom as nom ".
|
|
|
|
|
"FROM module as m, utilisateur as u, utilisateur as eleve, groupe as g, enseignement as ens, mcc_ue, mcc_module as mcc_m, semestre as s, appartenance as app ".
|
|
|
|
|
"WHERE mcc_ue.id_semestre = s.id_semestre ".
|
|
|
|
|
"AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ".
|
|
|
|
@ -389,7 +402,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// on cherche le groupe associé
|
|
|
|
|
$getNomGroupe = $this->pdo->prepare("SELECT g.nom ".
|
|
|
|
|
$getNomGroupe = DataBase::getPDO()->prepare("SELECT g.nom ".
|
|
|
|
|
"FROM utilisateur as u, groupe as g, appartenance as app ".
|
|
|
|
|
"WHERE app.id_etudiant = u.identifiant ".
|
|
|
|
|
"AND app.id_groupe = g.id_groupe ".
|
|
|
|
@ -420,7 +433,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche le nouveau groupe pour cet utilisateur ***/
|
|
|
|
|
$getNouveauGroupeUID = $this->pdo->prepare("SELECT DISTINCT s.id_semestre as semestre, g.id_groupe as id, u.identifiant as etuUID ".
|
|
|
|
|
$getNouveauGroupeUID = DataBase::getPDO()->prepare("SELECT DISTINCT s.id_semestre as semestre, g.id_groupe as id, u.identifiant as etuUID ".
|
|
|
|
|
"FROM groupe as g, appartenance as app, appartenance as myapp, utilisateur as u, semestre as s ".
|
|
|
|
|
"WHERE g.nom = :groupe ".
|
|
|
|
|
"AND u.identifiant = :etudiant ".
|
|
|
|
@ -446,7 +459,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche le groupe de cet utilisateur ***/
|
|
|
|
|
$getGroupeUID = $this->pdo->prepare("SELECT g.id_groupe as id ".
|
|
|
|
|
$getGroupeUID = DataBase::getPDO()->prepare("SELECT g.id_groupe as id ".
|
|
|
|
|
"FROM utilisateur as u, groupe as g, appartenance as app, semestre as s ".
|
|
|
|
|
"WHERE app.id_etudiant = u.identifiant ".
|
|
|
|
|
"AND app.id_groupe = g.id_groupe ".
|
|
|
|
@ -468,7 +481,7 @@ class DataBase{
|
|
|
|
|
/***************************************************************/
|
|
|
|
|
|
|
|
|
|
// il suffit donc maintenant de modifier l' "appartenance"
|
|
|
|
|
$updateGroupe = $this->pdo->prepare("UPDATE appartenance SET id_groupe = :nouveauGroupeUID ".
|
|
|
|
|
$updateGroupe = DataBase::getPDO()->prepare("UPDATE appartenance SET id_groupe = :nouveauGroupeUID ".
|
|
|
|
|
"WHERE id_etudiant = :etudiantUID ".
|
|
|
|
|
"AND id_groupe = :groupeUID ".
|
|
|
|
|
"AND id_semestre = :semestreUID");
|
|
|
|
@ -484,7 +497,7 @@ class DataBase{
|
|
|
|
|
/****************************************************/
|
|
|
|
|
/*** CAS 2 : l'utilisateur n'a pas encore de groupe */
|
|
|
|
|
/****************************************************/
|
|
|
|
|
$insertGroupe = $this->pdo->prepare("INSERT INTO appartenance(id_appartenance, id_etudiant, id_groupe, id_semestre) ".
|
|
|
|
|
$insertGroupe = DataBase::getPDO()->prepare("INSERT INTO appartenance(id_appartenance, id_etudiant, id_groupe, id_semestre) ".
|
|
|
|
|
"VALUES(NULL, :etudiantUID, :nouveauGroupeUID, :semestreUID)");
|
|
|
|
|
$insertGroupe->execute(array(
|
|
|
|
|
':etudiantUID' => $etudiantUID,
|
|
|
|
@ -494,7 +507,7 @@ class DataBase{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Vérification de l'entrée dans la table */
|
|
|
|
|
$verif = $this->pdo->prepare("SELECT count(id_appartenance) as count ".
|
|
|
|
|
$verif = DataBase::getPDO()->prepare("SELECT count(id_appartenance) as count ".
|
|
|
|
|
"FROM appartenance ".
|
|
|
|
|
"WHERE id_etudiant = :etudiantUID ".
|
|
|
|
|
"AND id_groupe = :nouveauGroupeUID ".
|
|
|
|
@ -547,7 +560,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche le groupe de cet utilisateur ***/
|
|
|
|
|
$getGroupeUID = $this->pdo->prepare("SELECT g.id_groupe as id ".
|
|
|
|
|
$getGroupeUID = DataBase::getPDO()->prepare("SELECT g.id_groupe as id ".
|
|
|
|
|
"FROM utilisateur as u, groupe as g, appartenance as app, semestre as s ".
|
|
|
|
|
"WHERE app.id_etudiant = u.identifiant ".
|
|
|
|
|
"AND app.id_groupe = g.id_groupe ".
|
|
|
|
@ -571,7 +584,7 @@ class DataBase{
|
|
|
|
|
foreach($UEList as $iter=>$UE){
|
|
|
|
|
|
|
|
|
|
// si on a l'UID utilisateur & l'UID groupe => on récupère les modules
|
|
|
|
|
$getModuleList = $this->pdo->prepare("SELECT DISTINCT m.id_module as id, m.nom as nom, m.libelle as libelle ".
|
|
|
|
|
$getModuleList = DataBase::getPDO()->prepare("SELECT DISTINCT m.id_module as id, m.nom as nom, m.libelle as libelle ".
|
|
|
|
|
"FROM module as m, groupe as g, semestre as s, ue, appartenance as app, mcc_ue, mcc_module as mcc_m ".
|
|
|
|
|
"WHERE app.id_semestre = s.id_semestre ".
|
|
|
|
|
"AND app.id_groupe = g.id_groupe ".
|
|
|
|
@ -621,7 +634,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche le groupe de cet utilisateur ***/
|
|
|
|
|
$getGroupeUID = $this->pdo->prepare("SELECT g.id_groupe as id ".
|
|
|
|
|
$getGroupeUID = DataBase::getPDO()->prepare("SELECT g.id_groupe as id ".
|
|
|
|
|
"FROM utilisateur as u, groupe as g, appartenance as app, semestre as s ".
|
|
|
|
|
"WHERE app.id_etudiant = u.identifiant ".
|
|
|
|
|
"AND app.id_groupe = g.id_groupe ".
|
|
|
|
@ -640,7 +653,7 @@ class DataBase{
|
|
|
|
|
return 'unknown_group';
|
|
|
|
|
|
|
|
|
|
// si on a l'UID utilisateur & l'UID groupe => on récupère les modules
|
|
|
|
|
$getModuleList = $this->pdo->prepare("SELECT DISTINCT m.id_module as id, m.nom as nom, m.libelle as libelle ".
|
|
|
|
|
$getModuleList = DataBase::getPDO()->prepare("SELECT DISTINCT m.id_module as id, m.nom as nom, m.libelle as libelle ".
|
|
|
|
|
"FROM module as m, groupe as g, semestre as s, ue, appartenance as app, mcc_ue, mcc_module as mcc_m ".
|
|
|
|
|
"WHERE app.id_semestre = s.id_semestre ".
|
|
|
|
|
"AND app.id_groupe = g.id_groupe ".
|
|
|
|
@ -687,7 +700,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche le groupe de cet utilisateur ***/
|
|
|
|
|
$getGroupeUID = $this->pdo->prepare("SELECT g.id_groupe as id ".
|
|
|
|
|
$getGroupeUID = DataBase::getPDO()->prepare("SELECT g.id_groupe as id ".
|
|
|
|
|
"FROM utilisateur as u, groupe as g, appartenance as app, semestre as s ".
|
|
|
|
|
"WHERE app.id_etudiant = u.identifiant ".
|
|
|
|
|
"AND app.id_groupe = g.id_groupe ".
|
|
|
|
@ -707,7 +720,7 @@ class DataBase{
|
|
|
|
|
return 'unknown_group';
|
|
|
|
|
|
|
|
|
|
// si on a l'UID utilisateur & l'UID groupe => on récupère les modules
|
|
|
|
|
$getUEList = $this->pdo->prepare("SELECT DISTINCT ue.id_ue as id, s.annee as annee, ue.nom as nom, ue.libelle as libelle ".
|
|
|
|
|
$getUEList = DataBase::getPDO()->prepare("SELECT DISTINCT ue.id_ue as id, s.annee as annee, ue.nom as nom, ue.libelle as libelle ".
|
|
|
|
|
"FROM module as m, groupe as g, semestre as s, ue, appartenance as app, mcc_ue, mcc_module as mcc_m ".
|
|
|
|
|
"WHERE app.id_semestre = s.id_semestre ".
|
|
|
|
|
"AND app.id_groupe = g.id_groupe ".
|
|
|
|
@ -753,7 +766,7 @@ class DataBase{
|
|
|
|
|
/**************************************************/
|
|
|
|
|
public function getModulesByUEByEnseignant($enseignant, $annee){
|
|
|
|
|
/*** on cherche un semestre avec ce rang et cette année (qui est unique) ***/
|
|
|
|
|
$getSemestreUID = $this->pdo->prepare("SELECT id_semestre as id FROM semestre WHERE annee = :annee");
|
|
|
|
|
$getSemestreUID = DataBase::getPDO()->prepare("SELECT id_semestre as id FROM semestre WHERE annee = :annee");
|
|
|
|
|
$getSemestreUID->execute(array(
|
|
|
|
|
':annee' => $annee
|
|
|
|
|
));
|
|
|
|
@ -764,7 +777,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche un utilisateur avec cet identifiant ***/
|
|
|
|
|
$getEnseignantUID = $this->pdo->prepare("SELECT DISTINCT u.identifiant as id ".
|
|
|
|
|
$getEnseignantUID = DataBase::getPDO()->prepare("SELECT DISTINCT u.identifiant as id ".
|
|
|
|
|
"FROM utilisateur as u, enseignement as ens, semestre as s, mcc_module as mcc_m, mcc_ue ".
|
|
|
|
|
"WHERE u.identifiant = ens.id_enseignant ".
|
|
|
|
|
"AND ens.id_mcc_module = mcc_m.id_mcc_module ".
|
|
|
|
@ -790,7 +803,7 @@ class DataBase{
|
|
|
|
|
foreach($UEList as $iter=>$UE){
|
|
|
|
|
|
|
|
|
|
// si on a l'UID utilisateur & l'UID groupe => on récupère les modules
|
|
|
|
|
$getModuleList = $this->pdo->prepare("SELECT DISTINCT m.id_module as id, m.nom as nom, m.libelle as libelle ".
|
|
|
|
|
$getModuleList = DataBase::getPDO()->prepare("SELECT DISTINCT m.id_module as id, m.nom as nom, m.libelle as libelle ".
|
|
|
|
|
"FROM enseignement as ens, semestre as s, ue, module as m, mcc_ue, mcc_module as mcc_m ".
|
|
|
|
|
"WHERE ens.id_mcc_module = mcc_m.id_mcc_module ".
|
|
|
|
|
"AND mcc_m.id_module = m.id_module ".
|
|
|
|
@ -827,7 +840,7 @@ class DataBase{
|
|
|
|
|
/****************************************/
|
|
|
|
|
public function getUEsEnseignant($enseignant, $annee){
|
|
|
|
|
/*** on cherche un semestre avec ce rang et cette année (qui est unique) ***/
|
|
|
|
|
$getSemestreUID = $this->pdo->prepare("SELECT id_semestre as id FROM semestre WHERE annee = :annee");
|
|
|
|
|
$getSemestreUID = DataBase::getPDO()->prepare("SELECT id_semestre as id FROM semestre WHERE annee = :annee");
|
|
|
|
|
$getSemestreUID->execute(array(
|
|
|
|
|
':annee' => $annee
|
|
|
|
|
));
|
|
|
|
@ -839,7 +852,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche un utilisateur avec cet identifiant ***/
|
|
|
|
|
$getEnseignantUID = $this->pdo->prepare("SELECT DISTINCT u.identifiant as id ".
|
|
|
|
|
$getEnseignantUID = DataBase::getPDO()->prepare("SELECT DISTINCT u.identifiant as id ".
|
|
|
|
|
"FROM utilisateur as u, enseignement as ens, semestre as s, mcc_module as mcc_m, mcc_ue ".
|
|
|
|
|
"WHERE u.identifiant = ens.id_enseignant ".
|
|
|
|
|
"AND ens.id_mcc_module = mcc_m.id_mcc_module ".
|
|
|
|
@ -861,7 +874,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// si on a l'UID enseignant => on récupère les UEs
|
|
|
|
|
$getUEList = $this->pdo->prepare("SELECT DISTINCT ue.id_ue as id, s.annee as annee, ue.nom as nom, ue.libelle as libelle ".
|
|
|
|
|
$getUEList = DataBase::getPDO()->prepare("SELECT DISTINCT ue.id_ue as id, s.annee as annee, ue.nom as nom, ue.libelle as libelle ".
|
|
|
|
|
"FROM enseignement as ens, semestre as s, ue, mcc_ue, mcc_module as mcc_m ".
|
|
|
|
|
"WHERE ens.id_mcc_module = mcc_m.id_mcc_module ".
|
|
|
|
|
"AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ".
|
|
|
|
@ -921,7 +934,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche un utilisateur avec cet identifiant ***/
|
|
|
|
|
$getEtudiantUID = $this->pdo->prepare("SELECT u.identifiant as id FROM utilisateur as u, appartenance as app ".
|
|
|
|
|
$getEtudiantUID = DataBase::getPDO()->prepare("SELECT u.identifiant as id FROM utilisateur as u, appartenance as app ".
|
|
|
|
|
"WHERE u.identifiant = app.id_etudiant ".
|
|
|
|
|
"AND u.identifiant = :etudiant ".
|
|
|
|
|
"AND app.id_semestre = :semestreUID");
|
|
|
|
@ -969,7 +982,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche un utilisateur avec cet identifiant ***/
|
|
|
|
|
$getEtudiantUID = $this->pdo->prepare("SELECT u.identifiant as id FROM utilisateur as u, appartenance as app ".
|
|
|
|
|
$getEtudiantUID = DataBase::getPDO()->prepare("SELECT u.identifiant as id FROM utilisateur as u, appartenance as app ".
|
|
|
|
|
"WHERE u.identifiant = app.id_etudiant ".
|
|
|
|
|
"AND u.identifiant = :etudiant ".
|
|
|
|
|
"AND app.id_semestre = :semestreUID");
|
|
|
|
@ -1018,7 +1031,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche un utilisateur avec cet identifiant ***/
|
|
|
|
|
$getEtudiantUID = $this->pdo->prepare("SELECT identifiant as id FROM utilisateur as u, appartenance as app ".
|
|
|
|
|
$getEtudiantUID = DataBase::getPDO()->prepare("SELECT identifiant as id FROM utilisateur as u, appartenance as app ".
|
|
|
|
|
"WHERE u.identifiant = app.id_etudiant ".
|
|
|
|
|
"AND u.identifiant = :etudiant ".
|
|
|
|
|
"AND app.id_semestre = :semestreUID");
|
|
|
|
@ -1036,7 +1049,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche un module avec ce nom, en accord avec le semestre et l'étudiant ***/
|
|
|
|
|
$getModuleUID = $this->pdo->prepare("SELECT m.id_module as id FROM module as m, appartenance as app, ue, mcc_ue, mcc_module as mcc_m ".
|
|
|
|
|
$getModuleUID = DataBase::getPDO()->prepare("SELECT m.id_module as id FROM module as m, appartenance as app, ue, mcc_ue, mcc_module as mcc_m ".
|
|
|
|
|
"WHERE app.id_etudiant = :etudiantUID ".
|
|
|
|
|
|
|
|
|
|
"AND mcc_ue.id_ue = ue.id_ue ".
|
|
|
|
@ -1062,7 +1075,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// si on a l'UID utilisateur & l'UID groupe => on récupère les modules
|
|
|
|
|
$getModuleList = $this->pdo->prepare("SELECT m.nom as module, m.libelle as modulelib, ctrl.intitule, note.valeur, ctrl.base, ctrl.coefficient ".
|
|
|
|
|
$getModuleList = DataBase::getPDO()->prepare("SELECT m.nom as module, m.libelle as modulelib, ctrl.intitule, note.valeur, ctrl.base, ctrl.coefficient ".
|
|
|
|
|
"FROM note, appartenance as app, semestre as s, module as m, mcc_ue, mcc_module as mcc_m, controle as ctrl ".
|
|
|
|
|
"WHERE note.id_appartenance = app.id_appartenance ".
|
|
|
|
|
"AND ctrl.id_controle = note.id_controle ".
|
|
|
|
@ -1110,7 +1123,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche un utilisateur avec cet identifiant ***/
|
|
|
|
|
$getEtudiantUID = $this->pdo->prepare("SELECT identifiant as id FROM utilisateur as u, appartenance as app ".
|
|
|
|
|
$getEtudiantUID = DataBase::getPDO()->prepare("SELECT identifiant as id FROM utilisateur as u, appartenance as app ".
|
|
|
|
|
"WHERE u.identifiant = app.id_etudiant ".
|
|
|
|
|
"AND u.identifiant = :etudiant ".
|
|
|
|
|
"AND app.id_semestre = :semestreUID");
|
|
|
|
@ -1127,7 +1140,7 @@ class DataBase{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** on cherche un module avec ce nom, en accord avec le semestre et l'étudiant ***/
|
|
|
|
|
$getUEUID = $this->pdo->prepare("SELECT ue.id_ue as id ".
|
|
|
|
|
$getUEUID = DataBase::getPDO()->prepare("SELECT ue.id_ue as id ".
|
|
|
|
|
"FROM module as m, appartenance as app, ue, mcc_ue, mcc_module as mcc_m ".
|
|
|
|
|
"WHERE mcc_ue.id_ue = ue.id_ue ".
|
|
|
|
|
"AND mcc_ue.id_semestre = app.id_semestre ".
|
|
|
|
@ -1151,7 +1164,7 @@ class DataBase{
|
|
|
|
|
return 'unknown_UE';
|
|
|
|
|
|
|
|
|
|
// si on a l'UID utilisateur & l'UID UE => on récupère les notes
|
|
|
|
|
$getUEList = $this->pdo->prepare("SELECT m.nom as module, m.libelle as modulelib, ctrl.intitule, note.valeur, ctrl.base, ctrl.coefficient ".
|
|
|
|
|
$getUEList = DataBase::getPDO()->prepare("SELECT m.nom as module, m.libelle as modulelib, ctrl.intitule, note.valeur, ctrl.base, ctrl.coefficient ".
|
|
|
|
|
"FROM note, appartenance as app, semestre as s, module as m, ue, mcc_ue, mcc_module as mcc_m, controle as ctrl ".
|
|
|
|
|
"WHERE note.id_appartenance = app.id_appartenance ".
|
|
|
|
|
"AND ctrl.id_mcc_module = mcc_m.id_mcc_module ".
|
|
|
|
|