diff --git a/page/_JS/career.js b/page/_JS/career.js index e68d675..f95f7cf 100644 --- a/page/_JS/career.js +++ b/page/_JS/career.js @@ -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(); diff --git a/page/_JS/modules.js b/page/_JS/modules.js index 14cfbe8..3229198 100644 --- a/page/_JS/modules.js +++ b/page/_JS/modules.js @@ -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++ ){ } - - --> \ No newline at end of file diff --git a/page/career.php b/page/career.php index ff565cf..8c643ac 100755 --- a/page/career.php +++ b/page/career.php @@ -8,11 +8,12 @@ require_once __ROOT__.'/manager/career.php'; /*** GESTION DES PARAMETRES OPTIONNELS ***/ // on initialise les paramètres optionnels - $controleOpt = null; - $groupeOpt = null; - $etudiantOpt = null; - $ueOpt = null; - $semestreOpt = null; + $controleOpt = null; + $groupeOpt = null; + $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 ""; + foreach($ListeNomsFormations as $NomFormation) + if( $NomFormation == $formationOpt ) // si c'est le semestre séléctionné + echo "'; + else // sinon on affiche normalement + echo "'; + echo "
".$NomFormation.'".$NomFormation.'
"; + + + echo ""; if( $semestreOpt == null ) echo ""; else echo ""; @@ -195,8 +223,6 @@ if( permission('teacher') && $controleOpt == null ){ // si c'est un enseignant e - - echo "
TousTous
"; if( $ueOpt == null ) echo ""; else echo ""; @@ -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
TousTous