Affichage de TOUS les groupes inscrit à un contrôle et plus seulement ceux qui ont au moins une note
This commit is contained in:
parent
2df2c85507
commit
0f779dc42a
|
@ -66,12 +66,12 @@ var connected = !( DOM.AUTH.children[0].innerHTML == 'Connexion' );
|
|||
pageM.setPage(null, 'page', DOM.CONTAINER, ['home', 'groups', 'modules', 'career', 'settings'] );
|
||||
|
||||
/* ON REMPLACE "F5" par le rechargement manuel */
|
||||
window.addEventListener('keydown', function(e){
|
||||
if( e.keyCode == 116 ){ // F5
|
||||
e.preventDefault();
|
||||
reload();
|
||||
}
|
||||
}, false);
|
||||
// window.addEventListener('keydown', function(e){
|
||||
// if( e.keyCode == 116 ){ // F5
|
||||
// e.preventDefault();
|
||||
// reload();
|
||||
// }
|
||||
// }, false);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -642,7 +642,7 @@ class DataBase{
|
|||
$UEList[$iter_ue]['modules'][$iter_mod]['controles'] = controleRepo::forTeacher($enseignantUID, $UEList[$iter_ue]['modules'][$iter_mod]['id'], $UEList[$iter_ue]['id_semestre']);
|
||||
|
||||
foreach($UEList[$iter_ue]['modules'][$iter_mod]['controles'] as $iter_ct=>$c)
|
||||
$UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['notes'] = noteRepo::forTeacher($UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['id']);
|
||||
$UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['grouplist'] = noteRepo::forTeacher($UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -679,7 +679,16 @@ class DataBase{
|
|||
=======================================*/
|
||||
}else{
|
||||
// on ajoute au controle['notes'] la liste des notes des groupes
|
||||
$controlObj['grouplist'] = noteRepo::forTeacher($controle, null);
|
||||
// $controlObj['grouplist'] = noteRepo::forTeacher($controle, null);
|
||||
|
||||
$controlObj['grouplist'] = groupRepo::forControle($controle);
|
||||
|
||||
foreach($controlObj['grouplist'] as $iter=>$grpe)
|
||||
if( $controleNotes = noteRepo::forGroupe($controle, $grpe['id_groupe']) ) // si le groupe a des notes, on les ajoutes
|
||||
$controlObj['grouplist'][$iter] = array_merge($controlObj['grouplist'][$iter], $controleNotes);
|
||||
|
||||
// var_dump( $controlObj );
|
||||
debug();
|
||||
}
|
||||
|
||||
return $controlObj;
|
||||
|
|
|
@ -98,6 +98,4 @@ class controleRepo extends DBAccess{
|
|||
return DataBase::delNumeric( $getControleList->fetchAll() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -281,6 +281,35 @@ class groupRepo extends DBAccess{
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RETOURNE LES GROUPES INSCRITS A UN CONTROLE
|
||||
*
|
||||
* @controle<int> l'UID du contrôle en question
|
||||
*
|
||||
*
|
||||
* @return groupes<Array> retourne un tableau contenant les groupes inscrits à ce contrôle
|
||||
* @return FALSE<Boolean> retourne FALSE si aucun groupe n'y est inscrit
|
||||
*
|
||||
*/
|
||||
public static function forControle($controle){
|
||||
$getGroupeList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe, g.nom ".
|
||||
"FROM groupe as g, appartenance as app, mcc_ue, mcc_module as mcc_m, controle as ctrl ".
|
||||
"WHERE app.id_groupe = g.id_groupe ".
|
||||
"AND ctrl.id_mcc_module = mcc_m.id_mcc_module ".
|
||||
"AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ".
|
||||
"AND app.id_semestre = mcc_ue.id_semestre ".
|
||||
|
||||
"AND ctrl.id_controle = :controle ".
|
||||
"ORDER BY g.nom ASC");
|
||||
$getGroupeList->execute(array( ':controle' => $controle ));
|
||||
|
||||
|
||||
return DataBase::delNumeric( $getGroupeList->fetchAll() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* RETOURNE TOUS LES GROUPES DES SEMESTRES COURANT D'UNE ANNÉE
|
||||
*
|
||||
* @semestre_pair<Boolean> VRAI si le semestre courant est pair
|
||||
|
|
|
@ -155,6 +155,40 @@ class noteRepo extends DBAccess{
|
|||
|
||||
|
||||
|
||||
/* RENVOIE LES STATISTIQUES ASSOCIÉES À UN CONTRÔLE POUR UN GROUPE SPÉCIFIQUE
|
||||
*
|
||||
* @controle<int> l'UID du controle concerné
|
||||
* @groupe<int> l'UID du groupe spécifique
|
||||
*
|
||||
*
|
||||
* @return notes<Array> retourne les stats des notes pour les groupes à ce contrôle
|
||||
* @return FALSE<Boolean> retourne FALSE si aucun résultat n'est trouvé
|
||||
*
|
||||
*/
|
||||
public static function forGroupe($controle, $groupe){
|
||||
$getNoteList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe, g.nom as groupe, n.id_note as id, n.id_appartenance, n.id_controle, AVG(n.valeur) as moyenne, min(n.valeur) as min, max(n.valeur) as max, COUNT(n.valeur) as nb_notes ".
|
||||
"FROM note as n, appartenance as app, semestre as s, controle as ctrl, mcc_ue, mcc_module as mcc_m, groupe as g ".
|
||||
"WHERE n.id_appartenance = app.id_appartenance ".
|
||||
"AND app.id_semestre = s.id_semestre ".
|
||||
"AND app.id_groupe = g.id_groupe ".
|
||||
"AND s.id_semestre = mcc_ue.id_semestre ".
|
||||
"AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ".
|
||||
"AND mcc_m.id_mcc_module = ctrl.id_mcc_module ".
|
||||
"AND n.id_controle = ctrl.id_controle ".
|
||||
|
||||
"AND ctrl.id_controle = :controle ".
|
||||
"AND app.id_groupe = :groupe ".
|
||||
|
||||
"GROUP BY g.id_groupe ".
|
||||
|
||||
"ORDER BY g.nom ASC");
|
||||
$getNoteList->execute(array( ':controle' => $controle, ':groupe' => $groupe ));
|
||||
|
||||
return $getNoteList->fetch();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* CRÉATION/MODIFICATION D'UNE NOTE POUR UN ETUDIANT À UN CONTRÔLE
|
||||
*
|
||||
* @etudiant<String> l'UID de l'étudiant en question
|
||||
|
|
|
@ -200,7 +200,7 @@ if( permission('teacher') && $controleOpt == null ){ // si c'est un enseignant e
|
|||
|
||||
echo "<td>".$module['nom']." - ".$module['libelle']."</td>";
|
||||
|
||||
if( count($controle['notes']) == 0 ) // si il y a au moins une note pour ce contrôle
|
||||
if( count($controle['grouplist']) == 0 ) // si il y a au moins une note pour ce contrôle
|
||||
echo '<td><span class=unstressed>Pas noté</span></td>';
|
||||
else
|
||||
echo '<td><span class=unstressed>Moyenne de</span> '.number_format($controle['moyenne'], 2).' <span class=unstressed>/</span> '.$controle['base'].'</td>';
|
||||
|
@ -209,22 +209,8 @@ if( permission('teacher') && $controleOpt == null ){ // si c'est un enseignant e
|
|||
echo '<td><span class=unstressed>Coefficient</span> '.number_format($controle['coefficient'], 2).'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo "<tr class='noborder transparentbg'><td></td><td colspan=3><table class='basic col4'><tbody>";
|
||||
|
||||
foreach($controle['notes'] as $note){ // on affiche la liste des élèves avec leurs notes
|
||||
echo "<tr>";
|
||||
echo "<td><span class='link grp ctrl' data-grp='".$note['groupe']."' data-ctrl='".$controle['id']."'>".$note['groupe']."</span></td>";
|
||||
if( $note['nb_notes'] == 1 )
|
||||
echo "<td>".$note['nb_notes']." <span class=unstressed>note</span></td>";
|
||||
else
|
||||
echo "<td>".$note['nb_notes']." <span class=unstressed>notes</span></td>";
|
||||
|
||||
echo "<td><span class=unstressed>Allant de</span> ".$note['min']." <span class=unstressed>à</span> ".$note['max']."</td>";
|
||||
echo "<td><span class=unstressed>Moyenne de </span>".number_format($note['moyenne'], 2)." <span class=unstressed>/</span> ".$controle['base']."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
echo '</tbody></table></td></tr>';
|
||||
// echo "<tr class='noborder transparentbg'><td></td><td colspan=3><table class='basic col4'><tbody>";
|
||||
// echo '</tbody></table></td></tr>';
|
||||
}
|
||||
|
||||
}else // si aucun contrôle pour ce module
|
||||
|
@ -314,19 +300,26 @@ elseif( permission('teacher') ){ // si enseignant et qu'un contrôle est spécif
|
|||
====================================================================================*/
|
||||
if( $groupeOpt == null ){
|
||||
|
||||
foreach($answer->controle['grouplist'] as $note){ // on affiche la liste des groupes avec leurs stats
|
||||
foreach($answer->controle['grouplist'] as $groupe){ // on affiche la liste des groupes avec leurs stats
|
||||
echo "<tr>";
|
||||
|
||||
echo "<td><span class='link grp ctrl' data-grp='".$note['groupe']."' data-ctrl='".$answer->controle['id']."'>".$note['groupe']."</span></td>";
|
||||
echo "<td><span class='link grp ctrl' data-grp='".$groupe['nom']."' data-ctrl='".$answer->controle['id']."'>".$groupe['nom']."</span></td>";
|
||||
|
||||
if( $note['nb_notes'] == 1 )
|
||||
echo "<td>".$note['nb_notes']." <span class=unstressed>note</span></td>";
|
||||
else
|
||||
echo "<td>".$note['nb_notes']." <span class=unstressed>notes</span></td>";
|
||||
if( isset($groupe['nb_notes']) ){ // si ce groupe a des notes
|
||||
|
||||
echo "<td><span class=unstressed>Allant de</span> ".$note['min']." <span class=unstressed>à</span> ".$note['max']."</td>";
|
||||
echo "<td><span class=unstressed>Moyenne de </span>".number_format($note['moyenne'], 2)." <span class=unstressed>/</span> ".$answer->controle['base']."</td>";
|
||||
if( $groupe['nb_notes'] == 1 ) echo "<td>".$groupe['nb_notes']." <span class=unstressed>note</span></td>";
|
||||
else echo "<td>".$groupe['nb_notes']." <span class=unstressed>notes</span></td>";
|
||||
|
||||
echo "<td><span class=unstressed>Allant de</span> ".number_format($groupe['min'], 2)." <span class=unstressed>à</span> ".number_format($groupe['max'], 2)."</td>";
|
||||
echo "<td><span class=unstressed>Moyenne de </span>".number_format($groupe['moyenne'], 2)." <span class=unstressed>/</span> ".$answer->controle['base']."</td>";
|
||||
|
||||
}else{ // si le groupe n'a aucune note
|
||||
|
||||
echo "<td><span class=unstressed>Pas de note</span></td>";
|
||||
echo "<td></td>";
|
||||
echo "<td></td>";
|
||||
|
||||
}
|
||||
|
||||
echo "</tr>";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue