2015-11-12 10:19:58 +00:00
< ? 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 id_controle as id, id_mcc_module, intitule, base, coefficient, date_publication FROM controle WHERE id_controle = :controleUID " );
$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 () );
}
2015-11-13 18:07:36 +00:00
/* 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, 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_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 " );
$getControleList -> execute ( array ( ':enseignant' => $enseignant , ':module' => $module , ':semestre' => $semestre ));
return DataBase :: delNumeric ( $getControleList -> fetchAll () );
}
2015-11-12 10:19:58 +00:00
}