2015-11-15 18:10:33 +00:00
|
|
|
<!--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************/
|
|
|
|
/* GESTION DE L'AFFINAGE PAR UE */
|
|
|
|
/********************************/
|
2015-11-21 10:41:32 +00:00
|
|
|
var selectList = document.querySelectorAll("#CONTAINER > section[name] > .p > select[name=annee]");
|
|
|
|
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], "+
|
2015-11-29 16:46:50 +00:00
|
|
|
"#CONTAINER > section[name] > .p > div.partlist[name=semestre] > span[data-stre]");
|
2015-11-15 18:10:33 +00:00
|
|
|
|
|
|
|
for( var i = 0 ; i < partList.length ; i++ ){
|
|
|
|
|
2015-11-29 16:46:50 +00:00
|
|
|
|
2015-11-15 18:10:33 +00:00
|
|
|
partList[i].addEventListener('click', function(e){
|
2015-11-29 16:46:50 +00:00
|
|
|
|
2015-11-15 18:10:33 +00:00
|
|
|
var tableauParent = e.target.parentNode.parentNode.parentNode;
|
|
|
|
|
2015-11-16 11:02:03 +00:00
|
|
|
if( tableauParent.tagName == 'TABLE' && e.target.dataset.hasOwnProperty('value') ){
|
2015-11-15 18:10:33 +00:00
|
|
|
|
2015-11-16 16:03:16 +00:00
|
|
|
/* 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();
|
|
|
|
}
|
|
|
|
|
2015-11-16 11:02:03 +00:00
|
|
|
/* SI c'est une affinage par SEMESTRE */
|
|
|
|
if( tableauParent.getAttribute('name') == 'semestre' )
|
2015-11-29 17:07:16 +00:00
|
|
|
pageM.vars[2] = 's:'+e.target.dataset.value;
|
2015-11-16 11:02:03 +00:00
|
|
|
|
|
|
|
/* SI c'est un affinage par UE */
|
|
|
|
if( tableauParent.getAttribute('name') == 'UE' )
|
2015-11-29 17:07:16 +00:00
|
|
|
pageM.vars[2] = 'u:'+e.target.dataset.value;
|
2015-11-16 11:02:03 +00:00
|
|
|
|
2015-11-29 17:07:16 +00:00
|
|
|
}else if( e.target.parentNode.getAttribute('name') == 'semestre' && e.target.dataset.hasOwnProperty('stre') ){
|
2015-11-21 10:41:32 +00:00
|
|
|
pageM.vars[2] = 's:'+e.target.dataset.stre;
|
2015-11-25 17:17:34 +00:00
|
|
|
}
|
2015-11-21 10:41:32 +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-21 10:41:32 +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-21 10:41:32 +00:00
|
|
|
pageM.vars.pop();
|
|
|
|
|
|
|
|
reload();
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GESTION DE L'AFFINAGE PAR ANNEE //
|
|
|
|
for( var i = 0 ; i < selectList.length ; i++ ){
|
|
|
|
|
|
|
|
selectList[i].addEventListener('change', function(e){
|
|
|
|
|
|
|
|
if( e.target.tagName == 'SELECT' ){
|
|
|
|
|
|
|
|
if( e.target.getAttribute('name') == 'annee' )
|
2015-11-29 17:07:16 +00:00
|
|
|
pageM.vars[1] = 'a:'+e.target.value;
|
2015-11-16 16:03:16 +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-16 18:07:39 +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;
|
2015-11-16 16:03:16 +00:00
|
|
|
|
2015-11-15 18:10:33 +00:00
|
|
|
// 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 18:10:33 +00:00
|
|
|
pageM.vars.pop();
|
|
|
|
|
|
|
|
reload();
|
|
|
|
}
|
2015-11-21 10:41:32 +00:00
|
|
|
|
2015-11-15 18:10:33 +00:00
|
|
|
}, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-11-21 12:01:12 +00:00
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
/*****************************************/
|
2015-11-21 12:01:12 +00:00
|
|
|
/* LIEN VERS LA PAGE "CREER UN SEMESTRE" */
|
2015-11-22 11:02:26 +00:00
|
|
|
/*****************************************/
|
|
|
|
var lienSemestre = document.getElementById('link_semestre');
|
|
|
|
if( lienSemestre != null ){ // si l'élément est sur la page
|
|
|
|
|
|
|
|
lienSemestre.addEventListener('click', function(e){
|
|
|
|
|
|
|
|
pageM.vars[0] = 'createsemestre';
|
|
|
|
reload();
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
}
|
2015-11-21 12:01:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-21 17:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************/
|
2015-11-21 17:09:03 +00:00
|
|
|
/* GESTION DE L'IMPORT DE MCC */
|
2015-11-22 11:02:26 +00:00
|
|
|
/******************************/
|
2015-11-21 17:09:03 +00:00
|
|
|
var importMcc = document.getElementById('import_mcc');
|
2015-11-22 11:02:26 +00:00
|
|
|
if( importMcc != null ){
|
|
|
|
|
|
|
|
importMcc.addEventListener('change', function(e){
|
2015-11-21 17:09:03 +00:00
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
var semestre = importMcc.parentNode.dataset.stre;
|
2015-11-22 10:27:48 +00:00
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
console.log(semestre);
|
2015-11-22 10:27:48 +00:00
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
addClass( importMcc.parentNode, 'loading' );
|
2015-11-21 17:09:03 +00:00
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
var file = importMcc.files[0];
|
2015-11-21 17:09:03 +00:00
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
/* [1] IMPORTATION DU FICHIER
|
|
|
|
=======================================*/
|
|
|
|
var fd = new FormData();
|
|
|
|
fd.append('filename', 'import_mcc');
|
|
|
|
fd.append('file', file, file.name);
|
2015-11-21 17:09:03 +00:00
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
var xhr = new XMLHttpRequest();
|
2015-11-21 17:09:03 +00:00
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
xhr.open('POST', 'manager/import.php', true);
|
2015-11-21 17:09:03 +00:00
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
xhr.onreadystatechange = function(){
|
|
|
|
if( xhr.readyState == 4 && [0, 200].indexOf(xhr.status) > -1 )
|
2015-11-21 17:09:03 +00:00
|
|
|
if( xhr.responseText == 'success' ){
|
|
|
|
|
2015-11-22 09:54:05 +00:00
|
|
|
|
|
|
|
/* [2] LECTURE DU FICHIER
|
|
|
|
=======================================*/
|
2015-11-22 11:02:26 +00:00
|
|
|
var request = { level_0: 'phpExcel', level_1: 'import_mcc' };
|
2015-11-21 17:09:03 +00:00
|
|
|
API.send(request, function(e){
|
2015-11-22 11:02:26 +00:00
|
|
|
if( e.request == 'success' ){
|
2015-11-21 17:09:03 +00:00
|
|
|
|
2015-11-22 09:54:05 +00:00
|
|
|
/* [3] INTÉGRATION À LA BDD
|
|
|
|
=======================================*/
|
2015-11-22 11:02:26 +00:00
|
|
|
requestIntegration = { level_0: 'career', level_1: 'setMCC', semestre: semestre, mcc: e.mcc };
|
2015-11-21 17:09:03 +00:00
|
|
|
API.send( requestIntegration, function(f){
|
|
|
|
if( f.request == 'success' ){
|
|
|
|
console.log('mcc intégré');
|
|
|
|
reload();
|
2015-11-22 11:02:26 +00:00
|
|
|
}
|
2015-11-21 17:09:03 +00:00
|
|
|
});
|
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
}
|
2015-11-21 17:09:03 +00:00
|
|
|
});
|
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
xhr.send(fd);
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-21 17:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
|
|
|
|
/**************************************/
|
|
|
|
/* GESTION DE LA CRÉATION DE SEMESTRE */
|
|
|
|
/**************************************/
|
|
|
|
var creerSemestre = document.getElementById('creer_semestre');
|
|
|
|
|
2015-12-02 21:01:00 +00:00
|
|
|
if( creerSemestre != null ){ // si la page est présente
|
|
|
|
|
|
|
|
creerSemestre.addEventListener('click', function(e){
|
|
|
|
|
|
|
|
addClass( creerSemestre, 'loading' );
|
|
|
|
|
|
|
|
var form = creerSemestre.parentNode;
|
|
|
|
var fAnnee = form.children[2].value;
|
|
|
|
var fFormation = form.children[4].value;
|
|
|
|
var fLibelle = form.children[6].value;
|
|
|
|
var fSemestre = form.children[8].value;
|
|
|
|
var fRang = form.children[10].value;
|
|
|
|
|
|
|
|
var request = {
|
|
|
|
level_0: 'career',
|
|
|
|
level_1: 'creerSemestre',
|
|
|
|
annee: fAnnee,
|
|
|
|
formation: fFormation,
|
|
|
|
nom_formation: fLibelle,
|
|
|
|
semestre: fSemestre,
|
|
|
|
rang: fRang
|
|
|
|
}
|
|
|
|
|
|
|
|
API.send(request, function(e){
|
|
|
|
if( e.request == 'success' )
|
|
|
|
reload();
|
|
|
|
});
|
2015-11-21 17:09:03 +00:00
|
|
|
|
2015-11-22 11:02:26 +00:00
|
|
|
|
2015-12-02 21:01:00 +00:00
|
|
|
}, false);
|
|
|
|
|
|
|
|
}
|
2015-11-22 11:02:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-15 18:10:33 +00:00
|
|
|
-->
|