Ajout affinage par formation enseigant@contrôles

This commit is contained in:
xdrm-brackets 2015-11-16 19:07:39 +01:00
parent 50c8c44453
commit d6d10b99fc
3 changed files with 55 additions and 17 deletions

View File

@ -5,7 +5,7 @@
/********************************/
/* GESTION DE L'AFFINAGE PAR UE */
/********************************/
var partList = document.querySelectorAll("#CONTAINER > section[name] > table.partlist[name=UE], #CONTAINER > section[name] > table.partlist[name=semestre]");
var partList = document.querySelectorAll("#CONTAINER > section[name] > table.partlist[name=UE], #CONTAINER > section[name] > table.partlist[name=semestre], #CONTAINER > section[name] > table.partlist[name=formation]");
for( var i = 0 ; i < partList.length ; i++ ){
@ -14,16 +14,29 @@ for( var i = 0 ; i < partList.length ; i++ ){
if( tableauParent.tagName == 'TABLE' && e.target.dataset.hasOwnProperty('value') ){
/* SI c'est une affinage par FORMATION */
if( tableauParent.getAttribute('name') == 'formation' ){
pageM.vars[1] = 'f:'+e.target.dataset.value;
if( pageM.vars.length > 2 ) // si un deuxième affinage existe, on le supprime lors du choix de la formation
pageM.vars.pop();
}
/* SI c'est une affinage par SEMESTRE */
if( tableauParent.getAttribute('name') == 'semestre' )
pageM.vars[1] = 's:'+e.target.dataset.value;
pageM.vars[2] = 's:'+e.target.dataset.value;
/* SI c'est un affinage par UE */
if( tableauParent.getAttribute('name') == 'UE' )
pageM.vars[1] = 'u:'+e.target.dataset.value;
pageM.vars[2] = 'u:'+e.target.dataset.value;
// si la formation n'est pas définie, on l'active
if( !/^f:/.test(pageM.vars[1]) )
if( document.querySelector('#CONTAINER > section[name] > table.partlist[name=formation] td[data-value].active') != null )
pageM.vars[1] = 'f:'+document.querySelector('#CONTAINER > section[name] > table.partlist[name=formation] td[data-value].active').dataset.value;
// si on a '*' comme valeur, on l'enlève
if( /\*$/.test(pageM.vars[1]) )
if( /\*$/.test(pageM.vars[2]) )
pageM.vars.pop();
reload();

View File

@ -32,7 +32,8 @@ for( var i = 0 ; i < partList.length ; i++ ){
// si la formation n'est pas définie, on l'active
if( !/^f:/.test(pageM.vars[1]) )
pageM.vars[1] = 'f:'+document.querySelector('#CONTAINER > section[name] > table.partlist[name=formation] option[data-value].active').dataset.formation;
if( document.querySelector('#CONTAINER > section[name] > table.partlist[name=formation] td[data-value].active') != null )
pageM.vars[1] = 'f:'+document.querySelector('#CONTAINER > section[name] > table.partlist[name=formation] td[data-value].active').dataset.value;
// si on a '*' comme valeur, on l'enlève
if( /\*$/.test(pageM.vars[2]) )
@ -44,6 +45,4 @@ for( var i = 0 ; i < partList.length ; i++ ){
}
-->

View File

@ -13,6 +13,7 @@ require_once __ROOT__.'/manager/career.php';
$etudiantOpt = null;
$ueOpt = null;
$semestreOpt = null;
$formationOpt = null;
// on cherche dans toutes les variables _get si on trouve des paramètres
foreach($_POST as $k=>$v){
@ -32,6 +33,9 @@ require_once __ROOT__.'/manager/career.php';
if( preg_match('/^s:(.+)$/', $k, $m) ) // s:nomSemestre
$semestreOpt = $m[1];
if( preg_match('/^f:(.+)$/', $k, $m) ) // f:codeFormation
$formationOpt = $m[1];
}
$controleOpt = ($controleOpt == null || $controleOpt == '*') ? null : $controleOpt;
@ -39,6 +43,7 @@ require_once __ROOT__.'/manager/career.php';
$etudiantOpt = ($etudiantOpt == null || $etudiantOpt == '*') ? null : $etudiantOpt;
$ueOpt = ($ueOpt == null || $ueOpt == '*') ? null : $ueOpt;
$semestreOpt = ($semestreOpt == null || $semestreOpt == '*') ? null : $semestreOpt;
$formationOpt = ($formationOpt == null || $formationOpt == '*') ? null : $formationOpt;
/****************************************
* *
@ -170,18 +175,41 @@ if( permission('teacher') && $controleOpt == null ){ // si c'est un enseignant e
/* ON RECUPERE UNE LISTE UNIQUE DES SEMESTRES */
$ListeNomsSemestres = array();
$ListeNomsFormations = array();
$ListeNomsUE = array();
foreach($answer->semestres as $semestre){
// on selectionne les formations présentes
foreach($answer->semestres as $semestre)
array_push( $ListeNomsFormations, $semestre['formation'] );
// si la formation optionnelle n'est pas définie ou pas dans la liste, on la définit
$ListeNomsFormations = array_unique($ListeNomsFormations);
if( $formationOpt == null || !in_array($formationOpt, $ListeNomsFormations) ) $formationOpt = $ListeNomsFormations[0];
foreach($answer->semestres as $semestre){ if( $semestre['formation'] == $formationOpt ){
array_push( $ListeNomsSemestres, $semestre['nom'] );
/* ON RECUPERE UNE LISTE UNIQUE DES UEs */
foreach($semestre['UElist'] as $UE)
array_push( $ListeNomsUE, $UE['nom'] );
}
}}
$ListeNomsSemestres = array_unique($ListeNomsSemestres);
$ListeNomsUE = array_unique($ListeNomsUE);
echo "<table class='partlist' name='formation'><tbody><tr>";
foreach($ListeNomsFormations as $NomFormation)
if( $NomFormation == $formationOpt ) // si c'est le semestre séléctionné
echo "<td data-value='".$NomFormation."' class='active'>".$NomFormation.'</td>';
else // sinon on affiche normalement
echo "<td data-value='".$NomFormation."'>".$NomFormation.'</td>';
echo "</tr></tbody></table>";
echo "<table class='partlist' name='semestre'><tbody><tr>";
if( $semestreOpt == null ) echo "<td data-value='*' class='active'>Tous</td>";
else echo "<td data-value='*'>Tous</td>";
@ -195,8 +223,6 @@ if( permission('teacher') && $controleOpt == null ){ // si c'est un enseignant e
echo "<table class='partlist' name='UE'><tbody><tr>";
if( $ueOpt == null ) echo "<td data-value='*' class='active'>Tous</td>";
else echo "<td data-value='*'>Tous</td>";
@ -214,7 +240,7 @@ if( permission('teacher') && $controleOpt == null ){ // si c'est un enseignant e
foreach($answer->semestres as $semestre){
if( $semestreOpt == null || $semestre['nom'] == $semestreOpt ){ // on affiche les semestres en fonction de l'affinage
if( ($semestreOpt == null || $semestre['nom'] == $semestreOpt) && ($formationOpt == null || $semestre['formation'] == $formationOpt) ){ // on affiche les semestres en fonction de l'affinage
foreach($semestre['UElist'] as $UE){ // pour chaque UE