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
|
|
|
|
*
|
2015-11-19 07:58:15 +00:00
|
|
|
* @enseignant<String> ***OPTIONNEL*** l'UID de l'ensseignant
|
|
|
|
*
|
|
|
|
*
|
2015-11-14 17:33:06 +00:00
|
|
|
* @return controle<Array> tableau associatif contenant tout les champs de la BDD pour ce controle
|
2015-11-12 10:19:58 +00:00
|
|
|
*
|
|
|
|
*/
|
2015-11-19 07:58:15 +00:00
|
|
|
public static function info($controleUID, $enseignant=null){
|
|
|
|
if( $enseignant == null ){
|
|
|
|
|
|
|
|
/* [1] On cherche juste le contrôle avec l'id spécifié
|
|
|
|
============================================================*/
|
|
|
|
|
2015-11-20 16:13:47 +00:00
|
|
|
$getControleInfo = DataBase::getPDO()->prepare("SELECT ctrl.id_controle as id, ctrl.nom, ctrl.id_mcc_module, m.nom as module, m.libelle as modulelib, s.id_semestre, ctrl.libelle, ctrl.base, ctrl.coefficient, ctrl.date_publication
|
2015-11-19 07:58:15 +00:00
|
|
|
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
|
|
|
|
));
|
|
|
|
|
|
|
|
}else{ // cas où on cherche un contrôle qu'un enseignant corrige
|
|
|
|
|
|
|
|
/* [2] On cherche le contrôle avec l'id spécifié qu'enseignant l'@enseignant
|
|
|
|
==============================================================================*/
|
2015-11-20 16:13:47 +00:00
|
|
|
$getControleInfo = DataBase::getPDO()->prepare("SELECT ctrl.id_controle as id, ctrl.nom, ctrl.id_mcc_module, m.nom as module, m.libelle as modulelib, s.id_semestre, ctrl.libelle, ctrl.base, ctrl.coefficient, ctrl.date_publication
|
2015-11-19 07:58:15 +00:00
|
|
|
FROM controle as ctrl, mcc_module as mcc_m, mcc_ue, semestre as s, module as m, enseignement as ens
|
|
|
|
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 ens.id_mcc_module = mcc_m.id_mcc_module
|
|
|
|
AND ens.correcteur = 1
|
|
|
|
AND ens.id_enseignant = :enseignant
|
|
|
|
|
|
|
|
AND ctrl.id_controle = :controleUID
|
|
|
|
|
|
|
|
GROUP BY ctrl.id_controle");
|
|
|
|
$getControleInfo->execute(array(
|
|
|
|
':enseignant' => $enseignant,
|
|
|
|
':controleUID' => $controleUID
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2015-11-12 10:19:58 +00:00
|
|
|
|
|
|
|
// 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){
|
2015-11-20 16:13:47 +00:00
|
|
|
$getControleList = DataBase::getPDO()->prepare("SELECT DISTINCT ctrl.id_controle as id, ctrl.nom, ctrl.id_mcc_module, ctrl.libelle, ctrl.base, ctrl.coefficient, ctrl.date_publication
|
2015-11-17 12:00:50 +00:00
|
|
|
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");
|
2015-11-12 10:19:58 +00:00
|
|
|
$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){
|
2015-11-20 16:13:47 +00:00
|
|
|
$getControleList = DataBase::getPDO()->prepare("SELECT DISTINCT ctrl.id_controle as id, ctrl.nom, ctrl.id_mcc_module, ctrl.libelle, ctrl.base, ctrl.coefficient, ctrl.date_publication
|
2015-11-17 12:00:50 +00:00
|
|
|
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");
|
2015-11-13 18:07:36 +00:00
|
|
|
$getControleList->execute(array( ':enseignant' => $enseignant, ':module' => $module, ':semestre' => $semestre ));
|
|
|
|
|
|
|
|
return DataBase::delNumeric( $getControleList->fetchAll() );
|
|
|
|
}
|
|
|
|
|
2015-11-12 10:19:58 +00:00
|
|
|
}
|