2015-11-11 14:50:05 +00:00
|
|
|
<!--
|
|
|
|
|
2015-10-22 12:06:49 +00:00
|
|
|
|
2015-11-26 20:54:01 +00:00
|
|
|
/* GESTION DU LIEN VERS LE DOSSIER ETUDIANT (admin/master) */
|
|
|
|
var canSeeStudent = document.querySelector('#CONTAINER > section[name=movestudents]') != null;
|
|
|
|
if( canSeeStudent ){
|
|
|
|
var liensVersDossierEtu = document.querySelectorAll('#CONTAINER > section[name] .link');
|
|
|
|
|
|
|
|
// pour chaque lien, on créé l'évènement
|
|
|
|
for( var i = 0 ; i < liensVersDossierEtu.length ; i++ ){
|
|
|
|
|
|
|
|
liensVersDossierEtu[i].addEventListener('click', function(e){
|
|
|
|
pageM.vars = [];
|
|
|
|
pageM.vars[0] = 'studentcase'; // on définit la sous-section
|
|
|
|
pageM.vars[1] = 'e:'+e.target.innerHTML;
|
|
|
|
selectSection('career');
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2015-10-22 12:06:49 +00:00
|
|
|
|
2015-10-28 17:08:12 +00:00
|
|
|
|
2015-10-31 16:25:19 +00:00
|
|
|
|
|
|
|
|
2016-01-02 13:21:31 +00:00
|
|
|
var canMoveStudents = document.querySelector('#CONTAINER section[name=movestudents]') != null;
|
|
|
|
canMoveStudents = canMoveStudents && document.querySelectorAll('#CONTAINER section[name=movestudents] table tr td input.deplacer_etu[data-usr]').length > 0;
|
|
|
|
canMoveStudents = canMoveStudents && document.querySelectorAll('#CONTAINER section[name=movestudents] table tr td .deplacement_groupe[data-stre]').length > 0;
|
|
|
|
canMoveStudents = canMoveStudents && document.querySelectorAll('#CONTAINER section[name=movestudents] table tr td .valider_deplacement').length > 0;
|
|
|
|
canMoveStudents = canMoveStudents && document.querySelector('#CONTAINER section[name=movestudents] table tr td .deplacement_groupe[data-stre]') != null;
|
|
|
|
canMoveStudents = canMoveStudents && document.querySelector('#CONTAINER section[name=movestudents] table tr td .deplacement_groupe[data-stre]') != null;
|
|
|
|
|
2015-10-31 16:25:19 +00:00
|
|
|
|
2015-11-15 12:02:34 +00:00
|
|
|
/* GESTION DU DEPLACEMENT D'ELEVES */
|
2016-01-02 13:21:31 +00:00
|
|
|
if( canMoveStudents ){ // si c'set l'admin
|
2015-10-28 17:08:12 +00:00
|
|
|
|
2015-12-06 14:05:22 +00:00
|
|
|
var deplacementEtudiants = document.querySelectorAll('#CONTAINER section[name=movestudents] table tr td input.deplacer_etu[data-usr]');
|
|
|
|
var choixGroupeDestination = document.querySelectorAll('#CONTAINER section[name=movestudents] table tr td .deplacement_groupe[data-stre]');
|
|
|
|
var validerDeplacement = document.querySelectorAll('#CONTAINER section[name=movestudents] table tr td .valider_deplacement');
|
|
|
|
|
|
|
|
// contiendra les étudiants selectionnés
|
|
|
|
var etudiantsADeplacer = [];
|
|
|
|
// contiendra le groupe de destination
|
|
|
|
var destGroupe = document.querySelector('#CONTAINER section[name=movestudents] table tr td .deplacement_groupe[data-stre]').value;
|
|
|
|
var destSemestre = document.querySelector('#CONTAINER section[name=movestudents] table tr td .deplacement_groupe[data-stre]').dataset.stre;
|
|
|
|
|
2016-01-02 13:21:31 +00:00
|
|
|
|
|
|
|
|
2015-12-06 14:05:22 +00:00
|
|
|
/* LORSQU'ON "CHECK" UN ETUDIANT ON LE RAJOUTE A LA LISTE */
|
|
|
|
for( var i = 0 ; i < deplacementEtudiants.length ; i++ )
|
|
|
|
deplacementEtudiants[i].addEventListener('click', function(e){
|
|
|
|
var index = etudiantsADeplacer.indexOf(e.target.dataset.usr);
|
|
|
|
if( e.target.checked ) // si on active
|
|
|
|
etudiantsADeplacer.push( e.target.dataset.usr );
|
2015-11-13 17:00:17 +00:00
|
|
|
|
2015-12-06 14:05:22 +00:00
|
|
|
else if( index > -1 ) // sinon on enlève (si dans la liste)
|
|
|
|
etudiantsADeplacer = etudiantsADeplacer.slice(0, index).concat( etudiantsADeplacer.slice(index+1) );
|
2015-11-13 17:00:17 +00:00
|
|
|
}, false);
|
|
|
|
|
2015-12-06 14:05:22 +00:00
|
|
|
/* ON SYNCHRONISE TOUS LES SELECT */
|
|
|
|
for( var g = 0 ; g < choixGroupeDestination.length ; g++ )
|
|
|
|
choixGroupeDestination[g].addEventListener('change', function(e){
|
|
|
|
destGroupe = e.target.value;
|
|
|
|
destSemestre = e.target.dataset.stre;
|
|
|
|
|
|
|
|
for( var i = 0 ; i < choixGroupeDestination.length ; i++ )
|
|
|
|
choixGroupeDestination[i].value = e.target.value;
|
2015-11-13 17:00:17 +00:00
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
2015-10-31 17:16:54 +00:00
|
|
|
|
2015-12-06 14:05:22 +00:00
|
|
|
/* VALIDATION DE DEPLACEMENT */
|
|
|
|
for( var i = 0 ; i < validerDeplacement.length ; i++ )
|
|
|
|
validerDeplacement[i].addEventListener('click', function(e){
|
|
|
|
// on créé la requête
|
|
|
|
var request = {
|
|
|
|
level_0: 'groups',
|
|
|
|
level_1: 'move_multiple',
|
|
|
|
semestre: destSemestre,
|
|
|
|
etudiants: etudiantsADeplacer,
|
|
|
|
groupe: destGroupe
|
|
|
|
};
|
|
|
|
|
|
|
|
console.log( request );
|
|
|
|
// on envoie la requête
|
|
|
|
API.send(request, function(answer){
|
|
|
|
if( answer.request == 'success' ) reload();
|
|
|
|
});
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
2015-11-06 10:13:32 +00:00
|
|
|
}
|
|
|
|
|
2015-11-17 07:35:21 +00:00
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
/*** GESTION DES SELECT/TABLES D'AFFINAGES POUR AFFINER LES GROUPES ***/
|
|
|
|
/**********************************************************************/
|
2015-11-19 13:08:40 +00:00
|
|
|
var selectList = document.querySelectorAll("#CONTAINER > section[name] > select[name=groupe], #CONTAINER > section[name] > .p > select[name=annee]");
|
|
|
|
var partList = document.querySelectorAll("#CONTAINER > section[name] > table.partlist[name=semestre], "+
|
|
|
|
"#CONTAINER > section[name] > table.partlist[name=formation], "+
|
2016-01-02 17:43:33 +00:00
|
|
|
"#CONTAINER > section[name] > .p > div.partlist[name=semestre] > span[data-stre][data-year]");
|
2015-11-15 17:12:49 +00:00
|
|
|
|
2015-11-19 13:08:40 +00:00
|
|
|
// GESTION DE L'AFFINAGE PAR FORMATION/SEMESTRE //
|
2015-11-15 17:12:49 +00:00
|
|
|
for( var i = 0 ; i < partList.length ; i++ ){
|
|
|
|
|
|
|
|
partList[i].addEventListener('click', function(e){
|
2015-11-19 13:08:40 +00:00
|
|
|
|
2015-11-15 17:12:49 +00:00
|
|
|
var tableauParent = e.target.parentNode.parentNode.parentNode;
|
|
|
|
|
2015-11-17 07:35:21 +00:00
|
|
|
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' )
|
2015-11-29 17:26:46 +00:00
|
|
|
pageM.vars[2] = 's:'+e.target.dataset.value;
|
2015-11-17 07:35:21 +00:00
|
|
|
|
2015-11-19 13:08:40 +00:00
|
|
|
// affinage par semestre (exportation)
|
2016-01-02 17:43:33 +00:00
|
|
|
}else if( e.target.parentNode.getAttribute('name') == 'semestre' && e.target.dataset.hasOwnProperty('stre') && e.target.dataset.hasOwnProperty('year') ){
|
|
|
|
pageM.vars[1] = 'a:'+e.target.dataset.year;
|
2015-11-19 13:08:40 +00:00
|
|
|
pageM.vars[2] = 's:'+e.target.dataset.stre;
|
2015-11-25 17:17:34 +00:00
|
|
|
}
|
2015-11-15 17:12:49 +00:00
|
|
|
|
2015-11-19 13:08:40 +00:00
|
|
|
// si la formation n'est pas définie, on l'active
|
2015-11-29 17:07:16 +00:00
|
|
|
if( !/^[fa]:/.test(pageM.vars[1]) )
|
2015-11-19 13:08:40 +00:00
|
|
|
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
|
2015-11-29 16:46:50 +00:00
|
|
|
while( /\*$/.test(pageM.vars[pageM.vars.length-1]) )
|
2015-11-19 13:08:40 +00:00
|
|
|
pageM.vars.pop();
|
|
|
|
|
|
|
|
reload();
|
2015-11-15 17:12:49 +00:00
|
|
|
|
|
|
|
}, false);
|
2015-11-06 14:57:12 +00:00
|
|
|
|
2015-11-15 17:12:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GESTION DE L'AFFINAGE PAR GROUPE //
|
|
|
|
for( var i = 0 ; i < selectList.length ; i++ ){
|
|
|
|
|
2015-11-19 13:08:40 +00:00
|
|
|
selectList[i].addEventListener('change', function(e){
|
|
|
|
|
|
|
|
if( e.target.tagName == 'SELECT' ){
|
|
|
|
|
|
|
|
if( e.target.getAttribute('name') == 'groupe' )
|
2015-11-29 17:07:16 +00:00
|
|
|
pageM.vars[2] = 'g:'+e.target.value;
|
2015-11-15 17:12:49 +00:00
|
|
|
|
2015-11-19 13:08:40 +00:00
|
|
|
if( e.target.getAttribute('name') == 'annee' )
|
2015-11-29 17:07:16 +00:00
|
|
|
pageM.vars[1] = 'a:'+e.target.value;
|
2015-11-15 17:12:49 +00:00
|
|
|
|
2015-11-17 07:35:21 +00:00
|
|
|
// si la formation n'est pas définie, on l'active
|
2015-11-29 17:07:16 +00:00
|
|
|
if( !/^[fa]:/.test(pageM.vars[1]) )
|
2015-11-17 07:35:21 +00:00
|
|
|
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
|
2015-11-29 16:46:50 +00:00
|
|
|
while( /\*$/.test(pageM.vars[pageM.vars.length-1]) )
|
2015-11-15 17:12:49 +00:00
|
|
|
pageM.vars.pop();
|
|
|
|
|
|
|
|
reload();
|
|
|
|
}
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
}
|
2015-11-11 14:50:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-25 14:13:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-02 17:43:33 +00:00
|
|
|
/********************************/
|
|
|
|
/* GESTION DE L'EXPORT DE LISTE */
|
|
|
|
/********************************/
|
|
|
|
var exportInscrits = document.getElementById('export_grouplist');
|
|
|
|
if( exportInscrits != null ){
|
|
|
|
|
|
|
|
exportInscrits.addEventListener('click', function(e){
|
|
|
|
var selectedSemestre = document.querySelector("#CONTAINER > section[name] > .p > div.partlist[name] > span[data-stre][data-year].active");
|
|
|
|
|
|
|
|
// on récupère l'année et le semestre selectionnés
|
|
|
|
var fSemestre = (selectedSemestre!=null) ? selectedSemestre.dataset.stre : null;
|
|
|
|
var fAnnee = (selectedSemestre!=null) ? selectedSemestre.dataset.year : null;
|
|
|
|
|
2016-01-03 10:55:20 +00:00
|
|
|
// console.log(fSemestre);
|
|
|
|
// console.log(fAnnee);
|
2016-01-02 17:43:33 +00:00
|
|
|
|
|
|
|
/* [1] On récupère la liste des groupes en question (groupManager)
|
|
|
|
===================================================================*/
|
|
|
|
/* (1) Tous les semestres */
|
|
|
|
var request1;
|
|
|
|
if( fSemestre == '*' ){
|
|
|
|
request1 = {
|
|
|
|
level_0: 'groups',
|
|
|
|
level_1: 'grouplistForYear',
|
|
|
|
annee: fAnnee,
|
|
|
|
};
|
|
|
|
}else{
|
|
|
|
request1 = {
|
|
|
|
level_0: 'groups',
|
|
|
|
level_1: 'grouplist',
|
|
|
|
semestre: fSemestre,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
API.send(request1, function(answer1){
|
|
|
|
// si on a bien récupéré les étudiants
|
|
|
|
if( answer1.request == 'success' ){
|
|
|
|
console.log( answer1.grouplist );
|
|
|
|
|
|
|
|
/* [2] On génère le fichier associé (excelManager)
|
|
|
|
===================================================================*/
|
|
|
|
var request2 = {
|
|
|
|
level_0: 'excel',
|
|
|
|
level_1: 'export_grouplist',
|
|
|
|
grouplist: answer1.grouplist // on envoie la liste qu'on vient de récupérer
|
|
|
|
};
|
|
|
|
|
|
|
|
API.send(request2, function(answer2){
|
|
|
|
if( answer2.request == 'success' ){ // le fichier a bien été généré, on lance le téléchargement
|
|
|
|
document.location = answer2.pathfile;
|
|
|
|
reload();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2015-11-25 14:13:27 +00:00
|
|
|
|
2016-01-02 17:43:33 +00:00
|
|
|
|
2015-11-25 14:13:27 +00:00
|
|
|
|
2016-01-02 17:43:33 +00:00
|
|
|
}, false);
|
|
|
|
|
|
|
|
}
|
2015-11-25 14:13:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************/
|
|
|
|
/* GESTION DE L'IMPORT DE LISTE */
|
|
|
|
/********************************/
|
|
|
|
var importInscrits = document.getElementById('import_inscrits');
|
|
|
|
if( importInscrits != null ){
|
|
|
|
|
|
|
|
importInscrits.addEventListener('change', function(e){
|
|
|
|
|
|
|
|
var annee = parseInt( importInscrits.parentNode.dataset.year );
|
|
|
|
var rang = parseInt( importInscrits.parentNode.parentNode.children[5].value );
|
|
|
|
|
|
|
|
console.log(annee);
|
|
|
|
console.log(rang);
|
|
|
|
|
|
|
|
addClass( importInscrits.parentNode, 'loading' );
|
|
|
|
|
|
|
|
var file = importInscrits.files[0];
|
|
|
|
|
|
|
|
/* [1] IMPORTATION DU FICHIER
|
|
|
|
=======================================*/
|
|
|
|
var fd = new FormData();
|
|
|
|
fd.append('filename', 'import_inscrits');
|
|
|
|
fd.append('file', file, file.name);
|
|
|
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
|
|
|
xhr.open('POST', 'manager/import.php', true);
|
|
|
|
|
|
|
|
xhr.onreadystatechange = function(){
|
2016-01-07 14:09:20 +00:00
|
|
|
if( xhr.readyState == 4 && [0, 200].indexOf(xhr.status) > -1 ){
|
|
|
|
|
2016-01-02 13:21:31 +00:00
|
|
|
console.log('[1] IMPORT=> '+xhr.responseText);
|
2015-11-25 14:13:27 +00:00
|
|
|
if( xhr.responseText == 'success' ){
|
|
|
|
/* [2] LECTURE DU FICHIER
|
|
|
|
=======================================*/
|
2015-12-06 19:08:28 +00:00
|
|
|
var request = { level_0: 'excel', level_1: 'import_inscrits' };
|
2015-11-25 14:13:27 +00:00
|
|
|
API.send(request, function(e){
|
2016-01-02 13:21:31 +00:00
|
|
|
console.log('[2] PARSE=>'+e.request);
|
2015-11-25 14:13:27 +00:00
|
|
|
if( e.request == 'success' ){
|
|
|
|
|
|
|
|
/* [3] INTÉGRATION À LA BDD
|
|
|
|
=======================================*/
|
|
|
|
requestIntegration = { level_0: 'groups', level_1: 'addUserlist', rang: rang, annee: annee, formationList: e.formationList };
|
|
|
|
API.send( requestIntegration, function(f){
|
2016-01-02 13:21:31 +00:00
|
|
|
console.log('[3] INTEGRATION=>'+f.request);
|
2015-11-25 14:13:27 +00:00
|
|
|
if( f.request == 'success' ){
|
|
|
|
console.log('liste intégrée');
|
|
|
|
reload();
|
|
|
|
}else console.log('integration error');
|
|
|
|
});
|
|
|
|
|
|
|
|
}else console.log('import error');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-01-07 14:09:20 +00:00
|
|
|
}
|
|
|
|
|
2015-11-25 14:13:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
xhr.send(fd);
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-11 14:50:05 +00:00
|
|
|
-->
|