Correction repo UE
This commit is contained in:
parent
e99080f324
commit
db6fa9ff3e
|
@ -19,7 +19,7 @@ class ueRepo extends DBAccess{
|
|||
*
|
||||
*/
|
||||
public static function UID($nom){
|
||||
$getUEUID = DataBase::getPDO()->prepare("SELECT id_ue as id FROM ue WHERE nom = :nom");
|
||||
$getUEUID = DataBase::getPDO()->prepare("SELECT DISTINCT id_ue as id FROM ue WHERE nom = :nom");
|
||||
$getUEUID->execute(array( ':nom' => $nom ));
|
||||
|
||||
// on retourne le résultat : FAUX si aucun résultat, sinon la valeur de l'UID du module
|
||||
|
@ -37,7 +37,7 @@ class ueRepo extends DBAccess{
|
|||
*
|
||||
*/
|
||||
public static function info($UEUID){
|
||||
$getUEInfo = DataBase::getPDO()->prepare("SELECT id_ue as id, nom, libelle FROM ue WHERE id_ue = :UEUID");
|
||||
$getUEInfo = DataBase::getPDO()->prepare("SELECT DISTINCT id_ue as id, nom, libelle FROM ue WHERE id_ue = :UEUID");
|
||||
$getUEInfo->execute(array( ':UEUID' => $UEUID ));
|
||||
|
||||
// on retourne le résultat en supprimant les doublons à indices numériques
|
||||
|
@ -57,7 +57,7 @@ class ueRepo extends DBAccess{
|
|||
*/
|
||||
public static function forStudent($etudiant, $semestre){
|
||||
// on récupère les modules
|
||||
$getUesForStudent = DataBase::getPDO()->prepare("SELECT ue.id_ue as id, s.annee, ue.nom, ue.libelle ".
|
||||
$getUesForStudent = DataBase::getPDO()->prepare("SELECT DISTINCT ue.id_ue as id, 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 ".
|
||||
|
@ -76,24 +76,27 @@ class ueRepo extends DBAccess{
|
|||
/* RENVOIE LA LISTE DES UEs QU'ENSEIGNE UN ENSEIGNANT POUR UNE ANNEE
|
||||
*
|
||||
* @enseignant<String> Identifiant de l'enseignant
|
||||
* @semestre_pair<Boolean> VRAI si le semestre est pair
|
||||
* @annee<int> l'année en cours
|
||||
*
|
||||
* @return UEs<Array> retourne un tableau contenant les UEs de l'enseignant pour cette année
|
||||
*
|
||||
*/
|
||||
public static function forTeacher($enseignant, $annee){
|
||||
public static function forTeacher($enseignant, $semestre_pair, $annee){
|
||||
// on récupère les modules
|
||||
$getUesForTeacher = DataBase::getPDO()->prepare("SELECT DISTINCT ue.id_ue as id, s.annee as annee, ue.nom as nom, ue.libelle as libelle ".
|
||||
$getUesForTeacher = DataBase::getPDO()->prepare("SELECT DISTINCT ue.id_ue as id, s.annee, s.rang, 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 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.rang % 2 = :semestre_pair ".
|
||||
"AND s.annee = :annee ".
|
||||
|
||||
"ORDER BY ue.nom, ue.libelle ASC");
|
||||
$getUesForTeacher->execute(array( ':enseignant' => $enseignant, ':annee' => $annee ));
|
||||
$getUesForTeacher->execute(array( ':enseignant' => $enseignant, ':semestre_pair' => ($semestre_pair) ? '0' : '1', ':annee' => $annee ));
|
||||
|
||||
return DataBase::delNumeric( $getUesForTeacher->fetchAll() );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue