diff --git a/manager/repo/controle.php b/manager/repo/controle.php index 8186406..5bc71fc 100755 --- a/manager/repo/controle.php +++ b/manager/repo/controle.php @@ -19,16 +19,16 @@ class controleRepo extends DBAccess{ */ public static function info($controleUID){ // on considère que le semestre existe - $getControleInfo = DataBase::getPDO()->prepare("SELECT ctrl.id_controle as id, ctrl.id_mcc_module, m.nom as module, m.libelle as modulelib, s.id_semestre, ctrl.intitule, ctrl.base, ctrl.coefficient, ctrl.date_publication ". - "FROM controle as ctrl, mcc_module as mcc_m, mcc_ue, semestre as s, module as m ". - "WHERE ctrl.id_mcc_module = mcc_m.id_mcc_module ". - "AND mcc_m.id_module = m.id_module ". - "AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". - "AND mcc_ue.id_semestre = s.id_semestre ". + $getControleInfo = DataBase::getPDO()->prepare("SELECT ctrl.id_controle as id, ctrl.id_mcc_module, m.nom as module, m.libelle as modulelib, s.id_semestre, ctrl.intitule, ctrl.base, ctrl.coefficient, ctrl.date_publication + FROM controle as ctrl, mcc_module as mcc_m, mcc_ue, semestre as s, module as m + WHERE ctrl.id_mcc_module = mcc_m.id_mcc_module + AND mcc_m.id_module = m.id_module + AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue + AND mcc_ue.id_semestre = s.id_semestre - "AND ctrl.id_controle = :controleUID ". + AND ctrl.id_controle = :controleUID - "GROUP BY ctrl.id_controle"); + GROUP BY ctrl.id_controle"); $getControleInfo->execute(array( ':controleUID' => $controleUID )); @@ -51,14 +51,14 @@ class controleRepo extends DBAccess{ * */ public static function forStudent($module, $semestre){ - $getControleList = DataBase::getPDO()->prepare("SELECT DISTINCT ctrl.id_controle as id, ctrl.id_mcc_module, ctrl.intitule, ctrl.base, ctrl.coefficient, ctrl.date_publication ". - "FROM controle as ctrl, module as m, mcc_module as mcc_m, mcc_ue, semestre as s ". - "WHERE ctrl.id_mcc_module = mcc_m.id_mcc_module ". - "AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". - "AND mcc_ue.id_semestre = s.id_semestre ". + $getControleList = DataBase::getPDO()->prepare("SELECT DISTINCT ctrl.id_controle as id, ctrl.id_mcc_module, ctrl.intitule, ctrl.base, ctrl.coefficient, ctrl.date_publication + FROM controle as ctrl, module as m, mcc_module as mcc_m, mcc_ue, semestre as s + WHERE ctrl.id_mcc_module = mcc_m.id_mcc_module + AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue + AND mcc_ue.id_semestre = s.id_semestre - "AND mcc_m.id_module = :module ". - "AND s.id_semestre = :semestre"); + AND mcc_m.id_module = :module + AND s.id_semestre = :semestre"); $getControleList->execute(array( ':module' => $module, ':semestre' => $semestre )); return DataBase::delNumeric( $getControleList->fetchAll() ); @@ -79,18 +79,18 @@ class controleRepo extends DBAccess{ * */ public static function forTeacher($enseignant, $module, $semestre){ - $getControleList = DataBase::getPDO()->prepare("SELECT DISTINCT ctrl.id_controle as id, ctrl.id_mcc_module, ctrl.intitule, ctrl.base, ctrl.coefficient, ctrl.date_publication ". - "FROM enseignement as ens, module as m, mcc_module as mcc_m, mcc_ue, controle as ctrl ". - "WHERE ens.id_mcc_module = mcc_m.id_mcc_module ". - "AND mcc_m.id_mcc_module = ctrl.id_mcc_module ". - "AND mcc_m.id_module = m.id_module ". - "AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". + $getControleList = DataBase::getPDO()->prepare("SELECT DISTINCT ctrl.id_controle as id, ctrl.id_mcc_module, ctrl.intitule, ctrl.base, ctrl.coefficient, ctrl.date_publication + FROM enseignement as ens, module as m, mcc_module as mcc_m, mcc_ue, controle as ctrl + WHERE ens.id_mcc_module = mcc_m.id_mcc_module + AND mcc_m.id_mcc_module = ctrl.id_mcc_module + AND mcc_m.id_module = m.id_module + AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue - "AND ens.id_enseignant = :enseignant ". - "AND mcc_m.id_module = :module ". - "AND mcc_ue.id_semestre = :semestre ". + AND ens.id_enseignant = :enseignant + AND mcc_m.id_module = :module + AND mcc_ue.id_semestre = :semestre - "GROUP BY ctrl.id_controle"); + GROUP BY ctrl.id_controle"); $getControleList->execute(array( ':enseignant' => $enseignant, ':module' => $module, ':semestre' => $semestre )); return DataBase::delNumeric( $getControleList->fetchAll() ); diff --git a/manager/repo/group.php b/manager/repo/group.php index a34f5f2..97a2a74 100755 --- a/manager/repo/group.php +++ b/manager/repo/group.php @@ -60,11 +60,11 @@ class groupRepo extends DBAccess{ */ public static function appartenanceUID($etudiant, $groupe, $semestre){ /*** on cherche un groupe avec ce nom ***/ - $getAppartenanceUID = DataBase::getPDO()->prepare("SELECT id_appartenance as id ". - "FROM appartenance ". - "WHERE id_etudiant = :etudiant ". - "AND id_groupe = :groupe ". - "AND id_semestre = :semestre"); + $getAppartenanceUID = DataBase::getPDO()->prepare("SELECT id_appartenance as id + FROM appartenance + WHERE id_etudiant = :etudiant + AND id_groupe = :groupe + AND id_semestre = :semestre"); $getAppartenanceUID->execute(array( ':etudiant' => $etudiant, ':groupe' => $groupe, @@ -129,9 +129,9 @@ class groupRepo extends DBAccess{ /* [2] On modifie l'appartenance ==============================*/ // création et exécution de la requête de modification de l'appartenance - $ajouterMembres = DataBase::getPDO()->prepare("UPDATE appartenance ". - "SET id_groupe = :groupe ". - "WHERE id_appartenance = :appartenanceUID"); + $ajouterMembres = DataBase::getPDO()->prepare("UPDATE appartenance + SET id_groupe = :groupe + WHERE id_appartenance = :appartenanceUID"); $ajouterMembres->execute(array( ':groupe' => $groupe, ':appartenanceUID' => $appartenanceUID @@ -142,12 +142,12 @@ class groupRepo extends DBAccess{ /* [2] On créé l'appartenance ==============================*/ // création et exécution de la requête de création d'appartenance - $ajouterMembres = DataBase::getPDO()->prepare("INSERT INTO appartenance(id_etudiant, id_groupe, id_semestre) ". - "VALUES( ". - "(SELECT identifiant FROM utilisateur WHERE identifiant = :etudiant), ". - "(SELECT id_groupe FROM groupe WHERE id_groupe = :groupe), ". - "(SELECT id_semestre FROM semestre WHERE id_semestre = :semestre) ". - " )"); + $ajouterMembres = DataBase::getPDO()->prepare("INSERT INTO appartenance(id_etudiant, id_groupe, id_semestre) + VALUES( + (SELECT identifiant FROM utilisateur WHERE identifiant = :etudiant), + (SELECT id_groupe FROM groupe WHERE id_groupe = :groupe), + (SELECT id_semestre FROM semestre WHERE id_semestre = :semestre) + )"); $ajouterMembres->execute(array( ':etudiant' => $etudiant, ':groupe' => $groupe, @@ -174,16 +174,16 @@ class groupRepo extends DBAccess{ */ public static function membres($groupeUID, $semestreUID){ // si le groupe existe => on récupère ses utilisateurs - $getMembres = DataBase::getPDO()->prepare("SELECT u.identifiant, u.prenom, u.nom, u.mail, u.droits, s.nom as semestre, g.id_groupe, g.nom as groupe ". - "FROM utilisateur as u, groupe as g, semestre as s, appartenance as app, formation as f ". - "WHERE s.id_formation = f.id_formation ". - "AND u.identifiant = app.id_etudiant ". - "AND g.id_groupe = app.id_groupe ". - "AND app.id_semestre = app.id_semestre ". // à virer (peut-être) + $getMembres = DataBase::getPDO()->prepare("SELECT u.identifiant, u.prenom, u.nom, u.mail, u.droits, s.nom as semestre, g.id_groupe, g.nom as groupe + FROM utilisateur as u, groupe as g, semestre as s, appartenance as app, formation as f + WHERE s.id_formation = f.id_formation + AND u.identifiant = app.id_etudiant + AND g.id_groupe = app.id_groupe + AND app.id_semestre = app.id_semestre // à virer (peut-être) - "AND g.id_groupe = :groupeUID ". - "AND s.id_semestre = :semestreUID ". - "ORDER BY u.prenom, u.nom"); + AND g.id_groupe = :groupeUID + AND s.id_semestre = :semestreUID + ORDER BY u.prenom, u.nom"); $getMembres->execute(array( ':groupeUID' => $groupeUID, ':semestreUID' => $semestreUID @@ -206,15 +206,15 @@ class groupRepo extends DBAccess{ * */ public static function forStudent($etudiant, $semestre){ - $getGroupe = DataBase::getPDO()->prepare("SELECT DISTINCT app.id_appartenance, g.id_groupe as id, g.nom, s.id_semestre, s.nom as semestre, f.id_formation, f.code as formation, f.nom as nom_formation ". - "FROM groupe as g, appartenance as app, formation as f, semestre as s ". - "WHERE s.id_formation = f.id_formation ". - "AND app.id_groupe = g.id_groupe ". - "AND app.id_semestre = s.id_semestre ". + $getGroupe = DataBase::getPDO()->prepare("SELECT DISTINCT app.id_appartenance, g.id_groupe as id, g.nom, s.id_semestre, s.nom as semestre, f.id_formation, f.code as formation, f.nom as nom_formation + FROM groupe as g, appartenance as app, formation as f, semestre as s + WHERE s.id_formation = f.id_formation + AND app.id_groupe = g.id_groupe + AND app.id_semestre = s.id_semestre - "AND app.id_etudiant = :etudiant ". - "AND s.id_semestre = :semestre ". - "ORDER BY g.nom"); + AND app.id_etudiant = :etudiant + AND s.id_semestre = :semestre + ORDER BY g.nom"); $getGroupe->execute(array( ':etudiant' => $etudiant, ':semestre' => $semestre )); return $getGroupe->fetch(); @@ -239,26 +239,26 @@ class groupRepo extends DBAccess{ $semestrePair0 = '0'; $semestrePair1 = '1'; if( is_bool($semestre_pair) ){ $semestrePair0 = ($semestre_pair)?'0':'1'; $semestrePair1 = ($semestre_pair)?'0':'1'; } - $getGroupeList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe as id, g.nom, s.rang, s.id_semestre, s.nom as semestre, f.id_formation, f.code as formation, f.nom as nom_formation ". - "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, formation as f ". - "WHERE s.id_formation = f.id_formation ". - "AND mcc_ue.id_semestre = s.id_semestre ". - "AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". + $getGroupeList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe as id, g.nom, s.rang, s.id_semestre, s.nom as semestre, f.id_formation, f.code as formation, f.nom as nom_formation + 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, formation as f + WHERE s.id_formation = f.id_formation + AND mcc_ue.id_semestre = s.id_semestre + AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue - "AND mcc_m.id_module = m.id_module ". - "AND mcc_m.id_mcc_module = ens.id_mcc_module ". + AND mcc_m.id_module = m.id_module + AND mcc_m.id_mcc_module = ens.id_mcc_module - "AND ens.id_enseignant = u.identifiant ". - "AND ens.correcteur = 1 ". // uniquement les groupes pour lesquels il est correcteur + AND ens.id_enseignant = u.identifiant + AND ens.correcteur = 1 // uniquement les groupes pour lesquels il est correcteur - "AND app.id_etudiant = eleve.identifiant ". - "AND app.id_semestre = s.id_semestre ". - "AND app.id_groupe = g.id_groupe ". + AND app.id_etudiant = eleve.identifiant + AND app.id_semestre = s.id_semestre + AND app.id_groupe = g.id_groupe - "AND u.identifiant = :enseignant ". - "AND (s.rang % 2 = :semestre_pair0 OR s.rang % 2 = :semestre_pair1) ". - "AND s.annee = :annee ". - "ORDER BY s.rang, g.nom"); + AND u.identifiant = :enseignant + AND (s.rang % 2 = :semestre_pair0 OR s.rang % 2 = :semestre_pair1) + AND s.annee = :annee + ORDER BY s.rang, g.nom"); $getGroupeList->execute(array( ':enseignant' => $enseignant, ':semestre_pair0' => $semestrePair0, ':semestre_pair1' => $semestrePair1, ':annee' => $annee )); return DataBase::delNumeric( $getGroupeList->fetchAll() ); @@ -278,15 +278,15 @@ class groupRepo extends DBAccess{ * */ public static function forControle($controle){ - $getGroupeList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe, g.nom ". - "FROM groupe as g, appartenance as app, mcc_ue, mcc_module as mcc_m, controle as ctrl ". - "WHERE app.id_groupe = g.id_groupe ". - "AND ctrl.id_mcc_module = mcc_m.id_mcc_module ". - "AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". - "AND app.id_semestre = mcc_ue.id_semestre ". + $getGroupeList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe, g.nom + FROM groupe as g, appartenance as app, mcc_ue, mcc_module as mcc_m, controle as ctrl + WHERE app.id_groupe = g.id_groupe + AND ctrl.id_mcc_module = mcc_m.id_mcc_module + AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue + AND app.id_semestre = mcc_ue.id_semestre - "AND ctrl.id_controle = :controle ". - "ORDER BY g.nom ASC"); + AND ctrl.id_controle = :controle + ORDER BY g.nom ASC"); $getGroupeList->execute(array( ':controle' => $controle )); @@ -309,15 +309,15 @@ class groupRepo extends DBAccess{ $semestrePair0 = '0'; $semestrePair1 = '1'; if( is_bool($semestre_pair) ){ $semestrePair0 = ($semestre_pair)?'0':'1'; $semestrePair1 = ($semestre_pair)?'0':'1'; } - $getGroupeList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe as id, g.nom, s.rang, s.id_semestre, s.nom as semestre, f.id_formation, f.code as formation, f.nom as nom_formation ". - "FROM groupe as g, semestre as s, appartenance as app, formation as f ". - "WHERE s.id_formation = f.id_formation ". - "AND g.id_groupe = app.id_groupe ". - "AND s.id_semestre = app.id_semestre ". + $getGroupeList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe as id, g.nom, s.rang, s.id_semestre, s.nom as semestre, f.id_formation, f.code as formation, f.nom as nom_formation + FROM groupe as g, semestre as s, appartenance as app, formation as f + WHERE s.id_formation = f.id_formation + AND g.id_groupe = app.id_groupe + AND s.id_semestre = app.id_semestre - "AND (s.rang % 2 = :semestre_pair0 OR s.rang % 2 = :semestre_pair1) ". - "AND s.annee = :annee ". - "ORDER BY g.nom"); + AND (s.rang % 2 = :semestre_pair0 OR s.rang % 2 = :semestre_pair1) + AND s.annee = :annee + ORDER BY g.nom"); $getGroupeList->execute(array( ':semestre_pair0' => $semestrePair0, ':semestre_pair1' => $semestrePair1, ':annee' => $annee )); return DataBase::delNumeric( $getGroupeList->fetchAll() ); diff --git a/manager/repo/module.php b/manager/repo/module.php index e99fdbc..fec1ca8 100755 --- a/manager/repo/module.php +++ b/manager/repo/module.php @@ -58,15 +58,15 @@ class moduleRepo extends DBAccess{ */ public static function forStudent($UEUID, $semestre){ // on récupère les modules - $getModulesForStudent = DataBase::getPDO()->prepare("SELECT DISTINCT m.id_module as id, m.nom, m.libelle ". - "FROM module as m, semestre as s, mcc_ue, mcc_module as mcc_m ". - "WHERE mcc_ue.id_semestre = s.id_semestre ". - "AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". - "AND mcc_m.id_module = m.id_module ". + $getModulesForStudent = DataBase::getPDO()->prepare("SELECT DISTINCT m.id_module as id, m.nom, m.libelle + FROM module as m, semestre as s, mcc_ue, mcc_module as mcc_m + WHERE mcc_ue.id_semestre = s.id_semestre + AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue + AND mcc_m.id_module = m.id_module - "AND mcc_ue.id_ue = :UEUID ". - "AND s.id_semestre = :semestre ". - "ORDER BY m.nom, m.libelle"); + AND mcc_ue.id_ue = :UEUID + AND s.id_semestre = :semestre + ORDER BY m.nom, m.libelle"); $getModulesForStudent->execute(array( ':UEUID' => $UEUID, ':semestre' => $semestre )); return DataBase::delNumeric( $getModulesForStudent->fetchAll() ); @@ -87,16 +87,16 @@ class moduleRepo extends DBAccess{ public static function forTeacher($enseignant, $UEUID, $semestre){ // on récupère les modules - $getModulesForTeacher = DataBase::getPDO()->prepare("SELECT DISTINCT m.id_module as id, m.nom, m.libelle ". - "FROM module as m, mcc_module as mcc_m, mcc_ue, enseignement as ens ". - "WHERE ens.id_mcc_module = mcc_m.id_mcc_module ". - "AND mcc_m.id_module = m.id_module ". - "AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". + $getModulesForTeacher = DataBase::getPDO()->prepare("SELECT DISTINCT m.id_module as id, m.nom, m.libelle + FROM module as m, mcc_module as mcc_m, mcc_ue, enseignement as ens + WHERE ens.id_mcc_module = mcc_m.id_mcc_module + AND mcc_m.id_module = m.id_module + AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue - "AND ens.id_enseignant = :enseignant ". - "AND mcc_ue.id_ue = :UEUID ". - "AND mcc_ue.id_semestre = :semestre ". - "ORDER BY m.nom, m.libelle"); + AND ens.id_enseignant = :enseignant + AND mcc_ue.id_ue = :UEUID + AND mcc_ue.id_semestre = :semestre + ORDER BY m.nom, m.libelle"); $getModulesForTeacher->execute(array( ':enseignant' => $enseignant, ':UEUID' => $UEUID, ':semestre' => $semestre )); return DataBase::delNumeric( $getModulesForTeacher->fetchAll() ); @@ -116,15 +116,15 @@ class moduleRepo extends DBAccess{ */ public static function forYear($UEUID, $semestre){ // on récupère les modules - $getModulesForYear = DataBase::getPDO()->prepare("SELECT DISTINCT m.id_module as id, m.nom, m.libelle ". - "FROM module as m, mcc_module as mcc_m, mcc_ue, semestre as s ". - "WHERE m.id_module = mcc_m.id_module ". - "AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". - "AND mcc_ue.id_semestre = s.id_semestre ". + $getModulesForYear = DataBase::getPDO()->prepare("SELECT DISTINCT m.id_module as id, m.nom, m.libelle + FROM module as m, mcc_module as mcc_m, mcc_ue, semestre as s + WHERE m.id_module = mcc_m.id_module + AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue + AND mcc_ue.id_semestre = s.id_semestre - "AND mcc_ue.id_ue = :UEUID ". - "AND s.id_semestre = :semestre ". - "ORDER BY s.rang, m.nom, m.libelle"); + AND mcc_ue.id_ue = :UEUID + AND s.id_semestre = :semestre + ORDER BY s.rang, m.nom, m.libelle"); $getModulesForYear->execute(array( ':UEUID' => $UEUID, ':semestre' => $semestre )); return DataBase::delNumeric( $getModulesForYear->fetchAll() ); @@ -156,8 +156,7 @@ class moduleRepo extends DBAccess{ /* [3] On créé le nouveu module =================================================================================================*/ - $creationModule = DataBase::getPDO()->prepare("INSERT INTO module(id_module, nom, libelle) ". - "VALUES(DEFAULT, :nom, :libelle)"); + $creationModule = DataBase::getPDO()->prepare("INSERT INTO module(id_module, nom, libelle) VALUES(DEFAULT, :nom, :libelle)"); $creationModule->execute(array( ':nom' => $nom, ':libelle' => $libelle diff --git a/manager/repo/note.php b/manager/repo/note.php index 550f035..534662a 100755 --- a/manager/repo/note.php +++ b/manager/repo/note.php @@ -20,13 +20,13 @@ class noteRepo extends DBAccess{ * */ public static function UID($etudiant, $controle){ - $getNoteUID = DataBase::getPDO()->prepare("SELECT note.id_note as id ". - "FROM appartenance as app, note, controle as ctrl ". - "WHERE app.id_appartenance = note.id_appartenance ". - "AND ctrl.id_controle = note.id_controle ". + $getNoteUID = DataBase::getPDO()->prepare("SELECT note.id_note as id + FROM appartenance as app, note, controle as ctrl + WHERE app.id_appartenance = note.id_appartenance + AND ctrl.id_controle = note.id_controle - "AND app.id_etudiant = :etudiant ". - "AND ctrl.id_controle = :controle"); + AND app.id_etudiant = :etudiant + AND ctrl.id_controle = :controle"); $getNoteUID->execute(array( ':etudiant' => $etudiant, ':controle' => $controle )); // on retourne le résultat : FAUX si aucun résultat, sinon la valeur de l'UID de l'utilisateur @@ -68,18 +68,18 @@ class noteRepo extends DBAccess{ * */ public static function forStudent($etudiant, $controle){ - $getNoteList = DataBase::getPDO()->prepare("SELECT DISTINCT n.id_note as id, n.id_appartenance, n.id_controle, n.valeur ". - "FROM note as n, appartenance as app, semestre as s, controle as ctrl, mcc_ue, mcc_module as mcc_m ". - "WHERE n.id_appartenance = app.id_appartenance ". - "AND app.id_semestre = s.id_semestre ". - "AND s.id_semestre = mcc_ue.id_semestre ". - "AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". - "AND mcc_m.id_mcc_module = ctrl.id_mcc_module ". - "AND n.id_controle = ctrl.id_controle ". + $getNoteList = DataBase::getPDO()->prepare("SELECT DISTINCT n.id_note as id, n.id_appartenance, n.id_controle, n.valeur + FROM note as n, appartenance as app, semestre as s, controle as ctrl, mcc_ue, mcc_module as mcc_m + WHERE n.id_appartenance = app.id_appartenance + AND app.id_semestre = s.id_semestre + AND s.id_semestre = mcc_ue.id_semestre + AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue + AND mcc_m.id_mcc_module = ctrl.id_mcc_module + AND n.id_controle = ctrl.id_controle - "AND app.id_etudiant = :etudiant ". - "AND ctrl.id_controle = :controle ". - "ORDER BY n.valeur ASC"); + AND app.id_etudiant = :etudiant + AND ctrl.id_controle = :controle + ORDER BY n.valeur ASC"); $getNoteList->execute(array( ':etudiant' => $etudiant, ':controle' => $controle )); return DataBase::delNumeric( $getNoteList->fetchAll() ); @@ -109,21 +109,21 @@ class noteRepo extends DBAccess{ ============================================================*/ if( !is_int($groupe) ){ - $getNoteList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe, g.nom as groupe, n.id_note as id, n.id_appartenance, n.id_controle, AVG(n.valeur) as moyenne, min(n.valeur) as min, max(n.valeur) as max, COUNT(n.valeur) as nb_notes ". - "FROM note as n, appartenance as app, semestre as s, controle as ctrl, mcc_ue, mcc_module as mcc_m, groupe as g ". - "WHERE n.id_appartenance = app.id_appartenance ". - "AND app.id_semestre = s.id_semestre ". - "AND app.id_groupe = g.id_groupe ". - "AND s.id_semestre = mcc_ue.id_semestre ". - "AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". - "AND mcc_m.id_mcc_module = ctrl.id_mcc_module ". - "AND n.id_controle = ctrl.id_controle ". + $getNoteList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe, g.nom as groupe, n.id_note as id, n.id_appartenance, n.id_controle, AVG(n.valeur) as moyenne, min(n.valeur) as min, max(n.valeur) as max, COUNT(n.valeur) as nb_notes + FROM note as n, appartenance as app, semestre as s, controle as ctrl, mcc_ue, mcc_module as mcc_m, groupe as g + WHERE n.id_appartenance = app.id_appartenance + AND app.id_semestre = s.id_semestre + AND app.id_groupe = g.id_groupe + AND s.id_semestre = mcc_ue.id_semestre + AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue + AND mcc_m.id_mcc_module = ctrl.id_mcc_module + AND n.id_controle = ctrl.id_controle - "AND ctrl.id_controle = :controle ". + AND ctrl.id_controle = :controle - "GROUP BY g.id_groupe ". + GROUP BY g.id_groupe - "ORDER BY g.nom ASC"); + ORDER BY g.nom ASC"); $getNoteList->execute(array( ':controle' => $controle )); @@ -131,20 +131,20 @@ class noteRepo extends DBAccess{ ============================================================*/ }else{ - $getNoteList = DataBase::getPDO()->prepare("SELECT DISTINCT n.id_note as id, g.nom as groupe, app.id_etudiant as etudiant, n.id_appartenance, n.id_controle, n.valeur ". - "FROM note as n, appartenance as app, semestre as s, controle as ctrl, mcc_ue, mcc_module as mcc_m, groupe as g ". - "WHERE n.id_appartenance = app.id_appartenance ". - "AND app.id_semestre = s.id_semestre ". - "AND app.id_groupe = g.id_groupe ". - "AND s.id_semestre = mcc_ue.id_semestre ". - "AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". - "AND mcc_m.id_mcc_module = ctrl.id_mcc_module ". - "AND n.id_controle = ctrl.id_controle ". + $getNoteList = DataBase::getPDO()->prepare("SELECT DISTINCT n.id_note as id, g.nom as groupe, app.id_etudiant as etudiant, n.id_appartenance, n.id_controle, n.valeur + FROM note as n, appartenance as app, semestre as s, controle as ctrl, mcc_ue, mcc_module as mcc_m, groupe as g + WHERE n.id_appartenance = app.id_appartenance + AND app.id_semestre = s.id_semestre + AND app.id_groupe = g.id_groupe + AND s.id_semestre = mcc_ue.id_semestre + AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue + AND mcc_m.id_mcc_module = ctrl.id_mcc_module + AND n.id_controle = ctrl.id_controle - "AND ctrl.id_controle = :controle ". - "AND app.id_groupe = :groupe ". + AND ctrl.id_controle = :controle + AND app.id_groupe = :groupe - "ORDER BY g.nom ASC"); + ORDER BY g.nom ASC"); $getNoteList->execute(array( ':controle' => $controle, ':groupe' => $groupe )); } @@ -166,22 +166,22 @@ class noteRepo extends DBAccess{ * */ public static function forGroupe($controle, $groupe){ - $getNoteList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe, g.nom as groupe, n.id_note as id, n.id_appartenance, n.id_controle, AVG(n.valeur) as moyenne, min(n.valeur) as min, max(n.valeur) as max, COUNT(n.valeur) as nb_notes ". - "FROM note as n, appartenance as app, semestre as s, controle as ctrl, mcc_ue, mcc_module as mcc_m, groupe as g ". - "WHERE n.id_appartenance = app.id_appartenance ". - "AND app.id_semestre = s.id_semestre ". - "AND app.id_groupe = g.id_groupe ". - "AND s.id_semestre = mcc_ue.id_semestre ". - "AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". - "AND mcc_m.id_mcc_module = ctrl.id_mcc_module ". - "AND n.id_controle = ctrl.id_controle ". + $getNoteList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe, g.nom as groupe, n.id_note as id, n.id_appartenance, n.id_controle, AVG(n.valeur) as moyenne, min(n.valeur) as min, max(n.valeur) as max, COUNT(n.valeur) as nb_notes + FROM note as n, appartenance as app, semestre as s, controle as ctrl, mcc_ue, mcc_module as mcc_m, groupe as g + WHERE n.id_appartenance = app.id_appartenance + AND app.id_semestre = s.id_semestre + AND app.id_groupe = g.id_groupe + AND s.id_semestre = mcc_ue.id_semestre + AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue + AND mcc_m.id_mcc_module = ctrl.id_mcc_module + AND n.id_controle = ctrl.id_controle - "AND ctrl.id_controle = :controle ". - "AND app.id_groupe = :groupe ". + AND ctrl.id_controle = :controle + AND app.id_groupe = :groupe - "GROUP BY g.id_groupe ". + GROUP BY g.id_groupe - "ORDER BY g.nom ASC"); + ORDER BY g.nom ASC"); $getNoteList->execute(array( ':controle' => $controle, ':groupe' => $groupe )); return $getNoteList->fetch(); @@ -198,12 +198,12 @@ class noteRepo extends DBAccess{ * */ public static function moyenneForControle($controle){ - $getMoyenne = DataBase::getPDO()->prepare("SELECT ctrl.id_controle, AVG(n.valeur) as moyenne ". - "FROM controle as ctrl, note as n ". - "WHERE ctrl.id_controle = n.id_controle ". - "AND ctrl.id_controle = :controle ". + $getMoyenne = DataBase::getPDO()->prepare("SELECT ctrl.id_controle, AVG(n.valeur) as moyenne + FROM controle as ctrl, note as n + WHERE ctrl.id_controle = n.id_controle + AND ctrl.id_controle = :controle - "GROUP BY ctrl.id_controle"); + GROUP BY ctrl.id_controle"); $getMoyenne->execute(array( ':controle' => $controle )); if( $fetchObj = $getMoyenne->fetch() ) @@ -231,13 +231,13 @@ class noteRepo extends DBAccess{ ============================================================================*/ if( !($noteUID=noteRepo::UID($etudiant, $controle)) ){ - $creationNote = DataBase::getPDO()->prepare("INSERT INTO note(id_note, id_appartenance, id_controle, valeur) ". - "VALUES(". - "DEFAULT, ". - "(SELECT id_appartenance FROM appartenance WHERE id_etudiant = :etudiant AND id_semestre = :semestre), ". - ":controle, ". - ":valeur". - ")"); + $creationNote = DataBase::getPDO()->prepare("INSERT INTO note(id_note, id_appartenance, id_controle, valeur) + VALUES( + DEFAULT, + (SELECT id_appartenance FROM appartenance WHERE id_etudiant = :etudiant AND id_semestre = :semestre), + :controle, + :valeur. + )"); $creationNote->execute(array( ':etudiant' => $etudiant, ':semestre' => $semestre, ':controle' => $controle, ':valeur' => $valeur )); diff --git a/manager/repo/semestre.php b/manager/repo/semestre.php index a71950f..af54eba 100755 --- a/manager/repo/semestre.php +++ b/manager/repo/semestre.php @@ -57,10 +57,10 @@ class semestreRepo extends DBAccess{ */ public static function info($semestreUID){ // on considère que le semestre existe - $getSemestreInfo = DataBase::getPDO()->prepare("SELECT s.id_semestre as id, s.nom, s.rang, s.annee, f.id_formation, f.code as formation, f.nom as nom_formation ". - "FROM semestre as s, formation as f ". - "WHERE s.id_formation = f.id_formation ". - "AND s.id_semestre = :semestreUID"); + $getSemestreInfo = DataBase::getPDO()->prepare("SELECT s.id_semestre as id, s.nom, s.rang, s.annee, f.id_formation, f.code as formation, f.nom as nom_formation + FROM semestre as s, formation as f + WHERE s.id_formation = f.id_formation + AND s.id_semestre = :semestreUID"); $getSemestreInfo->execute(array( ':semestreUID' => $semestreUID )); // on retourne le résultat en supprimant les doublons à indices numériques @@ -89,15 +89,15 @@ class semestreRepo extends DBAccess{ // on formate les variables $semestre_pair = ($semestre_pair) ? '0' : '1'; - $getSemestreUID = DataBase::getPDO()->prepare("SELECT s.id_semestre as id, f.id_formation, f.code as formation, f.nom as nom_formation ". - "FROM semestre as s, appartenance as app, formation as f ". - "WHERE s.id_formation = f.id_formation ". - "AND app.id_semestre = s.id_semestre ". + $getSemestreUID = DataBase::getPDO()->prepare("SELECT s.id_semestre as id, f.id_formation, f.code as formation, f.nom as nom_formation + FROM semestre as s, appartenance as app, formation as f + WHERE s.id_formation = f.id_formation + AND app.id_semestre = s.id_semestre - "AND app.id_etudiant = :etudiant ". - "AND s.annee = :annee ". - "AND s.rang % 2 = :semestre_pair ". - "ORDER BY s.rang DESC"); + AND app.id_etudiant = :etudiant + AND s.annee = :annee + AND s.rang % 2 = :semestre_pair + ORDER BY s.rang DESC"); $getSemestreUID->execute(array( ':etudiant' => $etudiant, ':annee' => $annee, @@ -122,17 +122,17 @@ class semestreRepo extends DBAccess{ * */ public static function forTeacher($enseignant, $semestre_pair, $annee){ - $getSemestreList = DataBase::getPDO()->prepare("SELECT DISTINCT s.id_semestre as id, f.id_formation, f.code as formation, f.nom as nom_formation, s.nom, s.rang, s.annee ". - "FROM semestre as s, formation as f, enseignement as ens, mcc_module as mcc_m, mcc_ue ". - "WHERE s.id_semestre = mcc_ue.id_semestre ". // semestre <-> mcc_ue - "AND s.id_formation = f.id_formation ". // semestre <-> formation - "AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". // mcc_ue <-> mcc_module - "AND mcc_m.id_mcc_module = ens.id_mcc_module ". // mcc_module <-> enseignement + $getSemestreList = DataBase::getPDO()->prepare("SELECT DISTINCT s.id_semestre as id, f.id_formation, f.code as formation, f.nom as nom_formation, s.nom, s.rang, s.annee + FROM semestre as s, formation as f, enseignement as ens, mcc_module as mcc_m, mcc_ue + WHERE s.id_semestre = mcc_ue.id_semestre + AND s.id_formation = f.id_formation + AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue + AND mcc_m.id_mcc_module = ens.id_mcc_module - "AND ens.id_enseignant = :enseignant ". - "AND s.rang % 2 = :semestre_pair ". - "AND s.annee = :annee ". - "ORDER BY s.rang ASC"); + AND ens.id_enseignant = :enseignant + AND s.rang % 2 = :semestre_pair + AND s.annee = :annee + ORDER BY s.rang ASC"); $getSemestreList->execute(array( ':enseignant' => $enseignant, ':semestre_pair' => ($semestre_pair) ? '0' : '1', ':annee' => $annee )); return DataBase::delNumeric( $getSemestreList->fetchAll() ); @@ -149,11 +149,11 @@ class semestreRepo extends DBAccess{ * */ public static function forYear($annee){ - $getSemestreList = DataBase::getPDO()->prepare("SELECT DISTINCT s.id_semestre as id, f.id_formation, f.code as formation, f.nom as nom_formation, s.nom, s.rang, s.annee ". - "FROM semestre as s, formation as f ". - "WHERE s.id_formation = f.id_formation ". - "AND annee = :annee ". - "ORDER BY rang ASC"); + $getSemestreList = DataBase::getPDO()->prepare("SELECT DISTINCT s.id_semestre as id, f.id_formation, f.code as formation, f.nom as nom_formation, s.nom, s.rang, s.annee + FROM semestre as s, formation as f + WHERE s.id_formation = f.id_formation + AND annee = :annee + ORDER BY rang ASC"); $getSemestreList->execute(array( ':annee' => $annee )); return DataBase::delNumeric( $getSemestreList->fetchAll() ); diff --git a/manager/repo/ue.php b/manager/repo/ue.php index 9be1d26..b3e36c9 100755 --- a/manager/repo/ue.php +++ b/manager/repo/ue.php @@ -57,15 +57,15 @@ class ueRepo extends DBAccess{ */ public static function forStudent($etudiant, $semestre){ // on récupère les modules - $getUesForStudent = DataBase::getPDO()->prepare("SELECT DISTINCT ue.id_ue as id, s.id_semestre, s.nom as semestre, s.annee, ue.nom, ue.libelle ". - "FROM appartenance as app, semestre as s, mcc_ue, ue ". - "WHERE app.id_semestre = s.id_semestre ". - "AND mcc_ue.id_semestre = s.id_semestre ". - "AND mcc_ue.id_ue = ue.id_ue ". + $getUesForStudent = DataBase::getPDO()->prepare("SELECT DISTINCT ue.id_ue as id, s.id_semestre, s.nom as semestre, s.annee, ue.nom, ue.libelle + FROM appartenance as app, semestre as s, mcc_ue, ue + WHERE app.id_semestre = s.id_semestre + AND mcc_ue.id_semestre = s.id_semestre + AND mcc_ue.id_ue = ue.id_ue - "AND app.id_etudiant = :etudiant ". - "AND s.id_semestre = :semestre ". - "ORDER BY ue.nom, ue.libelle"); + AND app.id_etudiant = :etudiant + AND s.id_semestre = :semestre + ORDER BY ue.nom, ue.libelle"); $getUesForStudent->execute(array( ':etudiant' => $etudiant, ':semestre' => $semestre )); return DataBase::delNumeric( $getUesForStudent->fetchAll() ); @@ -83,18 +83,18 @@ class ueRepo extends DBAccess{ */ public static function forTeacher($enseignant, $semestre){ // on récupère les modules - $getUesForTeacher = DataBase::getPDO()->prepare("SELECT DISTINCT ue.id_ue as id, s.id_semestre, s.nom as semestre, s.annee, ue.nom, ue.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 ens.correcteur = 1 ". // si l'enseignant est correcteur uniquement - "AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". - "AND mcc_ue.id_semestre = s.id_semestre ". - "AND mcc_ue.id_ue = ue.id_ue ". + $getUesForTeacher = DataBase::getPDO()->prepare("SELECT DISTINCT ue.id_ue as id, s.id_semestre, s.nom as semestre, s.annee, ue.nom, ue.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 ens.correcteur = 1 + AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue + AND mcc_ue.id_semestre = s.id_semestre + AND mcc_ue.id_ue = ue.id_ue - "AND ens.id_enseignant = :enseignant ". - "AND s.id_semestre = :semestre ". + AND ens.id_enseignant = :enseignant + AND s.id_semestre = :semestre - "ORDER BY ue.nom, ue.libelle ASC"); + ORDER BY ue.nom, ue.libelle ASC"); $getUesForTeacher->execute(array( ':enseignant' => $enseignant, ':semestre' => $semestre )); return DataBase::delNumeric( $getUesForTeacher->fetchAll() ); @@ -112,13 +112,13 @@ class ueRepo extends DBAccess{ */ public static function forYear($semestre){ // on récupère les modules - $getUEList = DataBase::getPDO()->prepare("SELECT DISTINCT ue.id_ue as id, s.id_semestre, s.nom as semestre, s.annee, ue.nom, ue.libelle ". - "FROM ue, mcc_ue, semestre as s ". - "WHERE ue.id_ue = mcc_ue.id_ue ". - "AND mcc_ue.id_semestre = s.id_semestre ". + $getUEList = DataBase::getPDO()->prepare("SELECT DISTINCT ue.id_ue as id, s.id_semestre, s.nom as semestre, s.annee, ue.nom, ue.libelle + FROM ue, mcc_ue, semestre as s + WHERE ue.id_ue = mcc_ue.id_ue + AND mcc_ue.id_semestre = s.id_semestre - "AND s.id_semestre = :semestre ". - "ORDER BY s.rang, ue.nom, ue.libelle"); + AND s.id_semestre = :semestre + ORDER BY s.rang, ue.nom, ue.libelle"); $getUEList->execute(array( ':semestre' => $semestre )); return DataBase::delNumeric( $getUEList->fetchAll() ); @@ -155,8 +155,7 @@ class ueRepo extends DBAccess{ /* [3] On créé le nouvel UE =================================================================================================*/ - $creationUE = DataBase::getPDO()->prepare("INSERT INTO ue(id_ue, nom, libelle) ". - "VALUES(DEFAULT, :nom, :libelle)"); + $creationUE = DataBase::getPDO()->prepare("INSERT INTO ue(id_ue, nom, libelle) VALUES(DEFAULT, :nom, :libelle)"); $creationUE->execute(array( ':nom' => $nom, ':libelle' => $libelle diff --git a/manager/repo/user.php b/manager/repo/user.php index 5fd1adc..ac57665 100755 --- a/manager/repo/user.php +++ b/manager/repo/user.php @@ -36,27 +36,27 @@ class userRepo extends DBAccess{ /* [2] Cas où on cherche si un étudiant est inscrit à un semestre ==============================================================*/ - $getUtilisateurUID = DataBase::getPDO()->prepare("SELECT u.identifiant as id ". - "FROM utilisateur as u, appartenance as app ". - "WHERE u.identifiant = app.id_etudiant ". - "AND u.identifiant = :identifiant ". - "AND app.id_semestre = :semestre"); + $getUtilisateurUID = DataBase::getPDO()->prepare("SELECT u.identifiant as id + FROM utilisateur as u, appartenance as app + WHERE u.identifiant = app.id_etudiant + AND u.identifiant = :identifiant + AND app.id_semestre = :semestre"); $getUtilisateurUID->execute(array( ':identifiant' => $identifiant, ':semestre' => $semestre )); }elseif( is_bool($semestre_pair) && $annee != null ){ /* [2] Cas où on cherche si un enseignant enseigne l'année donnée ==============================================================*/ - $getUtilisateurUID = 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 ". - "AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". - "AND mcc_ue.id_semestre = s.id_semestre ". + $getUtilisateurUID = 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 + AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue + AND mcc_ue.id_semestre = s.id_semestre - "AND u.identifiant = :identifiant ". - "AND s.rang % 2 = :semestre_pair ". - "AND s.annee = :annee"); + AND u.identifiant = :identifiant + AND s.rang % 2 = :semestre_pair + AND s.annee = :annee"); $getUtilisateurUID->execute(array( ':identifiant' => $identifiant, ':semestre_pair' => ($semestre_pair) ? '0' : '1', ':annee' => $annee )); }else // si les paramètres sont pas bons @@ -131,8 +131,8 @@ class userRepo extends DBAccess{ /* [3] On créé le nouvel utilisateur =================================================================================================*/ - $creationUtilisateur = DataBase::getPDO()->prepare("INSERT INTO utilisateur(identifiant, prenom, nom, mail, mdp, droits) ". - "VALUES(:identifiant, :prenom, :nom, :mail, :mdp, :droits)"); + $creationUtilisateur = DataBase::getPDO()->prepare("INSERT INTO utilisateur(identifiant, prenom, nom, mail, mdp, droits) + VALUES(:identifiant, :prenom, :nom, :mail, :mdp, :droits)"); $creationUtilisateur->execute(array( ':identifiant' => $identifiant, ':prenom' => $prenom, diff --git a/page/modules.php b/page/modules.php index 27ede14..c37c219 100755 --- a/page/modules.php +++ b/page/modules.php @@ -471,7 +471,6 @@ if( permission('admin') ){ // si l'utilisateur est un admin modules_switch_level_1($request, $answer); // var_dump( $answer ); - if( $answer->request == 'success' ){ // si on a bien récupéré les membres du groupe //////////////////////////////////////////////////////////////////////////////// echo "
";