Suppression (") dans requêtes des repos

This commit is contained in:
xdrm-brackets 2015-11-17 13:00:50 +01:00
parent d96ace86b3
commit 6546e340d7
8 changed files with 248 additions and 251 deletions

View File

@ -19,16 +19,16 @@ class controleRepo extends DBAccess{
*/ */
public static function info($controleUID){ public static function info($controleUID){
// on considère que le semestre existe // 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 ". $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 ". 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 ". WHERE ctrl.id_mcc_module = mcc_m.id_mcc_module
"AND mcc_m.id_module = m.id_module ". AND mcc_m.id_module = m.id_module
"AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue
"AND mcc_ue.id_semestre = s.id_semestre ". 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( $getControleInfo->execute(array(
':controleUID' => $controleUID ':controleUID' => $controleUID
)); ));
@ -51,14 +51,14 @@ class controleRepo extends DBAccess{
* *
*/ */
public static function forStudent($module, $semestre){ 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 ". $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 ". 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 ". WHERE ctrl.id_mcc_module = mcc_m.id_mcc_module
"AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue
"AND mcc_ue.id_semestre = s.id_semestre ". AND mcc_ue.id_semestre = s.id_semestre
"AND mcc_m.id_module = :module ". AND mcc_m.id_module = :module
"AND s.id_semestre = :semestre"); AND s.id_semestre = :semestre");
$getControleList->execute(array( ':module' => $module, ':semestre' => $semestre )); $getControleList->execute(array( ':module' => $module, ':semestre' => $semestre ));
return DataBase::delNumeric( $getControleList->fetchAll() ); return DataBase::delNumeric( $getControleList->fetchAll() );
@ -79,18 +79,18 @@ class controleRepo extends DBAccess{
* *
*/ */
public static function forTeacher($enseignant, $module, $semestre){ 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 ". $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 ". 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 ". WHERE ens.id_mcc_module = mcc_m.id_mcc_module
"AND mcc_m.id_mcc_module = ctrl.id_mcc_module ". AND mcc_m.id_mcc_module = ctrl.id_mcc_module
"AND mcc_m.id_module = m.id_module ". AND mcc_m.id_module = m.id_module
"AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue
"AND ens.id_enseignant = :enseignant ". AND ens.id_enseignant = :enseignant
"AND mcc_m.id_module = :module ". AND mcc_m.id_module = :module
"AND mcc_ue.id_semestre = :semestre ". 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 )); $getControleList->execute(array( ':enseignant' => $enseignant, ':module' => $module, ':semestre' => $semestre ));
return DataBase::delNumeric( $getControleList->fetchAll() ); return DataBase::delNumeric( $getControleList->fetchAll() );

View File

@ -60,11 +60,11 @@ class groupRepo extends DBAccess{
*/ */
public static function appartenanceUID($etudiant, $groupe, $semestre){ public static function appartenanceUID($etudiant, $groupe, $semestre){
/*** on cherche un groupe avec ce nom ***/ /*** on cherche un groupe avec ce nom ***/
$getAppartenanceUID = DataBase::getPDO()->prepare("SELECT id_appartenance as id ". $getAppartenanceUID = DataBase::getPDO()->prepare("SELECT id_appartenance as id
"FROM appartenance ". FROM appartenance
"WHERE id_etudiant = :etudiant ". WHERE id_etudiant = :etudiant
"AND id_groupe = :groupe ". AND id_groupe = :groupe
"AND id_semestre = :semestre"); AND id_semestre = :semestre");
$getAppartenanceUID->execute(array( $getAppartenanceUID->execute(array(
':etudiant' => $etudiant, ':etudiant' => $etudiant,
':groupe' => $groupe, ':groupe' => $groupe,
@ -129,9 +129,9 @@ class groupRepo extends DBAccess{
/* [2] On modifie l'appartenance /* [2] On modifie l'appartenance
==============================*/ ==============================*/
// création et exécution de la requête de modification de l'appartenance // création et exécution de la requête de modification de l'appartenance
$ajouterMembres = DataBase::getPDO()->prepare("UPDATE appartenance ". $ajouterMembres = DataBase::getPDO()->prepare("UPDATE appartenance
"SET id_groupe = :groupe ". SET id_groupe = :groupe
"WHERE id_appartenance = :appartenanceUID"); WHERE id_appartenance = :appartenanceUID");
$ajouterMembres->execute(array( $ajouterMembres->execute(array(
':groupe' => $groupe, ':groupe' => $groupe,
':appartenanceUID' => $appartenanceUID ':appartenanceUID' => $appartenanceUID
@ -142,12 +142,12 @@ class groupRepo extends DBAccess{
/* [2] On créé l'appartenance /* [2] On créé l'appartenance
==============================*/ ==============================*/
// création et exécution de la requête de création d'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) ". $ajouterMembres = DataBase::getPDO()->prepare("INSERT INTO appartenance(id_etudiant, id_groupe, id_semestre)
"VALUES( ". VALUES(
"(SELECT identifiant FROM utilisateur WHERE identifiant = :etudiant), ". (SELECT identifiant FROM utilisateur WHERE identifiant = :etudiant),
"(SELECT id_groupe FROM groupe WHERE id_groupe = :groupe), ". (SELECT id_groupe FROM groupe WHERE id_groupe = :groupe),
"(SELECT id_semestre FROM semestre WHERE id_semestre = :semestre) ". (SELECT id_semestre FROM semestre WHERE id_semestre = :semestre)
" )"); )");
$ajouterMembres->execute(array( $ajouterMembres->execute(array(
':etudiant' => $etudiant, ':etudiant' => $etudiant,
':groupe' => $groupe, ':groupe' => $groupe,
@ -174,16 +174,16 @@ class groupRepo extends DBAccess{
*/ */
public static function membres($groupeUID, $semestreUID){ public static function membres($groupeUID, $semestreUID){
// si le groupe existe => on récupère ses utilisateurs // 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 ". $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 ". FROM utilisateur as u, groupe as g, semestre as s, appartenance as app, formation as f
"WHERE s.id_formation = f.id_formation ". WHERE s.id_formation = f.id_formation
"AND u.identifiant = app.id_etudiant ". AND u.identifiant = app.id_etudiant
"AND g.id_groupe = app.id_groupe ". AND g.id_groupe = app.id_groupe
"AND app.id_semestre = app.id_semestre ". // à virer (peut-être) AND app.id_semestre = app.id_semestre // à virer (peut-être)
"AND g.id_groupe = :groupeUID ". AND g.id_groupe = :groupeUID
"AND s.id_semestre = :semestreUID ". AND s.id_semestre = :semestreUID
"ORDER BY u.prenom, u.nom"); ORDER BY u.prenom, u.nom");
$getMembres->execute(array( $getMembres->execute(array(
':groupeUID' => $groupeUID, ':groupeUID' => $groupeUID,
':semestreUID' => $semestreUID ':semestreUID' => $semestreUID
@ -206,15 +206,15 @@ class groupRepo extends DBAccess{
* *
*/ */
public static function forStudent($etudiant, $semestre){ 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 ". $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 ". FROM groupe as g, appartenance as app, formation as f, semestre as s
"WHERE s.id_formation = f.id_formation ". WHERE s.id_formation = f.id_formation
"AND app.id_groupe = g.id_groupe ". AND app.id_groupe = g.id_groupe
"AND app.id_semestre = s.id_semestre ". AND app.id_semestre = s.id_semestre
"AND app.id_etudiant = :etudiant ". AND app.id_etudiant = :etudiant
"AND s.id_semestre = :semestre ". AND s.id_semestre = :semestre
"ORDER BY g.nom"); ORDER BY g.nom");
$getGroupe->execute(array( ':etudiant' => $etudiant, ':semestre' => $semestre )); $getGroupe->execute(array( ':etudiant' => $etudiant, ':semestre' => $semestre ));
return $getGroupe->fetch(); return $getGroupe->fetch();
@ -239,26 +239,26 @@ class groupRepo extends DBAccess{
$semestrePair0 = '0'; $semestrePair1 = '1'; $semestrePair0 = '0'; $semestrePair1 = '1';
if( is_bool($semestre_pair) ){ $semestrePair0 = ($semestre_pair)?'0':'1'; $semestrePair1 = ($semestre_pair)?'0':'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 ". $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 ". 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 ". WHERE s.id_formation = f.id_formation
"AND mcc_ue.id_semestre = s.id_semestre ". AND mcc_ue.id_semestre = s.id_semestre
"AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue
"AND mcc_m.id_module = m.id_module ". AND mcc_m.id_module = m.id_module
"AND mcc_m.id_mcc_module = ens.id_mcc_module ". AND mcc_m.id_mcc_module = ens.id_mcc_module
"AND ens.id_enseignant = u.identifiant ". AND ens.id_enseignant = u.identifiant
"AND ens.correcteur = 1 ". // uniquement les groupes pour lesquels il est correcteur AND ens.correcteur = 1 // uniquement les groupes pour lesquels il est correcteur
"AND app.id_etudiant = eleve.identifiant ". AND app.id_etudiant = eleve.identifiant
"AND app.id_semestre = s.id_semestre ". AND app.id_semestre = s.id_semestre
"AND app.id_groupe = g.id_groupe ". AND app.id_groupe = g.id_groupe
"AND u.identifiant = :enseignant ". AND u.identifiant = :enseignant
"AND (s.rang % 2 = :semestre_pair0 OR s.rang % 2 = :semestre_pair1) ". AND (s.rang % 2 = :semestre_pair0 OR s.rang % 2 = :semestre_pair1)
"AND s.annee = :annee ". AND s.annee = :annee
"ORDER BY s.rang, g.nom"); ORDER BY s.rang, g.nom");
$getGroupeList->execute(array( ':enseignant' => $enseignant, ':semestre_pair0' => $semestrePair0, ':semestre_pair1' => $semestrePair1, ':annee' => $annee )); $getGroupeList->execute(array( ':enseignant' => $enseignant, ':semestre_pair0' => $semestrePair0, ':semestre_pair1' => $semestrePair1, ':annee' => $annee ));
return DataBase::delNumeric( $getGroupeList->fetchAll() ); return DataBase::delNumeric( $getGroupeList->fetchAll() );
@ -278,15 +278,15 @@ class groupRepo extends DBAccess{
* *
*/ */
public static function forControle($controle){ public static function forControle($controle){
$getGroupeList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe, g.nom ". $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 ". FROM groupe as g, appartenance as app, mcc_ue, mcc_module as mcc_m, controle as ctrl
"WHERE app.id_groupe = g.id_groupe ". WHERE app.id_groupe = g.id_groupe
"AND ctrl.id_mcc_module = mcc_m.id_mcc_module ". AND ctrl.id_mcc_module = mcc_m.id_mcc_module
"AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue
"AND app.id_semestre = mcc_ue.id_semestre ". AND app.id_semestre = mcc_ue.id_semestre
"AND ctrl.id_controle = :controle ". AND ctrl.id_controle = :controle
"ORDER BY g.nom ASC"); ORDER BY g.nom ASC");
$getGroupeList->execute(array( ':controle' => $controle )); $getGroupeList->execute(array( ':controle' => $controle ));
@ -309,15 +309,15 @@ class groupRepo extends DBAccess{
$semestrePair0 = '0'; $semestrePair1 = '1'; $semestrePair0 = '0'; $semestrePair1 = '1';
if( is_bool($semestre_pair) ){ $semestrePair0 = ($semestre_pair)?'0':'1'; $semestrePair1 = ($semestre_pair)?'0':'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 ". $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 ". FROM groupe as g, semestre as s, appartenance as app, formation as f
"WHERE s.id_formation = f.id_formation ". WHERE s.id_formation = f.id_formation
"AND g.id_groupe = app.id_groupe ". AND g.id_groupe = app.id_groupe
"AND s.id_semestre = app.id_semestre ". AND s.id_semestre = app.id_semestre
"AND (s.rang % 2 = :semestre_pair0 OR s.rang % 2 = :semestre_pair1) ". AND (s.rang % 2 = :semestre_pair0 OR s.rang % 2 = :semestre_pair1)
"AND s.annee = :annee ". AND s.annee = :annee
"ORDER BY g.nom"); ORDER BY g.nom");
$getGroupeList->execute(array( ':semestre_pair0' => $semestrePair0, ':semestre_pair1' => $semestrePair1, ':annee' => $annee )); $getGroupeList->execute(array( ':semestre_pair0' => $semestrePair0, ':semestre_pair1' => $semestrePair1, ':annee' => $annee ));
return DataBase::delNumeric( $getGroupeList->fetchAll() ); return DataBase::delNumeric( $getGroupeList->fetchAll() );

View File

@ -58,15 +58,15 @@ class moduleRepo extends DBAccess{
*/ */
public static function forStudent($UEUID, $semestre){ public static function forStudent($UEUID, $semestre){
// on récupère les modules // on récupère les modules
$getModulesForStudent = DataBase::getPDO()->prepare("SELECT DISTINCT m.id_module as id, m.nom, m.libelle ". $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 ". FROM module as m, semestre as s, mcc_ue, mcc_module as mcc_m
"WHERE mcc_ue.id_semestre = s.id_semestre ". WHERE mcc_ue.id_semestre = s.id_semestre
"AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue
"AND mcc_m.id_module = m.id_module ". AND mcc_m.id_module = m.id_module
"AND mcc_ue.id_ue = :UEUID ". AND mcc_ue.id_ue = :UEUID
"AND s.id_semestre = :semestre ". AND s.id_semestre = :semestre
"ORDER BY m.nom, m.libelle"); ORDER BY m.nom, m.libelle");
$getModulesForStudent->execute(array( ':UEUID' => $UEUID, ':semestre' => $semestre )); $getModulesForStudent->execute(array( ':UEUID' => $UEUID, ':semestre' => $semestre ));
return DataBase::delNumeric( $getModulesForStudent->fetchAll() ); return DataBase::delNumeric( $getModulesForStudent->fetchAll() );
@ -87,16 +87,16 @@ class moduleRepo extends DBAccess{
public static function forTeacher($enseignant, $UEUID, $semestre){ public static function forTeacher($enseignant, $UEUID, $semestre){
// on récupère les modules // on récupère les modules
$getModulesForTeacher = DataBase::getPDO()->prepare("SELECT DISTINCT m.id_module as id, m.nom, m.libelle ". $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 ". FROM module as m, mcc_module as mcc_m, mcc_ue, enseignement as ens
"WHERE ens.id_mcc_module = mcc_m.id_mcc_module ". WHERE ens.id_mcc_module = mcc_m.id_mcc_module
"AND mcc_m.id_module = m.id_module ". AND mcc_m.id_module = m.id_module
"AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue
"AND ens.id_enseignant = :enseignant ". AND ens.id_enseignant = :enseignant
"AND mcc_ue.id_ue = :UEUID ". AND mcc_ue.id_ue = :UEUID
"AND mcc_ue.id_semestre = :semestre ". AND mcc_ue.id_semestre = :semestre
"ORDER BY m.nom, m.libelle"); ORDER BY m.nom, m.libelle");
$getModulesForTeacher->execute(array( ':enseignant' => $enseignant, ':UEUID' => $UEUID, ':semestre' => $semestre )); $getModulesForTeacher->execute(array( ':enseignant' => $enseignant, ':UEUID' => $UEUID, ':semestre' => $semestre ));
return DataBase::delNumeric( $getModulesForTeacher->fetchAll() ); return DataBase::delNumeric( $getModulesForTeacher->fetchAll() );
@ -116,15 +116,15 @@ class moduleRepo extends DBAccess{
*/ */
public static function forYear($UEUID, $semestre){ public static function forYear($UEUID, $semestre){
// on récupère les modules // on récupère les modules
$getModulesForYear = DataBase::getPDO()->prepare("SELECT DISTINCT m.id_module as id, m.nom, m.libelle ". $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 ". FROM module as m, mcc_module as mcc_m, mcc_ue, semestre as s
"WHERE m.id_module = mcc_m.id_module ". WHERE m.id_module = mcc_m.id_module
"AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue
"AND mcc_ue.id_semestre = s.id_semestre ". AND mcc_ue.id_semestre = s.id_semestre
"AND mcc_ue.id_ue = :UEUID ". AND mcc_ue.id_ue = :UEUID
"AND s.id_semestre = :semestre ". AND s.id_semestre = :semestre
"ORDER BY s.rang, m.nom, m.libelle"); ORDER BY s.rang, m.nom, m.libelle");
$getModulesForYear->execute(array( ':UEUID' => $UEUID, ':semestre' => $semestre )); $getModulesForYear->execute(array( ':UEUID' => $UEUID, ':semestre' => $semestre ));
return DataBase::delNumeric( $getModulesForYear->fetchAll() ); return DataBase::delNumeric( $getModulesForYear->fetchAll() );
@ -156,8 +156,7 @@ class moduleRepo extends DBAccess{
/* [3] On créé le nouveu module /* [3] On créé le nouveu module
=================================================================================================*/ =================================================================================================*/
$creationModule = DataBase::getPDO()->prepare("INSERT INTO module(id_module, nom, libelle) ". $creationModule = DataBase::getPDO()->prepare("INSERT INTO module(id_module, nom, libelle) VALUES(DEFAULT, :nom, :libelle)");
"VALUES(DEFAULT, :nom, :libelle)");
$creationModule->execute(array( $creationModule->execute(array(
':nom' => $nom, ':nom' => $nom,
':libelle' => $libelle ':libelle' => $libelle

View File

@ -20,13 +20,13 @@ class noteRepo extends DBAccess{
* *
*/ */
public static function UID($etudiant, $controle){ public static function UID($etudiant, $controle){
$getNoteUID = DataBase::getPDO()->prepare("SELECT note.id_note as id ". $getNoteUID = DataBase::getPDO()->prepare("SELECT note.id_note as id
"FROM appartenance as app, note, controle as ctrl ". FROM appartenance as app, note, controle as ctrl
"WHERE app.id_appartenance = note.id_appartenance ". WHERE app.id_appartenance = note.id_appartenance
"AND ctrl.id_controle = note.id_controle ". AND ctrl.id_controle = note.id_controle
"AND app.id_etudiant = :etudiant ". AND app.id_etudiant = :etudiant
"AND ctrl.id_controle = :controle"); AND ctrl.id_controle = :controle");
$getNoteUID->execute(array( ':etudiant' => $etudiant, ':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 // 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){ 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 ". $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 ". 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 ". WHERE n.id_appartenance = app.id_appartenance
"AND app.id_semestre = s.id_semestre ". AND app.id_semestre = s.id_semestre
"AND s.id_semestre = mcc_ue.id_semestre ". AND s.id_semestre = mcc_ue.id_semestre
"AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue
"AND mcc_m.id_mcc_module = ctrl.id_mcc_module ". AND mcc_m.id_mcc_module = ctrl.id_mcc_module
"AND n.id_controle = ctrl.id_controle ". AND n.id_controle = ctrl.id_controle
"AND app.id_etudiant = :etudiant ". AND app.id_etudiant = :etudiant
"AND ctrl.id_controle = :controle ". AND ctrl.id_controle = :controle
"ORDER BY n.valeur ASC"); ORDER BY n.valeur ASC");
$getNoteList->execute(array( ':etudiant' => $etudiant, ':controle' => $controle )); $getNoteList->execute(array( ':etudiant' => $etudiant, ':controle' => $controle ));
return DataBase::delNumeric( $getNoteList->fetchAll() ); return DataBase::delNumeric( $getNoteList->fetchAll() );
@ -109,21 +109,21 @@ class noteRepo extends DBAccess{
============================================================*/ ============================================================*/
if( !is_int($groupe) ){ 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 ". $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 ". 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 ". WHERE n.id_appartenance = app.id_appartenance
"AND app.id_semestre = s.id_semestre ". AND app.id_semestre = s.id_semestre
"AND app.id_groupe = g.id_groupe ". AND app.id_groupe = g.id_groupe
"AND s.id_semestre = mcc_ue.id_semestre ". AND s.id_semestre = mcc_ue.id_semestre
"AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue
"AND mcc_m.id_mcc_module = ctrl.id_mcc_module ". AND mcc_m.id_mcc_module = ctrl.id_mcc_module
"AND n.id_controle = ctrl.id_controle ". 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 )); $getNoteList->execute(array( ':controle' => $controle ));
@ -131,20 +131,20 @@ class noteRepo extends DBAccess{
============================================================*/ ============================================================*/
}else{ }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 ". $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 ". 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 ". WHERE n.id_appartenance = app.id_appartenance
"AND app.id_semestre = s.id_semestre ". AND app.id_semestre = s.id_semestre
"AND app.id_groupe = g.id_groupe ". AND app.id_groupe = g.id_groupe
"AND s.id_semestre = mcc_ue.id_semestre ". AND s.id_semestre = mcc_ue.id_semestre
"AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue
"AND mcc_m.id_mcc_module = ctrl.id_mcc_module ". AND mcc_m.id_mcc_module = ctrl.id_mcc_module
"AND n.id_controle = ctrl.id_controle ". AND n.id_controle = ctrl.id_controle
"AND ctrl.id_controle = :controle ". AND ctrl.id_controle = :controle
"AND app.id_groupe = :groupe ". AND app.id_groupe = :groupe
"ORDER BY g.nom ASC"); ORDER BY g.nom ASC");
$getNoteList->execute(array( ':controle' => $controle, ':groupe' => $groupe )); $getNoteList->execute(array( ':controle' => $controle, ':groupe' => $groupe ));
} }
@ -166,22 +166,22 @@ class noteRepo extends DBAccess{
* *
*/ */
public static function forGroupe($controle, $groupe){ 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 ". $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 ". 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 ". WHERE n.id_appartenance = app.id_appartenance
"AND app.id_semestre = s.id_semestre ". AND app.id_semestre = s.id_semestre
"AND app.id_groupe = g.id_groupe ". AND app.id_groupe = g.id_groupe
"AND s.id_semestre = mcc_ue.id_semestre ". AND s.id_semestre = mcc_ue.id_semestre
"AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue
"AND mcc_m.id_mcc_module = ctrl.id_mcc_module ". AND mcc_m.id_mcc_module = ctrl.id_mcc_module
"AND n.id_controle = ctrl.id_controle ". AND n.id_controle = ctrl.id_controle
"AND ctrl.id_controle = :controle ". AND ctrl.id_controle = :controle
"AND app.id_groupe = :groupe ". 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 )); $getNoteList->execute(array( ':controle' => $controle, ':groupe' => $groupe ));
return $getNoteList->fetch(); return $getNoteList->fetch();
@ -198,12 +198,12 @@ class noteRepo extends DBAccess{
* *
*/ */
public static function moyenneForControle($controle){ public static function moyenneForControle($controle){
$getMoyenne = DataBase::getPDO()->prepare("SELECT ctrl.id_controle, AVG(n.valeur) as moyenne ". $getMoyenne = DataBase::getPDO()->prepare("SELECT ctrl.id_controle, AVG(n.valeur) as moyenne
"FROM controle as ctrl, note as n ". FROM controle as ctrl, note as n
"WHERE ctrl.id_controle = n.id_controle ". WHERE ctrl.id_controle = n.id_controle
"AND ctrl.id_controle = :controle ". AND ctrl.id_controle = :controle
"GROUP BY ctrl.id_controle"); GROUP BY ctrl.id_controle");
$getMoyenne->execute(array( ':controle' => $controle )); $getMoyenne->execute(array( ':controle' => $controle ));
if( $fetchObj = $getMoyenne->fetch() ) if( $fetchObj = $getMoyenne->fetch() )
@ -231,13 +231,13 @@ class noteRepo extends DBAccess{
============================================================================*/ ============================================================================*/
if( !($noteUID=noteRepo::UID($etudiant, $controle)) ){ if( !($noteUID=noteRepo::UID($etudiant, $controle)) ){
$creationNote = DataBase::getPDO()->prepare("INSERT INTO note(id_note, id_appartenance, id_controle, valeur) ". $creationNote = DataBase::getPDO()->prepare("INSERT INTO note(id_note, id_appartenance, id_controle, valeur)
"VALUES(". VALUES(
"DEFAULT, ". DEFAULT,
"(SELECT id_appartenance FROM appartenance WHERE id_etudiant = :etudiant AND id_semestre = :semestre), ". (SELECT id_appartenance FROM appartenance WHERE id_etudiant = :etudiant AND id_semestre = :semestre),
":controle, ". :controle,
":valeur". :valeur.
")"); )");
$creationNote->execute(array( ':etudiant' => $etudiant, ':semestre' => $semestre, ':controle' => $controle, ':valeur' => $valeur )); $creationNote->execute(array( ':etudiant' => $etudiant, ':semestre' => $semestre, ':controle' => $controle, ':valeur' => $valeur ));

View File

@ -57,10 +57,10 @@ class semestreRepo extends DBAccess{
*/ */
public static function info($semestreUID){ public static function info($semestreUID){
// on considère que le semestre existe // 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 ". $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 ". FROM semestre as s, formation as f
"WHERE s.id_formation = f.id_formation ". WHERE s.id_formation = f.id_formation
"AND s.id_semestre = :semestreUID"); AND s.id_semestre = :semestreUID");
$getSemestreInfo->execute(array( ':semestreUID' => $semestreUID )); $getSemestreInfo->execute(array( ':semestreUID' => $semestreUID ));
// on retourne le résultat en supprimant les doublons à indices numériques // on retourne le résultat en supprimant les doublons à indices numériques
@ -89,15 +89,15 @@ class semestreRepo extends DBAccess{
// on formate les variables // on formate les variables
$semestre_pair = ($semestre_pair) ? '0' : '1'; $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 ". $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 ". FROM semestre as s, appartenance as app, formation as f
"WHERE s.id_formation = f.id_formation ". WHERE s.id_formation = f.id_formation
"AND app.id_semestre = s.id_semestre ". AND app.id_semestre = s.id_semestre
"AND app.id_etudiant = :etudiant ". AND app.id_etudiant = :etudiant
"AND s.annee = :annee ". AND s.annee = :annee
"AND s.rang % 2 = :semestre_pair ". AND s.rang % 2 = :semestre_pair
"ORDER BY s.rang DESC"); ORDER BY s.rang DESC");
$getSemestreUID->execute(array( $getSemestreUID->execute(array(
':etudiant' => $etudiant, ':etudiant' => $etudiant,
':annee' => $annee, ':annee' => $annee,
@ -122,17 +122,17 @@ class semestreRepo extends DBAccess{
* *
*/ */
public static function forTeacher($enseignant, $semestre_pair, $annee){ 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 ". $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 ". 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 WHERE s.id_semestre = mcc_ue.id_semestre
"AND s.id_formation = f.id_formation ". // semestre <-> formation AND s.id_formation = f.id_formation
"AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". // mcc_ue <-> mcc_module AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue
"AND mcc_m.id_mcc_module = ens.id_mcc_module ". // mcc_module <-> enseignement AND mcc_m.id_mcc_module = ens.id_mcc_module
"AND ens.id_enseignant = :enseignant ". AND ens.id_enseignant = :enseignant
"AND s.rang % 2 = :semestre_pair ". AND s.rang % 2 = :semestre_pair
"AND s.annee = :annee ". AND s.annee = :annee
"ORDER BY s.rang ASC"); ORDER BY s.rang ASC");
$getSemestreList->execute(array( ':enseignant' => $enseignant, ':semestre_pair' => ($semestre_pair) ? '0' : '1', ':annee' => $annee )); $getSemestreList->execute(array( ':enseignant' => $enseignant, ':semestre_pair' => ($semestre_pair) ? '0' : '1', ':annee' => $annee ));
return DataBase::delNumeric( $getSemestreList->fetchAll() ); return DataBase::delNumeric( $getSemestreList->fetchAll() );
@ -149,11 +149,11 @@ class semestreRepo extends DBAccess{
* *
*/ */
public static function forYear($annee){ 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 ". $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 ". FROM semestre as s, formation as f
"WHERE s.id_formation = f.id_formation ". WHERE s.id_formation = f.id_formation
"AND annee = :annee ". AND annee = :annee
"ORDER BY rang ASC"); ORDER BY rang ASC");
$getSemestreList->execute(array( ':annee' => $annee )); $getSemestreList->execute(array( ':annee' => $annee ));
return DataBase::delNumeric( $getSemestreList->fetchAll() ); return DataBase::delNumeric( $getSemestreList->fetchAll() );

View File

@ -57,15 +57,15 @@ class ueRepo extends DBAccess{
*/ */
public static function forStudent($etudiant, $semestre){ public static function forStudent($etudiant, $semestre){
// on récupère les modules // 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 ". $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 ". FROM appartenance as app, semestre as s, mcc_ue, ue
"WHERE app.id_semestre = s.id_semestre ". WHERE app.id_semestre = s.id_semestre
"AND mcc_ue.id_semestre = s.id_semestre ". AND mcc_ue.id_semestre = s.id_semestre
"AND mcc_ue.id_ue = ue.id_ue ". AND mcc_ue.id_ue = ue.id_ue
"AND app.id_etudiant = :etudiant ". AND app.id_etudiant = :etudiant
"AND s.id_semestre = :semestre ". AND s.id_semestre = :semestre
"ORDER BY ue.nom, ue.libelle"); ORDER BY ue.nom, ue.libelle");
$getUesForStudent->execute(array( ':etudiant' => $etudiant, ':semestre' => $semestre )); $getUesForStudent->execute(array( ':etudiant' => $etudiant, ':semestre' => $semestre ));
return DataBase::delNumeric( $getUesForStudent->fetchAll() ); return DataBase::delNumeric( $getUesForStudent->fetchAll() );
@ -83,18 +83,18 @@ class ueRepo extends DBAccess{
*/ */
public static function forTeacher($enseignant, $semestre){ public static function forTeacher($enseignant, $semestre){
// on récupère les modules // 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 ". $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 ". 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 ". WHERE ens.id_mcc_module = mcc_m.id_mcc_module
"AND ens.correcteur = 1 ". // si l'enseignant est correcteur uniquement AND ens.correcteur = 1
"AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue
"AND mcc_ue.id_semestre = s.id_semestre ". AND mcc_ue.id_semestre = s.id_semestre
"AND mcc_ue.id_ue = ue.id_ue ". AND mcc_ue.id_ue = ue.id_ue
"AND ens.id_enseignant = :enseignant ". AND ens.id_enseignant = :enseignant
"AND s.id_semestre = :semestre ". 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 )); $getUesForTeacher->execute(array( ':enseignant' => $enseignant, ':semestre' => $semestre ));
return DataBase::delNumeric( $getUesForTeacher->fetchAll() ); return DataBase::delNumeric( $getUesForTeacher->fetchAll() );
@ -112,13 +112,13 @@ class ueRepo extends DBAccess{
*/ */
public static function forYear($semestre){ public static function forYear($semestre){
// on récupère les modules // 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 ". $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 ". FROM ue, mcc_ue, semestre as s
"WHERE ue.id_ue = mcc_ue.id_ue ". WHERE ue.id_ue = mcc_ue.id_ue
"AND mcc_ue.id_semestre = s.id_semestre ". AND mcc_ue.id_semestre = s.id_semestre
"AND s.id_semestre = :semestre ". AND s.id_semestre = :semestre
"ORDER BY s.rang, ue.nom, ue.libelle"); ORDER BY s.rang, ue.nom, ue.libelle");
$getUEList->execute(array( ':semestre' => $semestre )); $getUEList->execute(array( ':semestre' => $semestre ));
return DataBase::delNumeric( $getUEList->fetchAll() ); return DataBase::delNumeric( $getUEList->fetchAll() );
@ -155,8 +155,7 @@ class ueRepo extends DBAccess{
/* [3] On créé le nouvel UE /* [3] On créé le nouvel UE
=================================================================================================*/ =================================================================================================*/
$creationUE = DataBase::getPDO()->prepare("INSERT INTO ue(id_ue, nom, libelle) ". $creationUE = DataBase::getPDO()->prepare("INSERT INTO ue(id_ue, nom, libelle) VALUES(DEFAULT, :nom, :libelle)");
"VALUES(DEFAULT, :nom, :libelle)");
$creationUE->execute(array( $creationUE->execute(array(
':nom' => $nom, ':nom' => $nom,
':libelle' => $libelle ':libelle' => $libelle

View File

@ -36,27 +36,27 @@ class userRepo extends DBAccess{
/* [2] Cas on cherche si un étudiant est inscrit à un semestre /* [2] Cas on cherche si un étudiant est inscrit à un semestre
==============================================================*/ ==============================================================*/
$getUtilisateurUID = DataBase::getPDO()->prepare("SELECT u.identifiant as id ". $getUtilisateurUID = DataBase::getPDO()->prepare("SELECT u.identifiant as id
"FROM utilisateur as u, appartenance as app ". FROM utilisateur as u, appartenance as app
"WHERE u.identifiant = app.id_etudiant ". WHERE u.identifiant = app.id_etudiant
"AND u.identifiant = :identifiant ". AND u.identifiant = :identifiant
"AND app.id_semestre = :semestre"); AND app.id_semestre = :semestre");
$getUtilisateurUID->execute(array( ':identifiant' => $identifiant, ':semestre' => $semestre )); $getUtilisateurUID->execute(array( ':identifiant' => $identifiant, ':semestre' => $semestre ));
}elseif( is_bool($semestre_pair) && $annee != null ){ }elseif( is_bool($semestre_pair) && $annee != null ){
/* [2] Cas on cherche si un enseignant enseigne l'année donnée /* [2] Cas on cherche si un enseignant enseigne l'année donnée
==============================================================*/ ==============================================================*/
$getUtilisateurUID = DataBase::getPDO()->prepare("SELECT DISTINCT u.identifiant as id ". $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 ". FROM utilisateur as u, enseignement as ens, semestre as s, mcc_module as mcc_m, mcc_ue
"WHERE u.identifiant = ens.id_enseignant ". WHERE u.identifiant = ens.id_enseignant
"AND ens.id_mcc_module = mcc_m.id_mcc_module ". AND ens.id_mcc_module = mcc_m.id_mcc_module
"AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ". AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue
"AND mcc_ue.id_semestre = s.id_semestre ". AND mcc_ue.id_semestre = s.id_semestre
"AND u.identifiant = :identifiant ". AND u.identifiant = :identifiant
"AND s.rang % 2 = :semestre_pair ". AND s.rang % 2 = :semestre_pair
"AND s.annee = :annee"); AND s.annee = :annee");
$getUtilisateurUID->execute(array( ':identifiant' => $identifiant, ':semestre_pair' => ($semestre_pair) ? '0' : '1', ':annee' => $annee )); $getUtilisateurUID->execute(array( ':identifiant' => $identifiant, ':semestre_pair' => ($semestre_pair) ? '0' : '1', ':annee' => $annee ));
}else // si les paramètres sont pas bons }else // si les paramètres sont pas bons
@ -131,8 +131,8 @@ class userRepo extends DBAccess{
/* [3] On créé le nouvel utilisateur /* [3] On créé le nouvel utilisateur
=================================================================================================*/ =================================================================================================*/
$creationUtilisateur = DataBase::getPDO()->prepare("INSERT INTO utilisateur(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)"); VALUES(:identifiant, :prenom, :nom, :mail, :mdp, :droits)");
$creationUtilisateur->execute(array( $creationUtilisateur->execute(array(
':identifiant' => $identifiant, ':identifiant' => $identifiant,
':prenom' => $prenom, ':prenom' => $prenom,

View File

@ -471,7 +471,6 @@ if( permission('admin') ){ // si l'utilisateur est un admin
modules_switch_level_1($request, $answer); modules_switch_level_1($request, $answer);
// var_dump( $answer ); // var_dump( $answer );
if( $answer->request == 'success' ){ // si on a bien récupéré les membres du groupe if( $answer->request == 'success' ){ // si on a bien récupéré les membres du groupe
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
echo "<section name='managemcc' data-title='MCC' class='basic'>"; echo "<section name='managemcc' data-title='MCC' class='basic'>";