Modification design (bouton del) + Modification du modèle(BDD entre autres) l'admin peut choisir le caractère "publié" d'un contrôle ce qui permet de définir si les étudiants peuvent voir leur note pour ce contrôle (modification implémentée, visu étu à faire)

This commit is contained in:
xdrm-brackets 2015-12-01 19:01:05 +01:00
parent a8369ef98b
commit 1fa1c5547f
12 changed files with 179 additions and 8 deletions

View File

@ -363,6 +363,13 @@ select.active + .confirm,
} }
/* .pamp */
.confirm.pamp{
border-color: #f55b55;
color: #f55b55;
background-image: url(../src/validate@pamp.svg);
}
/* tr@hover */ /* tr@hover */
body.trHoverActivated tr:hover td select.active + .confirm, body.trHoverActivated tr:hover td select.active + .confirm,
body.trHoverActivated tr:hover td input.active + .confirm, body.trHoverActivated tr:hover td input.active + .confirm,

View File

@ -253,6 +253,28 @@ require_once __ROOT__.'/manager/database.php';
break; 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;

View File

@ -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 ***/ /*** retourne les notes par modules ***/

View File

@ -26,7 +26,7 @@ class controleRepo extends DBAccess{
/* [1] On cherche juste le contrôle avec l'id spécifié /* [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 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 WHERE ctrl.id_mcc_module = mcc_m.id_mcc_module
AND mcc_m.id_module = m.id_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 /* [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 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 WHERE ctrl.id_mcc_module = mcc_m.id_mcc_module
AND mcc_m.id_module = m.id_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<int> l'UID du contrôle en question
* @publication<Boolean> VRAI si visible, sinon FAUX
*
*
* @return fait<Boolean> 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 /* RENVOIE LES CONTROLES POUR UN MODULE ET SEMESTRE PARTICULIER
@ -90,7 +110,7 @@ class controleRepo extends DBAccess{
* *
*/ */
public static function forStudent($module, $semestre){ 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 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 WHERE ctrl.id_mcc_module = mcc_m.id_mcc_module
AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue 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){ 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 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 WHERE ens.id_mcc_module = mcc_m.id_mcc_module
AND mcc_m.id_mcc_module = ctrl.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){ 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 FROM module as m, mcc_module as mcc_m, mcc_ue, controle as ctrl
WHERE mcc_m.id_mcc_module = ctrl.id_mcc_module WHERE mcc_m.id_mcc_module = ctrl.id_mcc_module
AND mcc_m.id_module = m.id_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ÉÉ /* [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())"); VALUES(DEFAULT, :mcc_module, :nom, :libelle, 20, :coefficient, NOW())");
$creerControle->execute(array( ':mcc_module' => $mcc_module, ':nom' => $nom, ':libelle' => $libelle, ':coefficient' => $coefficient )); $creerControle->execute(array( ':mcc_module' => $mcc_module, ':nom' => $nom, ':libelle' => $libelle, ':coefficient' => $coefficient ));

View File

@ -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 */ /* GESTION DU DOSSIER ETUDIANT */
/*******************************/ /*******************************/
@ -430,4 +472,6 @@ if( studentCase != null ){
--> -->

0
page/_JS/home.js Normal file → Executable file
View File

View File

@ -108,7 +108,7 @@ if( roleSection != null ){
// liste des enseignements pour modules à supprimer ("Supprimer") // 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) // liste des enseignements à ajouter (BOUTON)
var addModules = document.querySelectorAll('#CONTAINER section[name=attributionrole] .set_correcteur'); var addModules = document.querySelectorAll('#CONTAINER section[name=attributionrole] .set_correcteur');

View File

@ -634,6 +634,12 @@ if( (permission('master') || permission('admin')) && $controleOpt == null ){ //
// echo '<td>'.number_format($controle['moyenne'], 2).'</td>'; // echo '<td>'.number_format($controle['moyenne'], 2).'</td>';
echo '<td><span class=unstressed>Coefficient</span> '.number_format($controle['coefficient'], 2).'</td>'; echo '<td><span class=unstressed>Coefficient</span> '.number_format($controle['coefficient'], 2).'</td>';
if( $controle['publication'] == '0' )
echo "<td><div class='confirm center active' data-ctrl='".$controle['id']."' data-publication='1'>publier</div></td>";
else
echo "<td><div class='confirm pamp center active' data-ctrl='".$controle['id']."' data-publication='0'>cacher</div></td>";
echo '</tr>'; echo '</tr>';
// echo "<tr class='noborder transparentbg'><td></td><td colspan=3><table class='basic col4'><tbody>"; // echo "<tr class='noborder transparentbg'><td></td><td colspan=3><table class='basic col4'><tbody>";

View File

@ -232,7 +232,7 @@ if( permission('admin') ){
echo "<td>".$module['nom']." - ".$module['libelle']."</td>"; echo "<td>".$module['nom']." - ".$module['libelle']."</td>";
echo "<td>".$ue['nom']." - ".$ue['libelle']."</td>"; echo "<td>".$ue['nom']." - ".$ue['libelle']."</td>";
echo "<td>".$semestre['formation']." - ".$semestre['nom']."</td>"; echo "<td>".$semestre['formation']." - ".$semestre['nom']."</td>";
echo "<td><div class='del enseignement' data-usr='".$user['id']."' data-mccmod='".$module['id_mcc_module']."'>Supprimer</div></td>"; echo "<td><div class='confirm pamp active enseignement' data-usr='".$user['id']."' data-mccmod='".$module['id_mcc_module']."'>Supprimer</div></td>";
echo "</tr>"; echo "</tr>";
echo "<tr ><td class='nopadding' colspan=4>"; echo "<tr ><td class='nopadding' colspan=4>";
foreach($module['groupes'] as $groupe){ foreach($module['groupes'] as $groupe){

59
src/validate@pamp.svg Executable file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
enable-background="new 45.6 168.9 504 504"
id="Layer_1"
version="1.1"
viewBox="45.6 168.9 468.79999 468.79999"
xml:space="preserve"
inkscape:version="0.48.4 r9939"
width="100%"
height="100%"
sodipodi:docname="validate.svg"><metadata
id="metadata11"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs9" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1056"
id="namedview7"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="1.3244222"
inkscape:cx="117.99013"
inkscape:cy="117.90095"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><circle
cx="297.60001"
cy="420.89999"
r="234.39999"
id="circle3"
sodipodi:cx="297.60001"
sodipodi:cy="420.89999"
sodipodi:rx="234.39999"
sodipodi:ry="234.39999"
style="fill:none"
transform="translate(-17.600012,-17.6)" /><polygon
points="170.4,436.6 264.1,530.3 447.2,347.3 416,316 264.1,467.8 201.6,405.3 "
id="polygon5"
style="fill:#f55b55;fill-opacity:1"
transform="translate(-17.600012,-17.6)" /></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

0
svg.php Normal file → Executable file
View File

0
xdoc/timeline.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB