Correction et fin de l'implémentation|déploiement|intégration de la liste d'étudiants + Correction d'affinage des pages @groupes et @modules ainsi que l'affinage au niveau jsevent pour l'export (affinage par formation)

This commit is contained in:
xdrm-brackets 2015-11-25 18:17:34 +01:00
parent 09c2190f39
commit 75560f05d5
8 changed files with 128 additions and 101 deletions

View File

@ -164,7 +164,7 @@ class DataBase{
foreach($formationList as $form){ foreach($formationList as $form){
$formationUID = semestreRepo::includeFormation($form['nom'], $form['libelle']); // on récupère l'UID de la formation en la créant si nécessaire $formationUID = semestreRepo::includeFormation($form->nom, $form->libelle); // on récupère l'UID de la formation en la créant si nécessaire
if( is_numeric($formationUID) ){ // si la formation est ok, alors on cherche le semestre if( is_numeric($formationUID) ){ // si la formation est ok, alors on cherche le semestre
@ -172,9 +172,9 @@ class DataBase{
if( is_numeric($semestreUID) ){ // si le semestre est ok, alors on ajoute les utilisateurs if( is_numeric($semestreUID) ){ // si le semestre est ok, alors on ajoute les utilisateurs
foreach($form['userlist'] as $user){ foreach($form->userlist as $user){
// on récupère l'UID utilisateur en le créant si nécessaire // on récupère l'UID utilisateur en le créant si nécessaire
$utilisateurUID = userRepo::includeEtudiant($user['identifiant'], $user['prenom'], $user['nom'], $user['sexe'], $user['mail']); $utilisateurUID = userRepo::includeEtudiant($user->identifiant, $user->prenom, $user->nom, $user->sexe, $user->mail);
if( is_string($utilisateurUID) ) // si l'utilisateur est ok, alors on créé l'appartenance if( is_string($utilisateurUID) ) // si l'utilisateur est ok, alors on créé l'appartenance
groupRepo::includeAppartenance($utilisateurUID, $semestreUID); // on ajoute l'utilisateur au groupeVide de chaque semestre (s'il n'a pas déjà un groupe) groupRepo::includeAppartenance($utilisateurUID, $semestreUID); // on ajoute l'utilisateur au groupeVide de chaque semestre (s'il n'a pas déjà un groupe)

View File

@ -3,10 +3,17 @@
if( isset($_FILES['file']) && isset($_POST['filename']) ){ if( isset($_FILES['file']) && isset($_POST['filename']) ){
$path = __ROOT__.'/src/files/'; $path = __ROOT__.'/src/files/';
$targetFile = $_SESSION['identifiant'].'_'.$_POST['filename'].'.xlsx'; $fileName = $_SESSION['identifiant'].'_'.$_POST['filename'].'.xlsx';
// on se place dans /.../src/files
chdir( $path );
if( move_uploaded_file($_FILES["file"]["tmp_name"], $path.$targetFile) )
if( move_uploaded_file($_FILES["file"]["tmp_name"], $path.$fileName) ){
// on modifie les droits du fichier
chmod($path.$fileName, 0774);
echo "success"; echo "success";
}
else else
echo "error"; echo "error";

View File

@ -1,11 +1,13 @@
<?php <?php
chdir( __ROOT__.'/src/files/' );
function xlsx_switch_lvl1($request, $answer){ function xlsx_switch_lvl1($request, $answer){
//inclusion des classes de PHPExcel et des fichiers necessaires //inclusion des classes de PHPExcel et des fichiers necessaires
require_once __ROOT__.DIRECTORY_SEPARATOR.join(DIRECTORY_SEPARATOR, array("src", "phpexcel", "Classes", "PHPExcel.php")); require_once __ROOT__.'/src/phpexcel/Classes/PHPExcel.php';
require_once __ROOT__.DIRECTORY_SEPARATOR.join(DIRECTORY_SEPARATOR, array("src", "phpexcel", "Classes", "PHPExcel", "Writer", "Excel2007.php")); require_once __ROOT__.'/src/phpexcel/Classes/PHPExcel/Writer/Excel2007.php';
/* [1] TABLE DE ROUTAGE /* [1] TABLE DE ROUTAGE
@ -115,8 +117,11 @@ function xlsx_switch_lvl1($request, $answer){
case 'import_inscrits': case 'import_inscrits':
// Récupération du nom du fichier // Récupération du nom du fichier
$filePath = __ROOT__.'/src/files/'.$_SESSION['identifiant'].'_import_mcc.xlsx'; $filePath = __ROOT__.'/src/files/'.$_SESSION['identifiant'].'_import_inscrits.xlsx';
// si on a pas le droit d'écriture, on quitte //
if( !is_readable($filePath) ){ $answer->request = 'read_permission'; return; }
// Chargement du fichier // Chargement du fichier
$objPHPExcel = PHPExcel_IOFactory::load($filePath); $objPHPExcel = PHPExcel_IOFactory::load($filePath);
@ -124,6 +129,7 @@ function xlsx_switch_lvl1($request, $answer){
$sheet = $objPHPExcel->getSheet(0); $sheet = $objPHPExcel->getSheet(0);
$userlistData = $sheet->rangeToArray('B2:'.$sheet->getHighestColumn().''.$sheet->getHighestRow()); $userlistData = $sheet->rangeToArray('B2:'.$sheet->getHighestColumn().''.$sheet->getHighestRow());
// Variables stack pour la liste de élèves // Variables stack pour la liste de élèves
$listeFormations = array(); $listeFormations = array();
@ -179,8 +185,13 @@ function xlsx_switch_lvl1($request, $answer){
}} }}
$answer->formationList = $listeFormations;
$answer->request = 'success'; // on vérifie qu'on a récupéré qqch
if( count($listeFormations) > 0 ){
$answer->formationList = $listeFormations;
$answer->request = 'success';
}else
$answer->request = 'corrupted_format';
break; break;
@ -297,10 +308,8 @@ function xlsx_switch_lvl1($request, $answer){
$filePath = __ROOT__.'/src/files/'.$_SESSION['identifiant'].'_import_mcc.xlsx'; $filePath = __ROOT__.'/src/files/'.$_SESSION['identifiant'].'_import_mcc.xlsx';
// file_put_contents($filePath, $file['file']); // si on a pas le droit d'écriture, on quitte //
if( !is_readable($filePath) ){ $answer->request = 'read_permission'; return; }
// // $inputFileType = 'Excel2007';
// $inputFileName = $request->docPath;
// Charger le fichier en tant que document Excel // Charger le fichier en tant que document Excel
$objPHPExcel = PHPExcel_IOFactory::load($filePath); $objPHPExcel = PHPExcel_IOFactory::load($filePath);

View File

@ -76,7 +76,7 @@ if( document.querySelector('#CONTAINER section[name=movestudents]') != null ){ /
var selectList = document.querySelectorAll("#CONTAINER > section[name] > select[name=groupe], #CONTAINER > section[name] > .p > select[name=annee]"); 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], "+ var partList = document.querySelectorAll("#CONTAINER > section[name] > table.partlist[name=semestre], "+
"#CONTAINER > section[name] > table.partlist[name=formation], "+ "#CONTAINER > section[name] > table.partlist[name=formation], "+
"#CONTAINER > section[name] > .p > div.partlist[name=semestre] > span[data-stre]"); "#CONTAINER > section[name] > .p > div.partlist[name=semestre] > span[data-stre][data-frm]");
// GESTION DE L'AFFINAGE PAR FORMATION/SEMESTRE // // GESTION DE L'AFFINAGE PAR FORMATION/SEMESTRE //
for( var i = 0 ; i < partList.length ; i++ ){ for( var i = 0 ; i < partList.length ; i++ ){
@ -99,8 +99,10 @@ for( var i = 0 ; i < partList.length ; i++ ){
pageM.vars[2] = 's:'+e.target.dataset.value; pageM.vars[2] = 's:'+e.target.dataset.value;
// affinage par semestre (exportation) // affinage par semestre (exportation)
}else if( e.target.parentNode.getAttribute('name') == 'semestre' && e.target.dataset.hasOwnProperty('stre') ) }else if( e.target.parentNode.getAttribute('name') == 'semestre' && e.target.dataset.hasOwnProperty('stre') && e.target.dataset.hasOwnProperty('frm') ){
pageM.vars[1] = 'f:'+e.target.dataset.frm;
pageM.vars[2] = 's:'+e.target.dataset.stre; pageM.vars[2] = 's:'+e.target.dataset.stre;
}
// si la formation n'est pas définie, on l'active // si la formation n'est pas définie, on l'active
if( !/^[fa]:/.test(pageM.vars[1]) ) if( !/^[fa]:/.test(pageM.vars[1]) )

View File

@ -9,7 +9,7 @@ var selectList = document.querySelectorAll("#CONTAINER > section[name] > .p > se
var partList = document.querySelectorAll("#CONTAINER > section[name] > table.partlist[name=UE], "+ var partList = document.querySelectorAll("#CONTAINER > section[name] > table.partlist[name=UE], "+
"#CONTAINER > section[name] > table.partlist[name=semestre], "+ "#CONTAINER > section[name] > table.partlist[name=semestre], "+
"#CONTAINER > section[name] > table.partlist[name=formation], "+ "#CONTAINER > section[name] > table.partlist[name=formation], "+
"#CONTAINER > section[name] > .p > div.partlist[name=semestre] > span[data-stre]"); "#CONTAINER > section[name] > .p > div.partlist[name=semestre] > span[data-stre][data-frm]");
for( var i = 0 ; i < partList.length ; i++ ){ for( var i = 0 ; i < partList.length ; i++ ){
@ -33,8 +33,10 @@ for( var i = 0 ; i < partList.length ; i++ ){
if( tableauParent.getAttribute('name') == 'UE' ) if( tableauParent.getAttribute('name') == 'UE' )
pageM.vars[2] = 'u:'+e.target.dataset.value; pageM.vars[2] = 'u:'+e.target.dataset.value;
}else if( e.target.parentNode.getAttribute('name') == 'semestre' && e.target.dataset.hasOwnProperty('stre') ) }else if( e.target.parentNode.getAttribute('name') == 'semestre' && e.target.dataset.hasOwnProperty('stre') && e.target.dataset.hasOwnProperty('frm') ){
pageM.vars[1] = 'f:'+e.target.dataset.frm;
pageM.vars[2] = 's:'+e.target.dataset.stre; pageM.vars[2] = 's:'+e.target.dataset.stre;
}
// si la formation n'est pas définie, on l'active // si la formation n'est pas définie, on l'active
if( !/^[fa]:/.test(pageM.vars[1]) ) if( !/^[fa]:/.test(pageM.vars[1]) )

View File

@ -221,8 +221,9 @@ if( permission('teacher') ){ // si l'utilisateur est connecté et que c'est un
array_push($verificationUIDFormations, $groupe['id_formation']); array_push($verificationUIDFormations, $groupe['id_formation']);
// si la formation optionnelle n'est pas définie ou incohérente, on le fait (première valeur trouvée) // si la formation optionnelle n'est pas définie ou incohérente, on le fait (première valeur trouvée)
if( $formationOpt == null || !in_array($formationOpt, $verificationUIDFormations) ) $MyGroupsFormationOpt = $formationOpt;
$formationOpt = $verificationUIDFormations[0]; if( $MyGroupsFormationOpt == null || !in_array($MyGroupsFormationOpt, $verificationUIDFormations) )
$MyGroupsFormationOpt = $verificationUIDFormations[0];
@ -234,7 +235,7 @@ if( permission('teacher') ){ // si l'utilisateur est connecté et que c'est un
foreach($answer->grouplist as $groupe){ if( !in_array($groupe['id_formation'], $ListeUIDFormations) ){ foreach($answer->grouplist as $groupe){ if( !in_array($groupe['id_formation'], $ListeUIDFormations) ){
if( $groupe['id_formation'] == $formationOpt ) // si c'est la formation séléctionnée if( $groupe['id_formation'] == $MyGroupsFormationOpt ) // si c'est la formation séléctionnée
echo "<td data-value='".$groupe['id_formation']."' class='active'>".$groupe['formation'].'</td>'; echo "<td data-value='".$groupe['id_formation']."' class='active'>".$groupe['formation'].'</td>';
else // sinon on affiche normalement else // sinon on affiche normalement
echo "<td data-value='".$groupe['id_formation']."'>".$groupe['formation'].'</td>'; echo "<td data-value='".$groupe['id_formation']."'>".$groupe['formation'].'</td>';
@ -256,7 +257,7 @@ if( permission('teacher') ){ // si l'utilisateur est connecté et que c'est un
else echo "<td data-value='*'>Tous</td>"; else echo "<td data-value='*'>Tous</td>";
/* On récupère la liste des SEMESTRES en accord avec la FORMATION sélectionnée */ /* On récupère la liste des SEMESTRES en accord avec la FORMATION sélectionnée */
foreach($answer->grouplist as $groupe){ if( $groupe['id_formation'] == $formationOpt && !in_array($groupe['id_semestre'], $ListeUIDSemestres) ){ foreach($answer->grouplist as $groupe){ if( $groupe['id_formation'] == $MyGroupsFormationOpt && !in_array($groupe['id_semestre'], $ListeUIDSemestres) ){
if( $groupe['id_semestre'] == $semestreOpt ) // si c'est le groupe séléctionné if( $groupe['id_semestre'] == $semestreOpt ) // si c'est le groupe séléctionné
echo "<td data-value='".$groupe['id_semestre']."' class='active'>".$groupe['semestre'].'</td>'; echo "<td data-value='".$groupe['id_semestre']."' class='active'>".$groupe['semestre'].'</td>';
@ -281,7 +282,7 @@ if( permission('teacher') ){ // si l'utilisateur est connecté et que c'est un
else echo "<option value='*'>Tous les groupes</option>"; else echo "<option value='*'>Tous les groupes</option>";
/* On récupère la liste des SEMESTRES en accord avec la FORMATION sélectionnée */ /* On récupère la liste des SEMESTRES en accord avec la FORMATION sélectionnée */
foreach($answer->grouplist as $groupe){ if( $groupe['id_formation'] == $formationOpt && in_array($groupe['id_semestre'], $ListeUIDSemestres) && !in_array($groupe['id'], $ListeUIDGroupes) ){ foreach($answer->grouplist as $groupe){ if( $groupe['id_formation'] == $MyGroupsFormationOpt && in_array($groupe['id_semestre'], $ListeUIDSemestres) && !in_array($groupe['id'], $ListeUIDGroupes) ){
if( $groupe['id'] == $groupeOpt ) // si c'est le groupe séléctionné if( $groupe['id'] == $groupeOpt ) // si c'est le groupe séléctionné
echo "<option value='".$groupe['id']."' selected>".$groupe['nom'].'</option>'; echo "<option value='".$groupe['id']."' selected>".$groupe['nom'].'</option>';
@ -310,7 +311,7 @@ if( permission('teacher') ){ // si l'utilisateur est connecté et que c'est un
foreach($answer->grouplist as $group){ // pour chaque groupe foreach($answer->grouplist as $group){ // pour chaque groupe
if( $group['id_formation'] == $formationOpt && ($semestreOpt==null || $semestreOpt==$group['id_semestre']) && ($groupeOpt==null || $groupeOpt==$group['id']) ){ if( $group['id_formation'] == $MyGroupsFormationOpt && ($semestreOpt==null || $semestreOpt==$group['id_semestre']) && ($groupeOpt==null || $groupeOpt==$group['id']) ){
if( count($group['userlist']) > 0 ){ // s'il y a des utilisateurs if( count($group['userlist']) > 0 ){ // s'il y a des utilisateurs
@ -387,9 +388,10 @@ if( permission('admin') ){ // si l'utilisateur est connecté et que c'est un adm
if( !in_array($groupe['id_formation'], $verificationUIDFormations) ) if( !in_array($groupe['id_formation'], $verificationUIDFormations) )
array_push($verificationUIDFormations, $groupe['id_formation']); array_push($verificationUIDFormations, $groupe['id_formation']);
$moveStudentsFormationOpt = $formationOpt;
// si la formation optionnelle n'est pas définie ou incohérente, on le fait (première valeur trouvée) // si la formation optionnelle n'est pas définie ou incohérente, on le fait (première valeur trouvée)
if( $formationOpt == null || !in_array($formationOpt, $verificationUIDFormations) ) if( $moveStudentsFormationOpt == null || !in_array($moveStudentsFormationOpt, $verificationUIDFormations) )
$formationOpt = $verificationUIDFormations[0]; $moveStudentsFormationOpt = $verificationUIDFormations[0];
@ -401,7 +403,7 @@ if( permission('admin') ){ // si l'utilisateur est connecté et que c'est un adm
foreach($answer->grouplist as $groupe){ if( !in_array($groupe['id_formation'], $ListeUIDFormations) ){ foreach($answer->grouplist as $groupe){ if( !in_array($groupe['id_formation'], $ListeUIDFormations) ){
// si c'est la formation séléctionnée // si c'est la formation séléctionnée
if( $groupe['id_formation'] == $formationOpt ) echo "<td data-value='".$groupe['id_formation']."' class='active'>".$groupe['formation'].'</td>'; if( $groupe['id_formation'] == $moveStudentsFormationOpt ) echo "<td data-value='".$groupe['id_formation']."' class='active'>".$groupe['formation'].'</td>';
else echo "<td data-value='".$groupe['id_formation']."'>".$groupe['formation'].'</td>'; else echo "<td data-value='".$groupe['id_formation']."'>".$groupe['formation'].'</td>';
// on ajoute la formation à la liste pour ne pas la répéter // on ajoute la formation à la liste pour ne pas la répéter
@ -420,7 +422,7 @@ if( permission('admin') ){ // si l'utilisateur est connecté et que c'est un adm
else echo "<td data-value='*'>Tous</td>"; else echo "<td data-value='*'>Tous</td>";
/* On récupère la liste des SEMESTRES en accord avec la FORMATION sélectionnée */ /* On récupère la liste des SEMESTRES en accord avec la FORMATION sélectionnée */
foreach($answer->grouplist as $groupe){ if( $groupe['id_formation'] == $formationOpt && !in_array($groupe['id_semestre'], $ListeUIDSemestres) ){ foreach($answer->grouplist as $groupe){ if( $groupe['id_formation'] == $moveStudentsFormationOpt && !in_array($groupe['id_semestre'], $ListeUIDSemestres) ){
// si c'est le semestre séléctionné // si c'est le semestre séléctionné
if( $groupe['id_semestre'] == $semestreOpt ) echo "<td data-value='".$groupe['id_semestre']."' class='active'>".$groupe['semestre'].'</td>'; if( $groupe['id_semestre'] == $semestreOpt ) echo "<td data-value='".$groupe['id_semestre']."' class='active'>".$groupe['semestre'].'</td>';
@ -443,7 +445,7 @@ if( permission('admin') ){ // si l'utilisateur est connecté et que c'est un adm
else echo "<option value='*'>Tous les groupes</option>"; else echo "<option value='*'>Tous les groupes</option>";
/* On récupère la liste des GROUPES en accord avec la FORMATION et le SEMESTRE sélectionnée */ /* On récupère la liste des GROUPES en accord avec la FORMATION et le SEMESTRE sélectionnée */
foreach($answer->grouplist as $groupe){ if( $groupe['id_formation'] == $formationOpt && in_array($groupe['id_semestre'], $ListeUIDSemestres) && !in_array($groupe['id'], $ListeUIDGroupes) ){ foreach($answer->grouplist as $groupe){ if( $groupe['id_formation'] == $moveStudentsFormationOpt && in_array($groupe['id_semestre'], $ListeUIDSemestres) && !in_array($groupe['id'], $ListeUIDGroupes) ){
// si c'est le groupe sélectionné // si c'est le groupe sélectionné
if( $groupe['id'] == $groupeOpt ) echo "<option value='".$groupe['id']."' selected>".$groupe['nom'].'</option>'; if( $groupe['id'] == $groupeOpt ) echo "<option value='".$groupe['id']."' selected>".$groupe['nom'].'</option>';
@ -460,7 +462,7 @@ if( permission('admin') ){ // si l'utilisateur est connecté et que c'est un adm
foreach($answer->grouplist as $group){ // pour chaque groupe foreach($answer->grouplist as $group){ // pour chaque groupe
if( $group['id_formation'] == $formationOpt && ($semestreOpt==null || $semestreOpt==$group['id_semestre']) && ($groupeOpt==null || $groupeOpt==$group['id']) ){ if( $group['id_formation'] == $moveStudentsFormationOpt && ($semestreOpt==null || $semestreOpt==$group['id_semestre']) && ($groupeOpt==null || $groupeOpt==$group['id']) ){
if( count($group['userlist']) > 0 ){ // s'il y a des utilisateurs if( count($group['userlist']) > 0 ){ // s'il y a des utilisateurs
@ -591,9 +593,9 @@ if( permission('admin') ){
foreach($annee['semestres'] as $semestre){ if( in_array($semestre['id'], $semestresListe) ){ foreach($annee['semestres'] as $semestre){ if( in_array($semestre['id'], $semestresListe) ){
if( $semestre['id'] == $semestreOpt ) // si c'est le semestre séléctionné if( $semestre['id'] == $semestreOpt ) // si c'est le semestre séléctionné
echo "<span data-year='".$annee['annee']."' data-stre='".$semestre['id']."' class='active'>".$semestre['formation']." - ".$semestre['nom'].'</span>'; echo "<span data-year='".$annee['annee']."' data-frm='".$semestre['id_formation']."' data-stre='".$semestre['id']."' class='active'>".$semestre['formation']." - ".$semestre['nom'].'</span>';
else // sinon on affiche normalement else // sinon on affiche normalement
echo "<span data-year='".$annee['annee']."' data-stre='".$semestre['id']."'>".$semestre['formation']." - ".$semestre['nom'].'</span>'; echo "<span data-year='".$annee['annee']."' data-frm='".$semestre['id_formation']."' data-stre='".$semestre['id']."'>".$semestre['formation']." - ".$semestre['nom'].'</span>';
}} }}
}} }}
echo "</div><br><br>"; echo "</div><br><br>";

View File

@ -166,10 +166,11 @@ if( permission('teacher') ){ // si l'utilisateur est un prof
if( !in_array($semestre['id_formation'], $verificationUIDFormations) ) if( !in_array($semestre['id_formation'], $verificationUIDFormations) )
array_push($verificationUIDFormations, $semestre['id_formation']); array_push($verificationUIDFormations, $semestre['id_formation']);
// si la formation optionnelle n'est pas définie ou incohérente, on le fait (première valeur trouvée)
if( $formationOpt == null || !in_array($formationOpt, $verificationUIDFormations) )
$formationOpt = $verificationUIDFormations[0];
$MyModulesFormationOpt = $formationOpt;
// si la formation optionnelle n'est pas définie ou incohérente, on le fait (première valeur trouvée)
if( $MyModulesFormationOpt == null || !in_array($MyModulesFormationOpt, $verificationUIDFormations) )
$MyModulesFormationOpt = $verificationUIDFormations[0];
/**************************/ /**************************/
/* AFFINAGE PAR FORMATION */ /* AFFINAGE PAR FORMATION */
@ -178,7 +179,7 @@ if( permission('teacher') ){ // si l'utilisateur est un prof
foreach($answer->semestres as $semestre){ if( !in_array($semestre['id_formation'], $ListeUIDFormations) ){ foreach($answer->semestres as $semestre){ if( !in_array($semestre['id_formation'], $ListeUIDFormations) ){
if( $semestre['id_formation'] == $formationOpt ) // si c'est la formation séléctionnée if( $semestre['id_formation'] == $MyModulesFormationOpt ) // si c'est la formation séléctionnée
echo "<td data-value='".$semestre['id_formation']."' class='active'>".$semestre['formation'].'</td>'; echo "<td data-value='".$semestre['id_formation']."' class='active'>".$semestre['formation'].'</td>';
else // sinon on affiche normalement else // sinon on affiche normalement
echo "<td data-value='".$semestre['id_formation']."'>".$semestre['formation'].'</td>'; echo "<td data-value='".$semestre['id_formation']."'>".$semestre['formation'].'</td>';
@ -190,8 +191,6 @@ if( permission('teacher') ){ // si l'utilisateur est un prof
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
/*************************/ /*************************/
/* AFFINAGE PAR SEMESTRE */ /* AFFINAGE PAR SEMESTRE */
/*************************/ /*************************/
@ -200,7 +199,7 @@ if( permission('teacher') ){ // si l'utilisateur est un prof
else echo "<td data-value='*'>Tous</td>"; else echo "<td data-value='*'>Tous</td>";
/* On récupère la liste des SEMESTRES en accord avec la FORMATION sélectionnée */ /* On récupère la liste des SEMESTRES en accord avec la FORMATION sélectionnée */
foreach($answer->semestres as $semestre){ if( $semestre['id_formation'] == $formationOpt && !in_array($semestre['id'], $ListeUIDSemestres) ){ foreach($answer->semestres as $semestre){ if( $semestre['id_formation'] == $MyModulesFormationOpt && !in_array($semestre['id'], $ListeUIDSemestres) ){
if( $semestre['id'] == $semestreOpt ) // si c'est le semestre séléctionné if( $semestre['id'] == $semestreOpt ) // si c'est le semestre séléctionné
echo "<td data-value='".$semestre['id']."' class='active'>".$semestre['nom'].'</td>'; echo "<td data-value='".$semestre['id']."' class='active'>".$semestre['nom'].'</td>';
@ -225,7 +224,7 @@ if( permission('teacher') ){ // si l'utilisateur est un prof
else echo "<td data-value='*'>Tous</td>"; else echo "<td data-value='*'>Tous</td>";
/* On récupère la liste des UEs en accord avec la FORMATION et le SEMESTRE sélectionnés */ /* On récupère la liste des UEs en accord avec la FORMATION et le SEMESTRE sélectionnés */
foreach($answer->semestres as $semestre){ if( $semestre['id_formation'] == $formationOpt && in_array($semestre['id'], $ListeUIDSemestres) ){ foreach($answer->semestres as $semestre){ if( $semestre['id_formation'] == $MyModulesFormationOpt && in_array($semestre['id'], $ListeUIDSemestres) ){
foreach($semestre['UElist'] as $UE){ if( !in_array($UE['id'], $ListeUIDUE) ){ foreach($semestre['UElist'] as $UE){ if( !in_array($UE['id'], $ListeUIDUE) ){
if( $UE['id'] == $ueOpt ) // si c'est l'UE séléctionnée if( $UE['id'] == $ueOpt ) // si c'est l'UE séléctionnée
echo "<td data-value='".$UE['id']."' class='active'>".$UE['nom'].'</td>'; echo "<td data-value='".$UE['id']."' class='active'>".$UE['nom'].'</td>';
@ -238,41 +237,44 @@ if( permission('teacher') ){ // si l'utilisateur est un prof
}} }}
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
if( count($ListeUIDUE) > 0 ){ // s'il y a plus d'un semestre, on les affiche
foreach($answer->semestres as $semestre){
foreach($answer->semestres as $semestre){ if( ($semestreOpt == null || $semestre['id'] == $semestreOpt) && ($MyModulesFormationOpt == null || $semestre['id_formation'] == $MyModulesFormationOpt) ){ // on affiche les semestres en fonction de l'affinage
if( ($semestreOpt == null || $semestre['id'] == $semestreOpt) && ($formationOpt == null || $semestre['id_formation'] == $formationOpt) ){ // on affiche les semestres en fonction de l'affinage foreach($semestre['UElist'] as $UE){
foreach($semestre['UElist'] as $UE){ if( $ueOpt == null || $UE['id'] == $ueOpt ){ // on affiche les UEs en fonction de l'affinage
if( $ueOpt == null || $UE['id'] == $ueOpt ){ // on affiche les UEs en fonction de l'affinage
echo "<table class='basic'>";
echo "<thead>";
echo '<tr>';
echo '<th colspan=5>'.$semestre['nom_formation'].' - '.$semestre['nom'].'</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
foreach($UE['modules'] as $MODULE){
echo '<tr>';
echo '<td>'.$MODULE['nom'].'</td>';
echo '<td>'.$MODULE['libelle'].'</td>';
echo '<td>'.$UE['nom'].' - '.$UE['libelle'].'</td>';
echo '</tr>';
}
echo '</tbody>'; echo "<table class='basic'>";
echo '</table>'; echo "<thead>";
echo '<tr>';
echo '<th colspan=5>'.$semestre['nom_formation'].' - '.$semestre['nom'].'</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
foreach($UE['modules'] as $MODULE){
echo '<tr>';
echo '<td>'.$MODULE['nom'].'</td>';
echo '<td>'.$MODULE['libelle'].'</td>';
echo '<td>'.$UE['nom'].' - '.$UE['libelle'].'</td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
}
} }
} }
} }
} }else // si aucun UE
echo "<table class=basic><tbody><tr><td>Aucun module trouvé</td></tr></tbody></table>";
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
echo '</section>'; echo '</section>';
}else }else
@ -389,8 +391,6 @@ if( permission('admin') ){ // si l'utilisateur est un admin
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
/*******************/ /*******************/
/* AFFINAGE PAR UE */ /* AFFINAGE PAR UE */
/*******************/ /*******************/
@ -412,56 +412,61 @@ if( permission('admin') ){ // si l'utilisateur est un admin
}} }}
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
if( count($ListeUIDUE) > 0 ){ // s'il y a plus d'un UE, on les affiche
foreach($answer->semestres as $semestre){
if( ($semestreOpt == null || $semestre['id'] == $semestreOpt) && ($formationOpt == null || $semestre['id_formation'] == $formationOpt) ){ // on affiche les semestres en fonction de l'affinage foreach($answer->semestres as $semestre){
foreach($semestre['UElist'] as $UE){ if( ($semestreOpt == null || $semestre['id'] == $semestreOpt) && ($formationOpt == null || $semestre['id_formation'] == $formationOpt) ){ // on affiche les semestres en fonction de l'affinage
if( $ueOpt == null || $UE['id'] == $ueOpt ){ // on affiche les UEs en fonction de l'affinage foreach($semestre['UElist'] as $UE){
echo "<table class='basic'>"; if( $ueOpt == null || $UE['id'] == $ueOpt ){ // on affiche les UEs en fonction de l'affinage
echo "<thead>";
echo '<tr>'; echo "<table class='basic'>";
echo '<th colspan=5>'.$semestre['nom_formation'].' - '.$semestre['nom'].'</th>'; echo "<thead>";
echo '</tr>';
echo '</thead>';
echo '<tbody>';
foreach($UE['modules'] as $MODULE){
echo '<tr>'; echo '<tr>';
echo '<td>'.$MODULE['nom'].'</td>'; echo '<th colspan=5>'.$semestre['nom_formation'].' - '.$semestre['nom'].'</th>';
echo '<td>'.$MODULE['libelle'].'</td>';
echo '<td>'.$UE['nom'].' - '.$UE['libelle'].'</td>';
echo '</tr>'; echo '</tr>';
} echo '</thead>';
echo '<tbody>';
foreach($UE['modules'] as $MODULE){
echo '<tr>';
echo '<td>'.$MODULE['nom'].'</td>';
echo '<td>'.$MODULE['libelle'].'</td>';
echo '<td>'.$UE['nom'].' - '.$UE['libelle'].'</td>';
echo '</tr>';
}
// require_once __ROOT__.'/manager/database.php'; // require_once __ROOT__.'/manager/database.php';
// $completeModuleList = DataBase::getInstance()->getExhaustiveModuleList(); // $completeModuleList = DataBase::getInstance()->getExhaustiveModuleList();
// // saisie d'un nouveau module // // saisie d'un nouveau module
// echo "<tr class='grayscale'><td>"; // echo "<tr class='grayscale'><td>";
// echo "<select name='modules'>"; // echo "<select name='modules'>";
// foreach($completeModuleList as $module) // foreach($completeModuleList as $module)
// echo "<option value='".$module['id']."'>".$module['nom']." - ".$module['libelle']."</option>"; // echo "<option value='".$module['id']."'>".$module['nom']." - ".$module['libelle']."</option>";
// echo "</select>"; // echo "</select>";
// echo "</td><td>"; // echo "</td><td>";
// echo "<input style='min-width:20%;' type='text' placeholder='Nom'>"; // echo "<input style='min-width:20%;' type='text' placeholder='Nom'>";
// echo "<input style='min-width:50%;' type='text' placeholder='Libellé'>"; // echo "<input style='min-width:50%;' type='text' placeholder='Libellé'>";
// echo "</td><td>"; // echo "</td><td>";
// echo "<div class='confirm active'>Ajouter le module</div>"; // echo "<div class='confirm active'>Ajouter le module</div>";
// echo "</td></tr>"; // echo "</td></tr>";
echo '</tbody>'; echo '</tbody>';
echo '</table>'; echo '</table>';
}
} }
} }
} }
} }else // si aucun UE
echo "<table class='basic'><tbody><tr><td>Aucun module trouvé</td></tr></tbody></table>";
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
echo '</section>'; echo '</section>';
}else }else
@ -559,9 +564,9 @@ if( permission('admin') ){
if( $semestre['id'] == $semestreOpt ) // si c'est le semestre séléctionné if( $semestre['id'] == $semestreOpt ) // si c'est le semestre séléctionné
echo "<span data-year='".$annee['annee']."' data-stre='".$semestre['id']."' class='active'>".$semestre['formation']." - ".$semestre['nom'].'</span>'; echo "<span data-year='".$annee['annee']."' data-frm='".$semestre['id_formation']."' data-stre='".$semestre['id']."' class='active'>".$semestre['formation']." - ".$semestre['nom'].'</span>';
else // sinon on affiche normalement else // sinon on affiche normalement
echo "<span data-year='".$annee['annee']."' data-stre='".$semestre['id']."'>".$semestre['formation']." - ".$semestre['nom'].'</span>'; echo "<span data-year='".$annee['annee']."' data-frm='".$semestre['id_formation']."' data-stre='".$semestre['id']."'>".$semestre['formation']." - ".$semestre['nom'].'</span>';
}} }}
}} }}

0
src/files/admin_import_inscrits.xlsx Normal file → Executable file
View File