diff --git a/css/global.css b/css/global.css index 2ec63a3..830bdd5 100755 --- a/css/global.css +++ b/css/global.css @@ -363,6 +363,13 @@ select.active + .confirm, } +/* .pamp */ +.confirm.pamp{ + border-color: #f55b55; + color: #f55b55; + background-image: url(../src/validate@pamp.svg); +} + /* tr@hover */ body.trHoverActivated tr:hover td select.active + .confirm, body.trHoverActivated tr:hover td input.active + .confirm, diff --git a/manager/career.php b/manager/career.php index 705162f..7f29fc7 100755 --- a/manager/career.php +++ b/manager/career.php @@ -253,6 +253,28 @@ require_once __ROOT__.'/manager/database.php'; break; + /*********************************************************/ + /* définie le caractère "publié" des notes d'un contrôle */ + /*********************************************************/ + case 'publicationcontrole': if( permission('admin') && $_SESSION['annee'] >= getCurrentYear() ){ + + $areSetParam = isset($request->controle) && isset($request->publication); // les arguments existent + $typeOkParam = $areSetParam && is_numeric($request->controle) && is_bool($request->publication); // si les types sont bons + + if( $typeOkParam ){ // si tout les paramètres sont bons + if( DataBase::getInstance()->publicationControle($request->controle, $request->publication) ) + $answer->request = 'success'; + else + $answer->request = 'error'; + + }else + $answer->request = 'param_error'; + + }else + $answer->request = 'permission_error'; + break; + + diff --git a/manager/database.php b/manager/database.php index 656bb3d..a635afa 100755 --- a/manager/database.php +++ b/manager/database.php @@ -744,6 +744,19 @@ class DataBase{ /*******************************************/ + /*********************************************************/ + /* définie le caractère "publié" des notes d'un contrôle */ + /*********************************************************/ + public function publicationControle($controle, $publication){ + // on vérifie l'existence du contrôle en question + if( !($controleObj=controleRepo::info($controle)) ) return 'unknown_controle'; + + // on met à jour le caractère "publié" du contrôle + return controleRepo::publication($controleObj['id'], $publication); + } + + + /**************************************/ /*** retourne les notes par modules ***/ diff --git a/manager/repo/controle.php b/manager/repo/controle.php index 29466e8..729d5ff 100755 --- a/manager/repo/controle.php +++ b/manager/repo/controle.php @@ -26,7 +26,7 @@ class controleRepo extends DBAccess{ /* [1] On cherche juste le contrôle avec l'id spécifié ============================================================*/ - $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 + $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.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 @@ -45,7 +45,7 @@ class controleRepo extends DBAccess{ /* [2] On cherche le contrôle avec l'id spécifié qu'enseignant l'@enseignant ==============================================================================*/ - $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 + $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.publication 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 @@ -79,6 +79,26 @@ class controleRepo extends DBAccess{ + /* MODIFIE LA VISIBILITÉ DES NOTES D'UN CONTRÔLES AUX ÉTUDIANTS + * + * @controle l'UID du contrôle en question + * @publication VRAI si visible, sinon FAUX + * + * + * @return fait retourne VRAI si tout s'est bien passé + * + */ + public static function publication($controle, $publication){ + $updatePublicationControle = DataBase::getPDO()->prepare("UPDATE controle SET publication = :publication WHERE id_controle = :controle"); + $updatePublicationControle->execute(array( ':publication' => ($publication) ? 1 : 0, ':controle' => $controle )); + + + $verifControlePublication = DataBase::getPDO()->prepare("SELECT id_controle as id FROM controle WHERE id_controle = :controle AND publication = :publication"); + $verifControlePublication->execute(array( ':controle' => $controle, ':publication' => ($publication) ? 1 : 0 )); + + return is_numeric( $verifControlePublication->fetch()['id'] ); + } + /* RENVOIE LES CONTROLES POUR UN MODULE ET SEMESTRE PARTICULIER @@ -90,7 +110,7 @@ class controleRepo extends DBAccess{ * */ public static function forStudent($module, $semestre){ - $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 + $getControleList = DataBase::getPDO()->prepare("SELECT DISTINCT ctrl.id_controle as id, ctrl.nom, ctrl.id_mcc_module, ctrl.libelle, ctrl.base, ctrl.coefficient, ctrl.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 @@ -118,7 +138,7 @@ class controleRepo extends DBAccess{ * */ public static function forTeacher($enseignant, $module, $semestre){ - $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 + $getControleList = DataBase::getPDO()->prepare("SELECT DISTINCT ctrl.id_controle as id, ctrl.nom, ctrl.id_mcc_module, ctrl.libelle, ctrl.base, ctrl.coefficient, ctrl.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 @@ -150,7 +170,7 @@ class controleRepo extends DBAccess{ * */ public static function forYear($module, $semestre){ - $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 + $getControleList = DataBase::getPDO()->prepare("SELECT DISTINCT ctrl.id_controle as id, ctrl.nom, ctrl.id_mcc_module, ctrl.libelle, ctrl.base, ctrl.coefficient, ctrl.publication FROM module as m, mcc_module as mcc_m, mcc_ue, controle as ctrl WHERE mcc_m.id_mcc_module = ctrl.id_mcc_module AND mcc_m.id_module = m.id_module @@ -202,7 +222,7 @@ class controleRepo extends DBAccess{ /* [1] SI LE CONTRÔLE N'EXISTE PAS => ON LE CRÉÉ =====================================================*/ - $creerControle = DataBase::getPDO()->prepare("INSERT INTO controle(id_controle, id_mcc_module, nom, libelle, base, coefficient, date_publication) + $creerControle = DataBase::getPDO()->prepare("INSERT INTO controle(id_controle, id_mcc_module, nom, libelle, base, coefficient, publication) VALUES(DEFAULT, :mcc_module, :nom, :libelle, 20, :coefficient, NOW())"); $creerControle->execute(array( ':mcc_module' => $mcc_module, ':nom' => $nom, ':libelle' => $libelle, ':coefficient' => $coefficient )); diff --git a/page/_JS/career.js b/page/_JS/career.js index e208ce1..dad7364 100755 --- a/page/_JS/career.js +++ b/page/_JS/career.js @@ -394,6 +394,48 @@ if( document.querySelector('#CONTAINER section[name=allcontroles]') != null ){ / +/* GESTION DE PUBLICATION DES NOTES D'UN CONTRÔLE */ +var publicationControles = document.querySelectorAll('#CONTAINER > section[name=allcontroles] .confirm.center.active[data-ctrl][data-publication]'); +// si des boutons existent sur la page (au moins 1) +if( publicationControles.length > 0 ){ + + // pour chaque bouton, on créé l'évènement + for( var i = 0 ; i < publicationControles.length ; i++ ){ + + publicationControles[i].addEventListener('click', function(e){ + // si l'élément est correct (contient les informations nécessaires) + if( e.target.dataset.hasOwnProperty('ctrl') && e.target.dataset.hasOwnProperty('publication') ){ + // on prépare la requête + var request = { + level_0: 'career', + level_1: 'publicationcontrole', + controle: e.target.dataset.ctrl, + publication: (e.target.dataset.publication=='0') ? false : true + }; + + // on envoie la requête vers l'API + API.send(request, function(answer){ + if( answer.request == 'success' ) reload(); + }); + } + }, false); + + } + +} + + + + + + + + + + + + + /*******************************/ /* GESTION DU DOSSIER ETUDIANT */ /*******************************/ @@ -430,4 +472,6 @@ if( studentCase != null ){ + + --> \ No newline at end of file diff --git a/page/_JS/home.js b/page/_JS/home.js old mode 100644 new mode 100755 diff --git a/page/_JS/settings.js b/page/_JS/settings.js index 3ac9f75..985496c 100755 --- a/page/_JS/settings.js +++ b/page/_JS/settings.js @@ -108,7 +108,7 @@ if( roleSection != null ){ // liste des enseignements pour modules à supprimer ("Supprimer") - var delModules = document.querySelectorAll('#CONTAINER section[name=attributionrole] .del.enseignement[data-usr][data-mccmod]'); + var delModules = document.querySelectorAll('#CONTAINER section[name=attributionrole] .confirm.pamp.active.enseignement[data-usr][data-mccmod]'); // liste des enseignements à ajouter (BOUTON) var addModules = document.querySelectorAll('#CONTAINER section[name=attributionrole] .set_correcteur'); diff --git a/page/career.php b/page/career.php index 1e976b7..eaf291b 100755 --- a/page/career.php +++ b/page/career.php @@ -634,6 +634,12 @@ if( (permission('master') || permission('admin')) && $controleOpt == null ){ // // echo ''.number_format($controle['moyenne'], 2).''; echo 'Coefficient '.number_format($controle['coefficient'], 2).''; + + if( $controle['publication'] == '0' ) + echo "
publier
"; + else + echo "
cacher
"; + echo ''; // echo ""; diff --git a/page/settings.php b/page/settings.php index eed3dcc..13769da 100755 --- a/page/settings.php +++ b/page/settings.php @@ -232,7 +232,7 @@ if( permission('admin') ){ echo ""; echo ""; echo ""; - echo ""; + echo ""; echo ""; echo "
".$module['nom']." - ".$module['libelle']."".$ue['nom']." - ".$ue['libelle']."".$semestre['formation']." - ".$semestre['nom']."
Supprimer
Supprimer
"; foreach($module['groupes'] as $groupe){ diff --git a/src/validate@pamp.svg b/src/validate@pamp.svg new file mode 100755 index 0000000..45bec1c --- /dev/null +++ b/src/validate@pamp.svg @@ -0,0 +1,59 @@ + +image/svg+xml \ No newline at end of file diff --git a/svg.php b/svg.php old mode 100644 new mode 100755 diff --git a/xdoc/timeline.svg b/xdoc/timeline.svg old mode 100644 new mode 100755