Màj BDD ajout de la table FORMATION + refactor de page/career + page/modules en utilisant maintenant les identifiants uniques de BDD (pour formations, semestre, UE) afin de permettre des UEs de même nom (à travers différentes formations)

This commit is contained in:
xdrm-brackets 2015-11-16 21:42:00 +01:00
parent d6d10b99fc
commit b84a064fb4
5 changed files with 232 additions and 148 deletions

View File

@ -338,12 +338,14 @@ body.trHoverActivated tr:hover td .confirm.active{
/* @radius */ /* @radius */
#CONTAINER > section > .partlist td:first-child{ #CONTAINER > section > .partlist td:first-child{
border-radius: 5px 0 0 5px; border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
} }
/* @border + @radius */ /* @border + @radius */
#CONTAINER > section > .partlist td:last-child{ #CONTAINER > section > .partlist td:last-child{
border-radius: 0 5px 5px 0; border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
border-right: 1px solid #2dcc70; border-right: 1px solid #2dcc70;
} }

View File

@ -57,9 +57,9 @@ class semestreRepo extends DBAccess{
*/ */
public static function info($semestreUID){ public static function info($semestreUID){
// on considère que le semestre existe // on considère que le semestre existe
$getSemestreInfo = DataBase::getPDO()->prepare("SELECT s.id_semestre as s.id, f.code as formation, f.nom as nom_formation, s.nom, s.rang, s.annee ". $getSemestreInfo = DataBase::getPDO()->prepare("SELECT s.id_semestre as s.id, f.id_formation, f.code as formation, f.nom as nom_formation, s.nom, s.rang, s.annee ".
"FROM semestre as s, formation as f ". "FROM semestre as s, formation as f ".
"WHERE s.formation = f.id_formation ". "WHERE s.id_formation = f.id_formation ".
"AND id_semestre = :semestreUID"); "AND id_semestre = :semestreUID");
$getSemestreInfo->execute(array( ':semestreUID' => $semestreUID )); $getSemestreInfo->execute(array( ':semestreUID' => $semestreUID ));
@ -89,9 +89,9 @@ class semestreRepo extends DBAccess{
// on formate les variables // on formate les variables
$semestre_pair = ($semestre_pair) ? '0' : '1'; $semestre_pair = ($semestre_pair) ? '0' : '1';
$getSemestreUID = DataBase::getPDO()->prepare("SELECT s.id_semestre as id, f.code as formation, f.nom as nom_formation ". $getSemestreUID = DataBase::getPDO()->prepare("SELECT s.id_semestre as id, f.id_formation, f.code as formation, f.nom as nom_formation ".
"FROM semestre as s, appartenance as app, formation as f ". "FROM semestre as s, appartenance as app, formation as f ".
"WHERE s.formation = f.id_formation ". "WHERE s.id_formation = f.id_formation ".
"AND app.id_semestre = s.id_semestre ". "AND app.id_semestre = s.id_semestre ".
"AND app.id_etudiant = :etudiant ". "AND app.id_etudiant = :etudiant ".
@ -122,10 +122,10 @@ class semestreRepo extends DBAccess{
* *
*/ */
public static function forTeacher($enseignant, $semestre_pair, $annee){ public static function forTeacher($enseignant, $semestre_pair, $annee){
$getSemestreList = DataBase::getPDO()->prepare("SELECT DISTINCT s.id_semestre as id, f.code as formation, f.nom as nom_formation, s.nom, s.rang, s.annee ". $getSemestreList = DataBase::getPDO()->prepare("SELECT DISTINCT s.id_semestre as id, f.id_formation, f.code as formation, f.nom as nom_formation, s.nom, s.rang, s.annee ".
"FROM semestre as s, formation as f, enseignement as ens, mcc_module as mcc_m, mcc_ue ". "FROM semestre as s, formation as f, enseignement as ens, mcc_module as mcc_m, mcc_ue ".
"WHERE s.id_semestre = mcc_ue.id_semestre ". // semestre <-> mcc_ue "WHERE s.id_semestre = mcc_ue.id_semestre ". // semestre <-> mcc_ue
"AND s.formation = f.id_formation ". // semestre <-> formation "AND s.id_formation = f.id_formation ". // semestre <-> formation
"AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". // mcc_ue <-> mcc_module "AND mcc_ue.id_mcc_ue = mcc_m.id_mcc_ue ". // mcc_ue <-> mcc_module
"AND mcc_m.id_mcc_module = ens.id_mcc_module ". // mcc_module <-> enseignement "AND mcc_m.id_mcc_module = ens.id_mcc_module ". // mcc_module <-> enseignement
@ -149,9 +149,9 @@ class semestreRepo extends DBAccess{
* *
*/ */
public static function forYear($annee){ public static function forYear($annee){
$getSemestreList = DataBase::getPDO()->prepare("SELECT DISTINCT s.id_semestre as id, f.code as formation, f.nom as nom_formation, s.nom, s.rang, s.annee ". $getSemestreList = DataBase::getPDO()->prepare("SELECT DISTINCT s.id_semestre as id, f.id_formation, f.code as formation, f.nom as nom_formation, s.nom, s.rang, s.annee ".
"FROM semestre as s, formation as f ". "FROM semestre as s, formation as f ".
"WHERE s.formation = f.id_formation ". "WHERE s.id_formation = f.id_formation ".
"AND annee = :annee ". "AND annee = :annee ".
"ORDER BY rang ASC"); "ORDER BY rang ASC");
$getSemestreList->execute(array( ':annee' => $annee )); $getSemestreList->execute(array( ':annee' => $annee ));

View File

@ -174,64 +174,88 @@ if( permission('teacher') && $controleOpt == null ){ // si c'est un enseignant e
/* ON RECUPERE UNE LISTE UNIQUE DES SEMESTRES */ /* ON RECUPERE UNE LISTE UNIQUE DES SEMESTRES */
$ListeNomsSemestres = array(); $ListeUIDFormations = array();
$ListeNomsFormations = array(); $ListeUIDSemestres = array();
$ListeNomsUE = array(); $ListeUIDUE = array();
// on selectionne les formations présentes // Vérification de la formation si elle est définie
foreach($answer->semestres as $semestre) $verificationUIDFormations = array();
array_push( $ListeNomsFormations, $semestre['formation'] ); foreach($answer->semestres as $semestre) // on récupère la liste des UID de FORMATIONS
if( !in_array($semestre['id_formation'], $verificationUIDFormations) )
// si la formation optionnelle n'est pas définie ou pas dans la liste, on la définit array_push($verificationUIDFormations, $semestre['id_formation']);
$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);
// 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];
/**************************/
/* AFFINAGE PAR FORMATION */
/**************************/
echo "<table class='partlist' name='formation'><tbody><tr>"; echo "<table class='partlist' name='formation'><tbody><tr>";
foreach($ListeNomsFormations as $NomFormation) foreach($answer->semestres as $semestre){ if( !in_array($semestre['id_formation'], $ListeUIDFormations) ){
if( $NomFormation == $formationOpt ) // si c'est le semestre séléctionné
echo "<td data-value='".$NomFormation."' class='active'>".$NomFormation.'</td>';
if( $semestre['id_formation'] == $formationOpt ) // si c'est la formation séléctionnée
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='".$NomFormation."'>".$NomFormation.'</td>'; echo "<td data-value='".$semestre['id_formation']."'>".$semestre['formation'].'</td>';
// on ajoute la formation à la liste pour ne pas la répéter
array_push($ListeUIDFormations, $semestre['id_formation']);
}}
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
/*************************/
/* AFFINAGE PAR SEMESTRE */
/*************************/
echo "<table class='partlist' name='semestre'><tbody><tr>"; echo "<table class='partlist' name='semestre'><tbody><tr>";
if( $semestreOpt == null ) echo "<td data-value='*' class='active'>Tous</td>"; if( $semestreOpt == null ) echo "<td data-value='*' class='active'>Tous</td>";
else echo "<td data-value='*'>Tous</td>"; else echo "<td data-value='*'>Tous</td>";
foreach($ListeNomsSemestres as $NomSemestre) /* On récupère la liste des SEMESTRES en accord avec la FORMATION sélectionnée */
if( $NomSemestre == $semestreOpt ) // si c'est le semestre séléctionné foreach($answer->semestres as $semestre){ if( $semestre['id_formation'] == $formationOpt && !in_array($semestre['id'], $ListeUIDSemestres) ){
echo "<td data-value='".$NomSemestre."' class='active'>".$NomSemestre.'</td>';
if( $semestre['id'] == $semestreOpt ) // si c'est le semestre séléctionné
echo "<td data-value='".$semestre['id']."' class='active'>".$semestre['nom'].'</td>';
else // sinon on affiche normalement else // sinon on affiche normalement
echo "<td data-value='".$NomSemestre."'>".$NomSemestre.'</td>'; echo "<td data-value='".$semestre['id']."'>".$semestre['nom'].'</td>';
// on ajoute le semestre à la liste pour ne pas le répéter
array_push($ListeUIDSemestres, $semestre['id']);
}}
echo "<td data-value='+'>+</td>"; // ajouter un semestre
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
/*******************/
/* AFFINAGE PAR UE */
/*******************/
echo "<table class='partlist' name='UE'><tbody><tr>"; echo "<table class='partlist' name='UE'><tbody><tr>";
if( $ueOpt == null ) echo "<td data-value='*' class='active'>Tous</td>"; if( $ueOpt == null ) echo "<td data-value='*' class='active'>Tous</td>";
else echo "<td data-value='*'>Tous</td>"; else echo "<td data-value='*'>Tous</td>";
foreach($ListeNomsUE as $NomUE) /* On récupère la liste des UEs en accord avec la FORMATION et le SEMESTRE sélectionnés */
if( $NomUE == $ueOpt ) // si c'est le semestre séléctionné foreach($answer->semestres as $semestre){ if( $semestre['id_formation'] == $formationOpt && in_array($semestre['id'], $ListeUIDSemestres) ){
echo "<td data-value='".$NomUE."' class='active'>".$NomUE.'</td>'; foreach($semestre['UElist'] as $UE){ if( !in_array($UE['id'], $ListeUIDUE) ){
if( $UE['id'] == $ueOpt ) // si c'est l'UE séléctionnée
echo "<td data-value='".$UE['id']."' class='active'>".$UE['nom'].'</td>';
else // sinon on affiche normalement else // sinon on affiche normalement
echo "<td data-value='".$NomUE."'>".$NomUE.'</td>'; echo "<td data-value='".$UE['id']."'>".$UE['nom'].'</td>';
// on ajoute l'UE à la liste pour ne pas le répéter
array_push($ListeUIDUE, $UE['id']);
}}
}}
echo "<td data-value='+'>+</td>"; // ajouter un UE
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
@ -240,11 +264,11 @@ if( permission('teacher') && $controleOpt == null ){ // si c'est un enseignant e
foreach($answer->semestres as $semestre){ foreach($answer->semestres as $semestre){
if( ($semestreOpt == null || $semestre['nom'] == $semestreOpt) && ($formationOpt == null || $semestre['formation'] == $formationOpt) ){ // 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){ // pour chaque UE foreach($semestre['UElist'] as $UE){ // pour chaque UE
if( $ueOpt == null || $UE['nom'] == $ueOpt ){ // on affiche l'UE en fonction du paramètre passé par l'URL if( $ueOpt == null || $UE['id'] == $ueOpt ){ // on affiche l'UE en fonction du paramètre passé par l'URL
if( count($UE['modules']) > 0 ){ // s'il y a au moins un module if( count($UE['modules']) > 0 ){ // s'il y a au moins un module

View File

@ -150,64 +150,88 @@ if( permission('teacher') ){ // si l'utilisateur est un prof
echo "<section name='teachersmodules' data-title='Mes modules' class='basic'>"; echo "<section name='teachersmodules' data-title='Mes modules' class='basic'>";
/* ON RECUPERE UNE LISTE UNIQUE DES SEMESTRES */ /* ON RECUPERE UNE LISTE UNIQUE DES SEMESTRES */
$ListeNomsSemestres = array(); $ListeUIDFormations = array();
$ListeNomsFormations = array(); $ListeUIDSemestres = array();
$ListeNomsUE = array(); $ListeUIDUE = array();
// on selectionne les formations présentes // Vérification de la formation si elle est définie
foreach($answer->semestres as $semestre) $verificationUIDFormations = array();
array_push( $ListeNomsFormations, $semestre['formation'] ); foreach($answer->semestres as $semestre) // on récupère la liste des UID de FORMATIONS
if( !in_array($semestre['id_formation'], $verificationUIDFormations) )
// si la formation optionnelle n'est pas définie ou pas dans la liste, on la définit array_push($verificationUIDFormations, $semestre['id_formation']);
$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);
// 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];
/**************************/
/* AFFINAGE PAR FORMATION */
/**************************/
echo "<table class='partlist' name='formation'><tbody><tr>"; echo "<table class='partlist' name='formation'><tbody><tr>";
foreach($ListeNomsFormations as $NomFormation) foreach($answer->semestres as $semestre){ if( !in_array($semestre['id_formation'], $ListeUIDFormations) ){
if( $NomFormation == $formationOpt ) // si c'est le semestre séléctionné
echo "<td data-value='".$NomFormation."' class='active'>".$NomFormation.'</td>';
if( $semestre['id_formation'] == $formationOpt ) // si c'est la formation séléctionnée
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='".$NomFormation."'>".$NomFormation.'</td>'; echo "<td data-value='".$semestre['id_formation']."'>".$semestre['formation'].'</td>';
// on ajoute la formation à la liste pour ne pas la répéter
array_push($ListeUIDFormations, $semestre['id_formation']);
}}
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
/*************************/
/* AFFINAGE PAR SEMESTRE */
/*************************/
echo "<table class='partlist' name='semestre'><tbody><tr>"; echo "<table class='partlist' name='semestre'><tbody><tr>";
if( $semestreOpt == null ) echo "<td data-value='*' class='active'>Tous</td>"; if( $semestreOpt == null ) echo "<td data-value='*' class='active'>Tous</td>";
else echo "<td data-value='*'>Tous</td>"; else echo "<td data-value='*'>Tous</td>";
foreach($ListeNomsSemestres as $NomSemestre) /* On récupère la liste des SEMESTRES en accord avec la FORMATION sélectionnée */
if( $NomSemestre == $semestreOpt ) // si c'est le semestre séléctionné foreach($answer->semestres as $semestre){ if( $semestre['id_formation'] == $formationOpt && !in_array($semestre['id'], $ListeUIDSemestres) ){
echo "<td data-value='".$NomSemestre."' class='active'>".$NomSemestre.'</td>';
if( $semestre['id'] == $semestreOpt ) // si c'est le semestre séléctionné
echo "<td data-value='".$semestre['id']."' class='active'>".$semestre['nom'].'</td>';
else // sinon on affiche normalement else // sinon on affiche normalement
echo "<td data-value='".$NomSemestre."'>".$NomSemestre.'</td>'; echo "<td data-value='".$semestre['id']."'>".$semestre['nom'].'</td>';
// on ajoute le semestre à la liste pour ne pas le répéter
array_push($ListeUIDSemestres, $semestre['id']);
}}
echo "<td data-value='+'>+</td>"; // ajouter un semestre
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
/*******************/
/* AFFINAGE PAR UE */
/*******************/
echo "<table class='partlist' name='UE'><tbody><tr>"; echo "<table class='partlist' name='UE'><tbody><tr>";
if( $ueOpt == null ) echo "<td data-value='*' class='active'>Tous</td>"; if( $ueOpt == null ) echo "<td data-value='*' class='active'>Tous</td>";
else echo "<td data-value='*'>Tous</td>"; else echo "<td data-value='*'>Tous</td>";
foreach($ListeNomsUE as $NomUE) /* On récupère la liste des UEs en accord avec la FORMATION et le SEMESTRE sélectionnés */
if( $NomUE == $ueOpt ) // si c'est le semestre séléctionné foreach($answer->semestres as $semestre){ if( $semestre['id_formation'] == $formationOpt && in_array($semestre['id'], $ListeUIDSemestres) ){
echo "<td data-value='".$NomUE."' class='active'>".$NomUE.'</td>'; foreach($semestre['UElist'] as $UE){ if( !in_array($UE['id'], $ListeUIDUE) ){
if( $UE['id'] == $ueOpt ) // si c'est l'UE séléctionnée
echo "<td data-value='".$UE['id']."' class='active'>".$UE['nom'].'</td>';
else // sinon on affiche normalement else // sinon on affiche normalement
echo "<td data-value='".$NomUE."'>".$NomUE.'</td>'; echo "<td data-value='".$UE['id']."'>".$UE['nom'].'</td>';
// on ajoute l'UE à la liste pour ne pas le répéter
array_push($ListeUIDUE, $UE['id']);
}}
}}
echo "<td data-value='+'>+</td>"; // ajouter un UE
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
@ -215,11 +239,11 @@ if( permission('teacher') ){ // si l'utilisateur est un prof
foreach($answer->semestres as $semestre){ foreach($answer->semestres as $semestre){
if( ($semestreOpt == null || $semestre['nom'] == $semestreOpt) && ($formationOpt == null || $semestre['formation'] == $formationOpt) ){ // 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['nom'] == $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 "<table class='basic'>";
echo "<thead>"; echo "<thead>";
@ -293,81 +317,108 @@ if( permission('admin') ){ // si l'utilisateur est un admin
modules_switch_level_1($request, $answer); modules_switch_level_1($request, $answer);
if( $answer->request == 'success' ){ // si on a bien récupéré les membres du groupe if( $answer->request == 'success' ){ // si on a bien récupéré les membres du groupe
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
echo "<section name='allmodules' data-title='Tous les modules' class='basic'>"; echo "<section name='allmodules' data-title='Tous les modules' class='basic'>";
/* ON RECUPERE UNE LISTE UNIQUE DES SEMESTRES */ /* ON RECUPERE UNE LISTE UNIQUE DES SEMESTRES */
$ListeNomsSemestres = array(); $ListeUIDFormations = array();
$ListeNomsFormations = array(); $ListeUIDSemestres = array();
$ListeNomsUE = array(); $ListeUIDUE = array();
// on selectionne les formations présentes // Vérification de la formation si elle est définie
foreach($answer->semestres as $semestre) $verificationUIDFormations = array();
array_push( $ListeNomsFormations, $semestre['formation'] ); foreach($answer->semestres as $semestre) // on récupère la liste des UID de FORMATIONS
if( !in_array($semestre['id_formation'], $verificationUIDFormations) )
// si la formation optionnelle n'est pas définie, on la définit array_push($verificationUIDFormations, $semestre['id_formation']);
$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);
// 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];
/**************************/
/* AFFINAGE PAR FORMATION */
/**************************/
echo "<table class='partlist' name='formation'><tbody><tr>"; echo "<table class='partlist' name='formation'><tbody><tr>";
foreach($ListeNomsFormations as $NomFormation) foreach($answer->semestres as $semestre){ if( !in_array($semestre['id_formation'], $ListeUIDFormations) ){
if( $NomFormation == $formationOpt ) // si c'est le semestre séléctionné
echo "<td data-value='".$NomFormation."' class='active'>".$NomFormation.'</td>';
if( $semestre['id_formation'] == $formationOpt ) // si c'est la formation séléctionnée
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='".$NomFormation."'>".$NomFormation.'</td>'; echo "<td data-value='".$semestre['id_formation']."'>".$semestre['formation'].'</td>';
// on ajoute la formation à la liste pour ne pas la répéter
array_push($ListeUIDFormations, $semestre['id_formation']);
}}
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
/*************************/
/* AFFINAGE PAR SEMESTRE */
/*************************/
echo "<table class='partlist' name='semestre'><tbody><tr>"; echo "<table class='partlist' name='semestre'><tbody><tr>";
if( $semestreOpt == null ) echo "<td data-value='*' class='active'>Tous</td>"; if( $semestreOpt == null ) echo "<td data-value='*' class='active'>Tous</td>";
else echo "<td data-value='*'>Tous</td>"; else echo "<td data-value='*'>Tous</td>";
foreach($ListeNomsSemestres as $NomSemestre) /* On récupère la liste des SEMESTRES en accord avec la FORMATION sélectionnée */
if( $NomSemestre == $semestreOpt ) // si c'est le semestre séléctionné foreach($answer->semestres as $semestre){ if( $semestre['id_formation'] == $formationOpt && !in_array($semestre['id'], $ListeUIDSemestres) ){
echo "<td data-value='".$NomSemestre."' class='active'>".$NomSemestre.'</td>';
if( $semestre['id'] == $semestreOpt ) // si c'est le semestre séléctionné
echo "<td data-value='".$semestre['id']."' class='active'>".$semestre['nom'].'</td>';
else // sinon on affiche normalement else // sinon on affiche normalement
echo "<td data-value='".$NomSemestre."'>".$NomSemestre.'</td>'; echo "<td data-value='".$semestre['id']."'>".$semestre['nom'].'</td>';
// on ajoute le semestre à la liste pour ne pas le répéter
array_push($ListeUIDSemestres, $semestre['id']);
}}
echo "<td data-value='+'>+</td>"; // ajouter un semestre
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
/*******************/
/* AFFINAGE PAR UE */
/*******************/
echo "<table class='partlist' name='UE'><tbody><tr>"; echo "<table class='partlist' name='UE'><tbody><tr>";
if( $ueOpt == null ) echo "<td data-value='*' class='active'>Tous</td>"; if( $ueOpt == null ) echo "<td data-value='*' class='active'>Tous</td>";
else echo "<td data-value='*'>Tous</td>"; else echo "<td data-value='*'>Tous</td>";
foreach($ListeNomsUE as $NomUE) /* On récupère la liste des UEs en accord avec la FORMATION et le SEMESTRE sélectionnés */
if( $NomUE == $ueOpt ) // si c'est le semestre séléctionné foreach($answer->semestres as $semestre){ if( $semestre['id_formation'] == $formationOpt && in_array($semestre['id'], $ListeUIDSemestres) ){
echo "<td data-value='".$NomUE."' class='active'>".$NomUE.'</td>'; foreach($semestre['UElist'] as $UE){ if( !in_array($UE['id'], $ListeUIDUE) ){
if( $UE['id'] == $ueOpt ) // si c'est l'UE séléctionnée
echo "<td data-value='".$UE['id']."' class='active'>".$UE['nom'].'</td>';
else // sinon on affiche normalement else // sinon on affiche normalement
echo "<td data-value='".$NomUE."'>".$NomUE.'</td>'; echo "<td data-value='".$UE['id']."'>".$UE['nom'].'</td>';
// on ajoute l'UE à la liste pour ne pas le répéter
array_push($ListeUIDUE, $UE['id']);
}}
}}
echo "<td data-value='+'>+</td>"; // ajouter un UE
echo "</tr></tbody></table>"; echo "</tr></tbody></table>";
foreach($answer->semestres as $semestre){ foreach($answer->semestres as $semestre){
if( ($semestreOpt == null || $semestre['nom'] == $semestreOpt) && ($formationOpt == null || $semestre['formation'] == $formationOpt) ){ // 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['nom'] == $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 "<table class='basic'>";
echo "<thead>"; echo "<thead>";

View File

@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net -- http://www.phpmyadmin.net
-- --
-- Client: localhost -- Client: localhost
-- Généré le: Lun 16 Novembre 2015 à 12:42 -- Généré le: Lun 16 Novembre 2015 à 21:41
-- Version du serveur: 5.5.46-0ubuntu0.14.04.2 -- Version du serveur: 5.5.46-0ubuntu0.14.04.2
-- Version de PHP: 5.5.9-1ubuntu4.14 -- Version de PHP: 5.5.9-1ubuntu4.14
@ -429,7 +429,7 @@ CREATE TABLE IF NOT EXISTS `note` (
PRIMARY KEY (`id_note`), PRIMARY KEY (`id_note`),
KEY `id_appartenance` (`id_appartenance`), KEY `id_appartenance` (`id_appartenance`),
KEY `id_controle` (`id_controle`) KEY `id_controle` (`id_controle`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=50 ; ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=57 ;
-- --
-- RELATIONS POUR LA TABLE `note`: -- RELATIONS POUR LA TABLE `note`:
@ -445,7 +445,7 @@ CREATE TABLE IF NOT EXISTS `note` (
INSERT INTO `note` (`id_note`, `id_appartenance`, `id_controle`, `valeur`) VALUES INSERT INTO `note` (`id_note`, `id_appartenance`, `id_controle`, `valeur`) VALUES
(11, 103, 1, 15.25), (11, 103, 1, 15.25),
(12, 54, 2, 2), (12, 54, 2, 5),
(13, 103, 3, 3), (13, 103, 3, 3),
(14, 103, 4, 4), (14, 103, 4, 4),
(15, 103, 5, 5), (15, 103, 5, 5),
@ -459,9 +459,9 @@ INSERT INTO `note` (`id_note`, `id_appartenance`, `id_controle`, `valeur`) VALUE
(23, 91, 1, 3.5), (23, 91, 1, 3.5),
(24, 19, 1, 4.5), (24, 19, 1, 4.5),
(25, 58, 1, 5.25), (25, 58, 1, 5.25),
(26, 49, 2, 3), (26, 49, 2, 6),
(27, 87, 2, 4), (27, 87, 2, 7),
(28, 3, 2, 5), (28, 3, 2, 8),
(29, 74, 1, 14.75), (29, 74, 1, 14.75),
(30, 26, 1, 1.9), (30, 26, 1, 1.9),
(31, 97, 1, 10), (31, 97, 1, 10),
@ -482,7 +482,14 @@ INSERT INTO `note` (`id_note`, `id_appartenance`, `id_controle`, `valeur`) VALUE
(46, 13, 1, 2), (46, 13, 1, 2),
(47, 67, 1, 0), (47, 67, 1, 0),
(48, 70, 1, 0.5), (48, 70, 1, 0.5),
(49, 5, 1, 1.75); (49, 5, 1, 1.75),
(50, 46, 11, 1),
(51, 33, 11, 2),
(52, 61, 11, 3),
(53, 48, 11, 4),
(54, 43, 11, 5),
(55, 98, 11, 6),
(56, 56, 11, 1);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -492,18 +499,18 @@ INSERT INTO `note` (`id_note`, `id_appartenance`, `id_controle`, `valeur`) VALUE
CREATE TABLE IF NOT EXISTS `semestre` ( CREATE TABLE IF NOT EXISTS `semestre` (
`id_semestre` int(11) NOT NULL AUTO_INCREMENT, `id_semestre` int(11) NOT NULL AUTO_INCREMENT,
`formation` int(11) NOT NULL, `id_formation` int(11) NOT NULL,
`nom` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `nom` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`rang` tinyint(4) NOT NULL, `rang` tinyint(4) NOT NULL,
`annee` year(4) NOT NULL, `annee` year(4) NOT NULL,
PRIMARY KEY (`id_semestre`), PRIMARY KEY (`id_semestre`),
UNIQUE KEY `rang` (`rang`,`annee`), UNIQUE KEY `rang` (`rang`,`annee`),
KEY `id_formation` (`formation`) KEY `id_formation` (`id_formation`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
-- --
-- RELATIONS POUR LA TABLE `semestre`: -- RELATIONS POUR LA TABLE `semestre`:
-- `formation` -- `id_formation`
-- `formation` -> `id_formation` -- `formation` -> `id_formation`
-- --
@ -511,7 +518,7 @@ CREATE TABLE IF NOT EXISTS `semestre` (
-- Contenu de la table `semestre` -- Contenu de la table `semestre`
-- --
INSERT INTO `semestre` (`id_semestre`, `formation`, `nom`, `rang`, `annee`) VALUES INSERT INTO `semestre` (`id_semestre`, `id_formation`, `nom`, `rang`, `annee`) VALUES
(1, 1, 'S1', 1, 2015), (1, 1, 'S1', 1, 2015),
(2, 1, 'S2', 2, 2015), (2, 1, 'S2', 2, 2015),
(3, 2, 'S3', 3, 2015), (3, 2, 'S3', 3, 2015),
@ -721,7 +728,7 @@ ALTER TABLE `note`
-- Contraintes pour la table `semestre` -- Contraintes pour la table `semestre`
-- --
ALTER TABLE `semestre` ALTER TABLE `semestre`
ADD CONSTRAINT `semestre_id_formation` FOREIGN KEY (`formation`) REFERENCES `formation` (`id_formation`); ADD CONSTRAINT `semestre_id_formation` FOREIGN KEY (`id_formation`) REFERENCES `formation` (`id_formation`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;