99 lines
4.0 KiB
PHP
Executable File
99 lines
4.0 KiB
PHP
Executable File
<?php require_once __ROOT__.'/manager/security.php';
|
|
|
|
/************************************************************************************/
|
|
/* ____ ___ _ _ _____ ____ ___ _ _____ ____ _____ ____ ___ */
|
|
/* / ___/ _ \| \ | |_ _| _ \ / _ \| | | ____| | _ \| ____| _ \ / _ \ */
|
|
/* | | | | | | \| | | | | |_) | | | | | | _| | |_) | _| | |_) | | | | */
|
|
/* | |__| |_| | |\ | | | | _ <| |_| | |___| |___ | _ <| |___| __/| |_| | */
|
|
/* \____\___/|_| \_| |_| |_| \_\\___/|_____|_____| |_| \_\_____|_| \___/ */
|
|
/* */
|
|
/************************************************************************************/
|
|
|
|
class controleRepo extends DBAccess{
|
|
/* RENVOIE LES INFORMATIONS D'UN CONTROLE D'UID DONNÉ
|
|
*
|
|
* @controleUID<int> l'UID du controle duquel on veut les infos
|
|
*
|
|
* @return controle<Array> tableau associatif contenant tout les champs de la BDD pour ce controle
|
|
*
|
|
*/
|
|
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 ".
|
|
|
|
"AND ctrl.id_controle = :controleUID ".
|
|
|
|
"GROUP BY ctrl.id_controle");
|
|
$getControleInfo->execute(array(
|
|
':controleUID' => $controleUID
|
|
));
|
|
|
|
// on retourne le résultat en supprimant les doublons à indices numériques
|
|
return $getControleInfo->fetch();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* RENVOIE LES CONTROLES POUR UN MODULE ET SEMESTRE PARTICULIER
|
|
*
|
|
* @module<int> l'UID du module concerné
|
|
* @semestre<int> l'UID du semestre concerné
|
|
*
|
|
* @return controles<Array> retourne les controles d'un étudiant pour un controle particulier
|
|
*
|
|
*/
|
|
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 ".
|
|
|
|
"AND mcc_m.id_module = :module ".
|
|
"AND s.id_semestre = :semestre");
|
|
$getControleList->execute(array( ':module' => $module, ':semestre' => $semestre ));
|
|
|
|
return DataBase::delNumeric( $getControleList->fetchAll() );
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* RENVOIE LES CONTROLES QU'UN ENSEIGNANT PEUT CORRIGER POUR UN MODULE ET SEMESTRE PARTICULIER
|
|
*
|
|
* @enseignant<String> l'identifiant de l'enseignant
|
|
* @module<int> l'UID du module concerné
|
|
* @semestre<int> l'UID du semestre concerné
|
|
*
|
|
* @return controles<Array> retourne les controles q'un enseignant peut corriger pour un module d'un 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 ".
|
|
"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 ".
|
|
|
|
"GROUP BY ctrl.id_controle");
|
|
$getControleList->execute(array( ':enseignant' => $enseignant, ':module' => $module, ':semestre' => $semestre ));
|
|
|
|
return DataBase::delNumeric( $getControleList->fetchAll() );
|
|
}
|
|
|
|
} |