Affichage des notes par module + affichage des notes par UE
This commit is contained in:
parent
6b0867b933
commit
a77aaa78d0
2
API.js
2
API.js
|
@ -51,7 +51,7 @@ APIClass.prototype = {
|
|||
if( ptrAPI.xhr[i].readyState == 4 ){ // si la requête est terminée
|
||||
|
||||
/* DEBUG : affiche la réponse BRUTE de API.php */
|
||||
// console.log('API.php => '+ptrAPI.xhr[i].responseText);
|
||||
console.log('API.php => '+ptrAPI.xhr[i].responseText);
|
||||
console.log(JSON.parse(ptrAPI.xhr[i].responseText) );
|
||||
|
||||
/* si success de requête */
|
||||
|
|
10
API.php
10
API.php
|
@ -46,10 +46,12 @@ require_once __ROOT__.'/manager/security.php';
|
|||
break;
|
||||
|
||||
|
||||
/********************/
|
||||
/* CALCUL DES NOTES */
|
||||
/********************/
|
||||
case 'MCC':
|
||||
/********************************/
|
||||
/* DOSSIER ETUDIANT (NOTES,...) */
|
||||
/********************************/
|
||||
case 'career':
|
||||
if( isset($request->level_1) ){ require_once __ROOT__.'/manager/career.php'; career_switch_level_1($request, $answer); }
|
||||
else { $answer->request = 'missing_level_1'; }
|
||||
break;
|
||||
|
||||
|
||||
|
|
15
css/menu.css
15
css/menu.css
|
@ -126,10 +126,9 @@
|
|||
/* gestion des différentes icônes */
|
||||
#MENU span:nth-child(2){ background-image: url(../src/menu/menu_icon/home.svg); }
|
||||
#MENU span:nth-child(3){ background-image: url(../src/menu/menu_icon/groups.svg); }
|
||||
#MENU span:nth-child(4){ background-image: url(../src/menu/menu_icon/ue.svg); }
|
||||
#MENU span:nth-child(5){ background-image: url(../src/menu/menu_icon/modules.svg); }
|
||||
#MENU span:nth-child(6){ background-image: url(../src/menu/menu_icon/marks.svg); }
|
||||
#MENU span:nth-child(7){ background-image: url(../src/menu/menu_icon/settings.svg); }
|
||||
#MENU span:nth-child(4){ background-image: url(../src/menu/menu_icon/modules.svg); }
|
||||
#MENU span:nth-child(5){ background-image: url(../src/menu/menu_icon/career.svg); }
|
||||
#MENU span:nth-child(6){ background-image: url(../src/menu/menu_icon/settings.svg); }
|
||||
|
||||
|
||||
/* gestion de l'activation des différentes icônes */
|
||||
|
@ -138,13 +137,11 @@
|
|||
#MENU span:nth-child(3):hover,
|
||||
#MENU span:nth-child(3).active{ background-image: url(../src/menu/menu_icon/groups@hover.svg); }
|
||||
#MENU span:nth-child(4):hover,
|
||||
#MENU span:nth-child(4).active{ background-image: url(../src/menu/menu_icon/ue@hover.svg); }
|
||||
#MENU span:nth-child(4).active{ background-image: url(../src/menu/menu_icon/modules@hover.svg); }
|
||||
#MENU span:nth-child(5):hover,
|
||||
#MENU span:nth-child(5).active{ background-image: url(../src/menu/menu_icon/modules@hover.svg); }
|
||||
#MENU span:nth-child(5).active{ background-image: url(../src/menu/menu_icon/career@hover.svg); }
|
||||
#MENU span:nth-child(6):hover,
|
||||
#MENU span:nth-child(6).active{ background-image: url(../src/menu/menu_icon/marks@hover.svg); }
|
||||
#MENU span:nth-child(7):hover,
|
||||
#MENU span:nth-child(7).active{ background-image: url(../src/menu/menu_icon/settings@hover.svg); }
|
||||
#MENU span:nth-child(6).active{ background-image: url(../src/menu/menu_icon/settings@hover.svg); }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -51,9 +51,8 @@ $notifNotifNum = 5;
|
|||
<span data-link='home' >Accueil </span>
|
||||
<?php if( $_SESSION['identifiant'] != null ){ ?>
|
||||
<span data-link='groups' >Composition</span>
|
||||
<span data-link='ue' >Suivi </span>
|
||||
<span data-link='modules' >Modules </span>
|
||||
<span data-link='marks' >Notes </span>
|
||||
<span data-link='career' >Parcours </span>
|
||||
<span data-link='settings'>Paramètres </span>
|
||||
<?php } ?>
|
||||
</nav>
|
||||
|
|
|
@ -61,7 +61,7 @@ var connected = !( DOM.AUTH.children[0].innerHTML == 'Connexion' );
|
|||
pageM = new pageManager(); // instance principale
|
||||
|
||||
/* initialisation du gestionnaire */
|
||||
pageM.setPage(null, 'page', DOM.CONTAINER, ['home', 'groups', 'ue', 'modules', 'marks', 'auth', 'settings'] );
|
||||
pageM.setPage(null, 'page', DOM.CONTAINER, ['home', 'groups', 'modules', 'career', 'settings'] );
|
||||
|
||||
|
||||
/* [b] API.js
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
require_once __ROOT__.'/manager/security.php';
|
||||
require_once __ROOT__.'/manager/database.php';
|
||||
|
||||
/***********************************************************
|
||||
* *
|
||||
* MANAGER DES MODULES *
|
||||
* *
|
||||
************************************************************
|
||||
* *
|
||||
* [0] Constantes *
|
||||
* [1] ROUTAGE de niveau 1 *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
***********************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [1] ROUTAGE DE NIVEAU 1
|
||||
============================================================*/
|
||||
function career_switch_level_1($request, $answer){
|
||||
|
||||
switch( $request->level_1 ){
|
||||
|
||||
/*******************************/
|
||||
/* liste des notes par modules */
|
||||
/*******************************/
|
||||
case 'getNotesByModules':
|
||||
$areSetParam = isset($request->etudiant) && isset($request->semestre) && isset($request->annee); // les arguments existent
|
||||
$typeOkParam = $areSetParam && is_string($request->etudiant) && is_string($request->semestre) && is_string($request->annee); // si c'est des strings
|
||||
$nEmptyParam = $typeOkParam && strlen($request->etudiant) > 0 && is_numeric($request->semestre) && is_numeric($request->annee); // des bon types
|
||||
$etudiantCheck = $nEmptyParam && preg_match('/^[\w -]{6,100}$/i', $request->etudiant); // nom bon format
|
||||
$semestreCheck = $etudiantCheck && preg_match('/^[1-4]{1}$/i', $request->semestre); // semestre (semestre) bon format
|
||||
$anneeCheck = $semestreCheck && preg_match('/^[0-9]{4}$/i', $request->annee); // semestre (annee) bon format
|
||||
|
||||
if( $anneeCheck ){ // si tout les paramètres sont bons
|
||||
$notes = DataBase::getInstance()->getNotesByModules($request->etudiant, $request->semestre, $request->annee);
|
||||
|
||||
if( is_array($notes) ){ // si on a bien un tableau
|
||||
$answer->notes = $notes; // on renvoie dans answer->note
|
||||
$answer->request = 'success'; // et on renvoie success
|
||||
}else // sinon si c'est pas un tableau
|
||||
$answer->request = $notes; // on retourne l'erreur
|
||||
}else
|
||||
$answer->request = 'param_error';
|
||||
break;
|
||||
|
||||
/***************************/
|
||||
/* liste des notes par UEs */
|
||||
/***************************/
|
||||
case 'getNotesByUEs':
|
||||
$areSetParam = isset($request->etudiant) && isset($request->semestre) && isset($request->annee); // les arguments existent
|
||||
$typeOkParam = $areSetParam && is_string($request->etudiant) && is_string($request->semestre) && is_string($request->annee); // si c'est des strings
|
||||
$nEmptyParam = $typeOkParam && strlen($request->etudiant) > 0 && is_numeric($request->semestre) && is_numeric($request->annee); // des bon types
|
||||
$etudiantCheck = $nEmptyParam && preg_match('/^[\w -]{6,100}$/i', $request->etudiant); // nom bon format
|
||||
$semestreCheck = $etudiantCheck && preg_match('/^[1-4]{1}$/i', $request->semestre); // semestre (semestre) bon format
|
||||
$anneeCheck = $semestreCheck && preg_match('/^[0-9]{4}$/i', $request->annee); // semestre (annee) bon format
|
||||
|
||||
if( $anneeCheck ){ // si tout les paramètres sont bons
|
||||
$notes = DataBase::getInstance()->getNotesByUEs($request->etudiant, $request->semestre, $request->annee);
|
||||
|
||||
if( is_array($notes) ){ // si on a bien un tableau
|
||||
$answer->notes = $notes; // on renvoie dans answer->note
|
||||
$answer->request = 'success'; // et on renvoie success
|
||||
}else // sinon si c'est pas un tableau
|
||||
$answer->request = $notes; // on retourne l'erreur
|
||||
}else
|
||||
$answer->request = 'param_error';
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
/***********/
|
||||
/* DEFAULT */
|
||||
/***********/
|
||||
default:
|
||||
$answer->request = 'unknown_level_1';
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -24,7 +24,7 @@ class DataBase{
|
|||
|
||||
/* retourne une instance de la classe */
|
||||
public static function getInstance(){
|
||||
return new DataBase("localhost", "sid2", "php", "Qt358nUdyeTxLDM8");
|
||||
return new DataBase("localhost", "sid", "php", "Qt358nUdyeTxLDM8");
|
||||
}
|
||||
|
||||
/*********************************************/
|
||||
|
@ -350,7 +350,7 @@ class DataBase{
|
|||
return 'unknown_group';
|
||||
|
||||
// si on a l'UID utilisateur & l'UID groupe => on récupère les modules
|
||||
$getModuleList = $this->pdo->prepare("SELECT DISTINCT m.nom, m.libelle ".
|
||||
$getModuleList = $this->pdo->prepare("SELECT DISTINCT m.id_module as id, m.nom as nom, m.libelle as libelle ".
|
||||
"FROM module as m, groupe as g, semestre as s, programme as prog, ue, appartenance as app ".
|
||||
"WHERE app.id_semestre = prog.id_semestre ".
|
||||
"AND app.id_semestre = s.id_semestre ".
|
||||
|
@ -381,6 +381,377 @@ class DataBase{
|
|||
|
||||
|
||||
|
||||
/**************************************/
|
||||
/*** retourne les UEs d'un étudiant ***/
|
||||
/**************************************/
|
||||
public function getUEsEtudiant($etudiant, $semestre, $annee){
|
||||
/*** on cherche un semestre avec ce rang et cette année (qui est unique) ***/
|
||||
$getSemestreUID = $this->pdo->prepare("SELECT id_semestre as id FROM semestre WHERE rang = :rang AND annee = :annee");
|
||||
$getSemestreUID->execute(array(
|
||||
':rang' => $semestre,
|
||||
':annee' => $annee
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_group"
|
||||
if( $semestreUID = $getSemestreUID->fetch()['id'] )
|
||||
$semestreUID = (int) $semestreUID;
|
||||
else
|
||||
return 'unknown_semestre';
|
||||
|
||||
|
||||
|
||||
/*** on cherche un utilisateur avec cet identifiant ***/
|
||||
$getEtudiantUID = $this->pdo->prepare("SELECT identifiant as id FROM utilisateur WHERE identifiant = :etudiant");
|
||||
$getEtudiantUID->execute(array(
|
||||
':etudiant' => $etudiant
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_user"
|
||||
if( $etudiantUID = $getEtudiantUID->fetch()['id'] )
|
||||
$etudiantUID = $etudiantUID;
|
||||
else
|
||||
return 'unknown_user';
|
||||
|
||||
/*** on cherche le groupe de cet utilisateur ***/
|
||||
$getGroupeUID = $this->pdo->prepare("SELECT g.id_groupe as id ".
|
||||
"FROM utilisateur as u, groupe as g, appartenance as app, semestre as s ".
|
||||
"WHERE app.id_etudiant = u.identifiant ".
|
||||
"AND app.id_groupe = g.id_groupe ".
|
||||
"AND app.id_semestre = s.id_semestre ".
|
||||
|
||||
"AND u.identifiant = :etudiantUID ".
|
||||
"AND app.id_semestre = :semestreUID");
|
||||
$getGroupeUID->execute(array(
|
||||
':etudiantUID' => $etudiantUID,
|
||||
':semestreUID' => $semestreUID,
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_user"
|
||||
if( $groupeUID = $getGroupeUID->fetch()['id'] )
|
||||
$groupeUID = $groupeUID;
|
||||
else
|
||||
return 'unknown_group';
|
||||
|
||||
// si on a l'UID utilisateur & l'UID groupe => on récupère les modules
|
||||
$getUEList = $this->pdo->prepare("SELECT DISTINCT ue.id_ue as id, s.annee as annee, ue.nom as nom, ue.libelle as libelle ".
|
||||
"FROM module as m, groupe as g, semestre as s, programme as prog, ue, appartenance as app ".
|
||||
"WHERE app.id_semestre = prog.id_semestre ".
|
||||
"AND app.id_semestre = s.id_semestre ".
|
||||
"AND app.id_groupe = g.id_groupe ".
|
||||
"AND prog.id_ue = ue.id_ue ".
|
||||
"AND prog.id_module = m.id_module ".
|
||||
|
||||
"AND g.id_groupe = :groupeUID ".
|
||||
"AND app.id_semestre = :semestreUID ".
|
||||
"ORDER BY m.nom, m.libelle ASC");
|
||||
$getUEList->execute(array(
|
||||
':groupeUID' => $groupeUID,
|
||||
':semestreUID' => $semestreUID
|
||||
));
|
||||
|
||||
$UElist = $getUEList->fetchAll(); // on récupère la liste des modules
|
||||
|
||||
// on supprime les doublons des entrées (indice numérique)
|
||||
for( $i = 0 ; $i < count($UElist) ; $i++ ) // pour tout les modules
|
||||
foreach($UElist[$i] as $col => $val) // pour toutes les entrées
|
||||
if( is_int($col) ) // si l'indice est un entier
|
||||
unset( $UElist[$i][$col] ); // on le supprime
|
||||
|
||||
return $UElist;
|
||||
}
|
||||
|
||||
|
||||
/**************************************/
|
||||
/*** retourne les notes par modules ***/
|
||||
/**************************************/
|
||||
public function getNotesByModules($etudiant, $semestre, $annee){
|
||||
/*** on cherche un semestre avec ce rang et cette année (qui est unique) ***/
|
||||
$getSemestreUID = $this->pdo->prepare("SELECT id_semestre as id FROM semestre WHERE rang = :rang AND annee = :annee");
|
||||
$getSemestreUID->execute(array(
|
||||
':rang' => $semestre,
|
||||
':annee' => $annee
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_group"
|
||||
if( $semestreUID = $getSemestreUID->fetch()['id'] )
|
||||
$semestreUID = (int) $semestreUID;
|
||||
else
|
||||
return 'unknown_semestre';
|
||||
|
||||
|
||||
/*** on cherche un utilisateur avec cet identifiant ***/
|
||||
$getEtudiantUID = $this->pdo->prepare("SELECT u.identifiant as id FROM utilisateur as u, appartenance as app ".
|
||||
"WHERE u.identifiant = app.id_etudiant ".
|
||||
"AND u.identifiant = :etudiant ".
|
||||
"AND app.id_semestre = :semestreUID");
|
||||
$getEtudiantUID->execute(array(
|
||||
':etudiant' => $etudiant,
|
||||
':semestreUID' => $semestreUID
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_user"
|
||||
if( $etudiantUID = $getEtudiantUID->fetch()['id'] )
|
||||
$etudiantUID = $etudiantUID;
|
||||
else
|
||||
return 'unknown_user';
|
||||
|
||||
|
||||
$notelist = array(); // tableau qui contiendra tout les modules
|
||||
|
||||
$modulelist = $this->getModulesEtudiant($etudiant, $semestre, $annee); // on récupère la liste des modules
|
||||
|
||||
foreach($modulelist as $module){ // pour chaque module
|
||||
|
||||
$notes = $this->getModuleNotes($etudiant, $module['nom'], $semestre, $annee); // on récupère les notes
|
||||
|
||||
$current = array(); // on créé l'entrée qui sera dans le tableau de retour
|
||||
$current['module'] = array();
|
||||
$current['module']['nom'] = $module['nom']; // contenant le nom du module
|
||||
$current['module']['libelle'] = $module['libelle']; // contenant le nom du module
|
||||
$current['notes'] = $notes; // et la liste de notes
|
||||
|
||||
array_push($notelist, $current); // on l'ajoute au résultat
|
||||
}
|
||||
|
||||
return $notelist;
|
||||
}
|
||||
|
||||
|
||||
/*********************************/
|
||||
/*** retourne les notes par UE ***/
|
||||
/*********************************/
|
||||
public function getNotesByUEs($etudiant, $semestre, $annee){
|
||||
/*** on cherche un semestre avec ce rang et cette année (qui est unique) ***/
|
||||
$getSemestreUID = $this->pdo->prepare("SELECT id_semestre as id FROM semestre WHERE rang = :rang AND annee = :annee");
|
||||
$getSemestreUID->execute(array(
|
||||
':rang' => $semestre,
|
||||
':annee' => $annee
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_group"
|
||||
if( $semestreUID = $getSemestreUID->fetch()['id'] )
|
||||
$semestreUID = (int) $semestreUID;
|
||||
else
|
||||
return 'unknown_semestre';
|
||||
|
||||
|
||||
/*** on cherche un utilisateur avec cet identifiant ***/
|
||||
$getEtudiantUID = $this->pdo->prepare("SELECT u.identifiant as id FROM utilisateur as u, appartenance as app ".
|
||||
"WHERE u.identifiant = app.id_etudiant ".
|
||||
"AND u.identifiant = :etudiant ".
|
||||
"AND app.id_semestre = :semestreUID");
|
||||
$getEtudiantUID->execute(array(
|
||||
':etudiant' => $etudiant,
|
||||
':semestreUID' => $semestreUID
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_user"
|
||||
if( $etudiantUID = $getEtudiantUID->fetch()['id'] )
|
||||
$etudiantUID = $etudiantUID;
|
||||
else
|
||||
return 'unknown_user';
|
||||
|
||||
|
||||
$notelist = array(); // tableau qui contiendra tout les modules
|
||||
|
||||
$UElist = $this->getUEsEtudiant($etudiant, $semestre, $annee); // on récupère la liste des modules
|
||||
|
||||
foreach($UElist as $UE){ // pour chaque module
|
||||
|
||||
$notes = $this->getUENotes($etudiant, $UE['nom'], $semestre, $annee); // on récupère les notes
|
||||
|
||||
$current = array(); // on créé l'entrée qui sera dans le tableau de retour
|
||||
$current['UE'] = array();
|
||||
$current['UE']['annee'] = $UE['annee']; // contenant l'annee du UE
|
||||
$current['UE']['nom'] = $UE['nom']; // contenant le nom du UE
|
||||
$current['UE']['libelle'] = $UE['libelle']; // contenant le libelle du UE
|
||||
$current['notes'] = $notes; // et la liste de notes
|
||||
|
||||
array_push($notelist, $current); // on l'ajoute au résultat
|
||||
}
|
||||
|
||||
return $notelist;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************/
|
||||
/*** retourne les notes d'un module ***/
|
||||
/**************************************/
|
||||
public function getModuleNotes($etudiant, $module, $semestre, $annee){
|
||||
/*** on cherche un semestre avec ce rang et cette année (qui est unique) ***/
|
||||
$getSemestreUID = $this->pdo->prepare("SELECT id_semestre as id FROM semestre WHERE rang = :rang AND annee = :annee");
|
||||
$getSemestreUID->execute(array(
|
||||
':rang' => $semestre,
|
||||
':annee' => $annee
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_group"
|
||||
if( $semestreUID = $getSemestreUID->fetch()['id'] )
|
||||
$semestreUID = (int) $semestreUID;
|
||||
else
|
||||
return 'unknown_semestre';
|
||||
|
||||
|
||||
/*** on cherche un utilisateur avec cet identifiant ***/
|
||||
$getEtudiantUID = $this->pdo->prepare("SELECT identifiant as id FROM utilisateur as u, appartenance as app ".
|
||||
"WHERE u.identifiant = app.id_etudiant ".
|
||||
"AND u.identifiant = :etudiant ".
|
||||
"AND app.id_semestre = :semestreUID");
|
||||
$getEtudiantUID->execute(array(
|
||||
':etudiant' => $etudiant,
|
||||
':semestreUID' => $semestreUID
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_user"
|
||||
if( $etudiantUID = $getEtudiantUID->fetch()['id'] )
|
||||
$etudiantUID = $etudiantUID;
|
||||
else
|
||||
return 'unknown_user';
|
||||
|
||||
|
||||
|
||||
/*** on cherche un module avec ce nom, en accord avec le semestre et l'étudiant ***/
|
||||
$getModuleUID = $this->pdo->prepare("SELECT m.id_module as id FROM module as m, appartenance as app, programme as prog ".
|
||||
"WHERE prog.id_module = m.id_module ".
|
||||
"AND prog.id_semestre = app.id_semestre ".
|
||||
"AND m.nom = :module ".
|
||||
"AND app.id_etudiant = :etudiantUID ".
|
||||
"AND app.id_semestre = :semestreUID");
|
||||
$getModuleUID->execute(array(
|
||||
':module' => $module,
|
||||
':etudiantUID' => $etudiantUID,
|
||||
':semestreUID' => $semestreUID
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_group"
|
||||
if( $moduleUID = $getModuleUID->fetch()['id'] )
|
||||
$moduleUID = (int) $moduleUID;
|
||||
else
|
||||
return 'unknown_module';
|
||||
|
||||
// si on a l'UID utilisateur & l'UID groupe => on récupère les modules
|
||||
$getModuleList = $this->pdo->prepare("SELECT note.intitule, note.valeur, note.base ".
|
||||
"FROM note, appartenance as app, programme as prog, semestre as s, module as m ".
|
||||
"WHERE note.id_appartenance = app.id_appartenance ".
|
||||
"AND note.id_programme = prog.id_programme ".
|
||||
"AND prog.id_module = m.id_module ".
|
||||
"AND prog.id_semestre = s.id_semestre ".
|
||||
|
||||
"AND prog.id_module = :moduleUID ".
|
||||
"AND app.id_etudiant = :etudiantUID ".
|
||||
"AND s.id_semestre = :semestreUID ".
|
||||
"ORDER BY note.valeur, note.base ASC");
|
||||
$getModuleList->execute(array(
|
||||
':moduleUID' => $moduleUID,
|
||||
':etudiantUID' => $etudiantUID,
|
||||
':semestreUID' => $semestreUID
|
||||
));
|
||||
|
||||
$notes = $getModuleList->fetchAll(); // on récupère la liste des notes
|
||||
|
||||
// on supprime les doublons des entrées (indice numérique)
|
||||
for( $i = 0 ; $i < count($notes) ; $i++ ) // pour toutes les notes
|
||||
foreach($notes[$i] as $col => $val) // pour toutes les entrées
|
||||
if( is_int($col) ) // si l'indice est un entier
|
||||
unset( $notes[$i][$col] ); // on le supprime
|
||||
|
||||
return $notes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**********************************/
|
||||
/*** retourne les notes d'un UE ***/
|
||||
/**********************************/
|
||||
public function getUENotes($etudiant, $UE, $semestre, $annee){
|
||||
/*** on cherche un semestre avec ce rang et cette année (qui est unique) ***/
|
||||
$getSemestreUID = $this->pdo->prepare("SELECT id_semestre as id FROM semestre WHERE rang = :rang AND annee = :annee");
|
||||
$getSemestreUID->execute(array(
|
||||
':rang' => $semestre,
|
||||
':annee' => $annee
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_group"
|
||||
if( $semestreUID = $getSemestreUID->fetch()['id'] )
|
||||
$semestreUID = (int) $semestreUID;
|
||||
else
|
||||
return 'unknown_semestre';
|
||||
|
||||
|
||||
/*** on cherche un utilisateur avec cet identifiant ***/
|
||||
$getEtudiantUID = $this->pdo->prepare("SELECT identifiant as id FROM utilisateur as u, appartenance as app ".
|
||||
"WHERE u.identifiant = app.id_etudiant ".
|
||||
"AND u.identifiant = :etudiant ".
|
||||
"AND app.id_semestre = :semestreUID");
|
||||
$getEtudiantUID->execute(array(
|
||||
':etudiant' => $etudiant,
|
||||
':semestreUID' => $semestreUID
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_user"
|
||||
if( $etudiantUID = $getEtudiantUID->fetch()['id'] )
|
||||
$etudiantUID = $etudiantUID;
|
||||
else
|
||||
return 'unknown_user';
|
||||
|
||||
|
||||
/*** on cherche un module avec ce nom, en accord avec le semestre et l'étudiant ***/
|
||||
$getUEUID = $this->pdo->prepare("SELECT ue.id_ue as id ".
|
||||
"FROM module as m, appartenance as app, programme as prog, ue ".
|
||||
"WHERE prog.id_module = m.id_module ".
|
||||
"AND prog.id_semestre = app.id_semestre ".
|
||||
"AND prog.id_ue = ue.id_ue ".
|
||||
|
||||
"AND ue.nom = :UE ".
|
||||
"AND app.id_etudiant = :etudiantUID ".
|
||||
"AND app.id_semestre = :semestreUID");
|
||||
$getUEUID->execute(array(
|
||||
':UE' => $UE,
|
||||
':etudiantUID' => $etudiantUID,
|
||||
':semestreUID' => $semestreUID
|
||||
));
|
||||
|
||||
// si on trouve, on le définit, sinon on retourne "unknown_group"
|
||||
if( $UEUID = $getUEUID->fetch()['id'] )
|
||||
$UEUID = (int) $UEUID;
|
||||
else
|
||||
return 'unknown_UE';
|
||||
|
||||
|
||||
// si on a l'UID utilisateur & l'UID UE => on récupère les notes
|
||||
$getUEList = $this->pdo->prepare("SELECT note.intitule, note.valeur, note.base ".
|
||||
"FROM note, appartenance as app, programme as prog, semestre as s, module as m ".
|
||||
"WHERE note.id_appartenance = app.id_appartenance ".
|
||||
"AND note.id_programme = prog.id_programme ".
|
||||
"AND prog.id_module = m.id_module ".
|
||||
"AND prog.id_semestre = s.id_semestre ".
|
||||
|
||||
"AND prog.id_ue = :UEUID ".
|
||||
"AND app.id_etudiant = :etudiantUID ".
|
||||
"AND s.id_semestre = :semestreUID ".
|
||||
"ORDER BY note.valeur, note.base ASC");
|
||||
$getUEList->execute(array(
|
||||
':UEUID' => $UEUID,
|
||||
':etudiantUID' => $etudiantUID,
|
||||
':semestreUID' => $semestreUID
|
||||
));
|
||||
|
||||
$notes = $getUEList->fetchAll(); // on récupère la liste des notes
|
||||
|
||||
// on supprime les doublons des entrées (indice numérique)
|
||||
for( $i = 0 ; $i < count($notes) ; $i++ ) // pour toutes les notes
|
||||
foreach($notes[$i] as $col => $val) // pour toutes les entrées
|
||||
if( is_int($col) ) // si l'indice est un entier
|
||||
unset( $notes[$i][$col] ); // on le supprime
|
||||
|
||||
return $notes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -161,6 +161,11 @@ require_once __ROOT__.'/manager/database.php';
|
|||
// on définit les variables session
|
||||
$_SESSION['identifiant'] = $username;
|
||||
$_SESSION['droits'] = $userList->{$username}->permissions;
|
||||
|
||||
/******************************* TEMPO *********************************/
|
||||
$_SESSION['annee'] = '2015';
|
||||
$_SESSION['semestre'] = '2';
|
||||
/***********************************************************************/
|
||||
return 'success';
|
||||
}else
|
||||
return 'wrong_password';
|
||||
|
|
120
page/career.php
120
page/career.php
|
@ -1 +1,119 @@
|
|||
career.php
|
||||
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
|
||||
require_once __ROOT__.'/manager/security.php';
|
||||
require_once __ROOT__.'/manager/groups.php';
|
||||
require_once __ROOT__.'/manager/modules.php';
|
||||
require_once __ROOT__.'/manager/career.php';
|
||||
|
||||
/****************************************
|
||||
* *
|
||||
* SECTION "PARCOURS" *
|
||||
* *
|
||||
*****************************************
|
||||
*
|
||||
* [1] Mes modules (eleves) notes
|
||||
* [2] Mes ue (eleves) notes
|
||||
* [3] Mes semestres (eleves) notes
|
||||
* [4] Graphiques (eleves) notes
|
||||
*
|
||||
*****************************************/
|
||||
?>
|
||||
|
||||
|
||||
<!-- mes modules -->
|
||||
|
||||
<?php
|
||||
/**************************************/
|
||||
/*** MES MODULES (version étudiant) ***/
|
||||
/**************************************/
|
||||
if( $_SESSION['identifiant'] != null && $_SESSION['droits'] == 'student' ){ // si l'utilisateur est connecté et que c'est un élève
|
||||
|
||||
$request = new stdClass(); $answer = new stdClass();
|
||||
|
||||
$request->level_1 = 'getNotesByModules';
|
||||
$request->etudiant = $_SESSION['identifiant'];
|
||||
$request->semestre = $_SESSION['semestre'];
|
||||
$request->annee = $_SESSION['annee'];
|
||||
|
||||
career_switch_level_1($request, $answer);
|
||||
|
||||
if( $answer->request == 'success' ){ // si on a bien récupéré les modules/notes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
echo "<section name='marksbymodules' title='Mes modules' class='basic'>";
|
||||
|
||||
foreach($answer->notes as $module){
|
||||
|
||||
echo "<table class='basic'>";
|
||||
echo "<thead class='active'>";
|
||||
echo '<tr>';
|
||||
echo '<th colspan=5>'.$module['module']['nom'].' - '.$module['module']['libelle'].'</th>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '</thead>';
|
||||
echo '<tbody>';
|
||||
foreach($module['notes'] as $note){
|
||||
echo '<tr>';
|
||||
echo '<td>'.$note['intitule'].'</td>';
|
||||
echo '<td>'.$note['valeur'].'/'.$note['base'].'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
echo '</section>';
|
||||
}else
|
||||
echo "Erreur interne.";
|
||||
|
||||
} ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- mes UEs -->
|
||||
|
||||
<?php
|
||||
/**************************************/
|
||||
/*** MES UEs (version étudiant) ***/
|
||||
/**************************************/
|
||||
if( $_SESSION['identifiant'] != null && $_SESSION['droits'] == 'student' ){ // si l'utilisateur est connecté et que c'est un élève
|
||||
|
||||
$request = new stdClass(); $answer = new stdClass();
|
||||
debug();
|
||||
|
||||
$request->level_1 = 'getNotesByUEs';
|
||||
$request->etudiant = $_SESSION['identifiant'];
|
||||
$request->semestre = $_SESSION['semestre'];
|
||||
$request->annee = $_SESSION['annee'];
|
||||
|
||||
career_switch_level_1($request, $answer);
|
||||
|
||||
if( $answer->request == 'success' ){ // si on a bien récupéré les UE/notes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
echo "<section name='marksbyue' title='Mes UE' class='basic'>";
|
||||
|
||||
foreach($answer->notes as $UE){
|
||||
|
||||
echo "<table class='basic'>";
|
||||
echo "<thead class='active'>";
|
||||
echo '<tr>';
|
||||
echo '<th colspan=5>'.$UE['UE']['nom'].' - '.$UE['UE']['libelle'].'</th>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '</thead>';
|
||||
echo '<tbody>';
|
||||
foreach($UE['notes'] as $note){
|
||||
echo '<tr>';
|
||||
echo '<td>'.$note['intitule'].'</td>';
|
||||
echo '<td>'.$note['valeur'].'/'.$note['base'].'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
echo '</section>';
|
||||
}else
|
||||
echo "Erreur interne.";
|
||||
|
||||
} ?>
|
||||
|
|
|
@ -27,8 +27,8 @@ require_once __ROOT__.'/manager/groups.php';
|
|||
$answer = new stdClass();
|
||||
|
||||
$request->level_1 = 'grouplist';
|
||||
$request->semestre = '3';
|
||||
$request->annee = '2015';
|
||||
$request->semestre = $_SESSION['semestre'];
|
||||
$request->annee = $_SESSION['annee'];
|
||||
|
||||
groups_switch_level_1($request, $answer);
|
||||
|
||||
|
@ -100,8 +100,8 @@ if( $_SESSION['identifiant'] != null && $_SESSION['droits'] == 'student' ){ // s
|
|||
|
||||
$request->level_1 = 'get';
|
||||
$request->etudiant = $_SESSION['identifiant'];
|
||||
$request->semestre = '3';
|
||||
$request->annee = '2015';
|
||||
$request->semestre = $_SESSION['semestre'];
|
||||
$request->annee = $_SESSION['annee'];
|
||||
|
||||
groups_switch_level_1($request, $answer);
|
||||
|
||||
|
@ -111,8 +111,8 @@ if( $_SESSION['identifiant'] != null && $_SESSION['droits'] == 'student' ){ // s
|
|||
$request = new stdClass(); $answer = new stdClass();
|
||||
$request->level_1 = 'userlist';
|
||||
$request->groupe = $monGroupe;
|
||||
$request->semestre = '3';
|
||||
$request->annee = '2015';
|
||||
$request->semestre = $_SESSION['semestre'];
|
||||
$request->annee = $_SESSION['annee'];
|
||||
groups_switch_level_1($request, $answer);
|
||||
|
||||
if( $answer->request == 'success' ){ // si on a bien récupéré les membres du groupe
|
||||
|
@ -163,8 +163,8 @@ if( $_SESSION['identifiant'] != null && $_SESSION['droits'] == 'admin' ){ // si
|
|||
$answer = new stdClass();
|
||||
|
||||
$request->level_1 = 'grouplist';
|
||||
$request->semestre = '3';
|
||||
$request->annee = '2015';
|
||||
$request->semestre = $_SESSION['semestre'];
|
||||
$request->annee = $_SESSION['annee'];
|
||||
|
||||
groups_switch_level_1($request, $answer);
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Notes ici !!!
|
|
@ -1,19 +1,16 @@
|
|||
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
|
||||
require_once __ROOT__.'/manager/security.php';
|
||||
debug();
|
||||
require_once __ROOT__.'/manager/groups.php';
|
||||
require_once __ROOT__.'/manager/modules.php';
|
||||
|
||||
/****************************************
|
||||
* *
|
||||
* SECTION "GROUPES" *
|
||||
* SECTION "MODULES" *
|
||||
* *
|
||||
*****************************************
|
||||
*
|
||||
* [1] Présentation (studend + prof)
|
||||
* [2] Tout les groupes (tous connecté)
|
||||
* [3] Modifier les groupes (admin)
|
||||
* [4] Répartir les élèves (admin)
|
||||
* [1] MES MODULES (studend + prof)
|
||||
* [2] MES MODULES (prof)
|
||||
*
|
||||
*****************************************/
|
||||
?>
|
||||
|
@ -28,12 +25,11 @@ require_once __ROOT__.'/manager/modules.php';
|
|||
if( $_SESSION['identifiant'] != null && $_SESSION['droits'] == 'student' ){ // si l'utilisateur est connecté et que c'est un élève
|
||||
|
||||
$request = new stdClass(); $answer = new stdClass();
|
||||
debug();
|
||||
|
||||
$request->level_1 = 'getByEtudiant';
|
||||
$request->etudiant = $_SESSION['identifiant'];
|
||||
$request->semestre = '3';
|
||||
$request->annee = '2015';
|
||||
$request->semestre = $_SESSION['semestre'];
|
||||
$request->annee = $_SESSION['annee'];
|
||||
|
||||
modules_switch_level_1($request, $answer);
|
||||
|
||||
|
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
@ -4,7 +4,7 @@
|
|||
"password" : "eleve1password"
|
||||
},
|
||||
|
||||
"eme1913a": {
|
||||
"ydw1981a": {
|
||||
"permissions": "student",
|
||||
"password" : "password"
|
||||
},
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 76 KiB |
|
@ -144,7 +144,7 @@ ORDER BY s.annee, ue.nom, m.nom ASC
|
|||
/******************************************/
|
||||
/*** AFFICHE LES ETUDIANTS PAR SEMESTRE ***/
|
||||
/******************************************/
|
||||
SELECT DISTINCT s.annee as annee, s.nom as semestre, u.identifiant+'-' as etudiant
|
||||
SELECT DISTINCT s.annee as annee, s.nom as semestre, u.identifiant as etudiant
|
||||
FROM utilisateur as u, semestre as s, appartenance as app
|
||||
WHERE app.id_etudiant = u.identifiant
|
||||
AND app.id_semestre = s.id_semestre
|
||||
|
|
107
xdoc/sid.sql
107
xdoc/sid.sql
|
@ -19,8 +19,8 @@ SET time_zone = "+00:00";
|
|||
--
|
||||
-- Base de données: `sid2`
|
||||
--
|
||||
CREATE DATABASE IF NOT EXISTS `sid2` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
|
||||
USE `sid2`;
|
||||
CREATE DATABASE IF NOT EXISTS `sid` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
|
||||
USE `sid`;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
@ -221,25 +221,25 @@ CREATE TABLE IF NOT EXISTS `module` (
|
|||
--
|
||||
|
||||
INSERT INTO `module` (`id_module`, `nom`, `libelle`) VALUES
|
||||
(1, 'M1101', 'Bases de l''algorithmique'), -- S1 - UE1
|
||||
(2, 'M1102', 'Programmation web'), -- S1 - UE1
|
||||
(3, 'M1201', 'Affiche'), -- S1 - UE2
|
||||
(4, 'M1202', 'Journal'), -- S1 - UE2
|
||||
(1, 'M1101', 'Bases de l''algorithmique' ), -- S1 - UE1
|
||||
(2, 'M1102', 'Programmation web' ), -- S1 - UE1
|
||||
(3, 'M1201', 'Affiche' ), -- S1 - UE2
|
||||
(4, 'M1202', 'Journal' ), -- S1 - UE2
|
||||
|
||||
(5, 'M2101', 'Base de la POO'), -- S2 - UE1
|
||||
(6, 'M2102', 'Ada'), -- S2 - UE1
|
||||
(7, 'M2201', 'Revue de projet'), -- S2 - UE2
|
||||
(8, 'M2202', 'Magazine'), -- S2 - UE2
|
||||
(5, 'M2101', 'Base de la POO' ), -- S2 - UE1
|
||||
(6, 'M2102', 'Ada' ), -- S2 - UE1
|
||||
(7, 'M2201', 'Revue de projet' ), -- S2 - UE2
|
||||
(8, 'M2202', 'Magazine' ), -- S2 - UE2
|
||||
|
||||
(9, 'M3301', 'Algorithmique et structures de données'), -- S3 - UE3
|
||||
(10, 'M3302', 'POO avancée'), -- S3 - UE3
|
||||
(11, 'M3401', 'Curriculum Vitae'), -- S3 - UE4
|
||||
(12, 'M3402', 'Lettre de motivation'), -- S3 - UE4
|
||||
(10, 'M3302', 'POO avancée' ), -- S3 - UE3
|
||||
(11, 'M3401', 'Curriculum Vitae' ), -- S3 - UE4
|
||||
(12, 'M3402', 'Lettre de motivation' ), -- S3 - UE4
|
||||
|
||||
(13, 'M4301', 'Programmation serveur: PHP'), -- S4 - UE3
|
||||
(14, 'M4302', 'Informatique en stage'); -- S4 - UE3
|
||||
(15, 'M4401', 'Entretien'); -- S4 - UE4
|
||||
(16, 'M4402', 'Communication en stage'); -- S4 - UE4
|
||||
(13, 'M4301', 'Programmation serveur: PHP' ), -- S4 - UE3
|
||||
(14, 'M4302', 'Informatique en stage' ), -- S4 - UE3
|
||||
(15, 'M4401', 'Entretien' ), -- S4 - UE4
|
||||
(16, 'M4402', 'Communication en stage' ); -- S4 - UE4
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
@ -271,26 +271,26 @@ CREATE TABLE IF NOT EXISTS `note` (
|
|||
--
|
||||
|
||||
INSERT INTO `note` (`id_note`, `id_appartenance`, `id_programme`, `valeur`, `base`) VALUES
|
||||
(1, 6, 1, 1, 20), -- 01/20
|
||||
(2, 7, 1, 2, 20), -- 02/20
|
||||
(3, 7, 1, 3, 20), -- 03/20
|
||||
(4, 7, 1, 4, 20), -- 04/20
|
||||
(5, 7, 1, 5, 20), -- 05/20
|
||||
(6, 7, 1, 6, 20), -- 06/20
|
||||
(7, 7, 1, 7, 20), -- 07/20
|
||||
(8, 7, 1, 8, 20), -- 08/20
|
||||
(9, 7, 1, 9, 20), -- 09/20
|
||||
(10, 7, 1, 10, 20), -- 10/20
|
||||
(11, 6, 1, 11, 20), -- 11/20
|
||||
(12, 7, 1, 12, 20), -- 12/20
|
||||
(13, 7, 1, 13, 20), -- 13/20
|
||||
(14, 7, 1, 14, 20), -- 14/20
|
||||
(15, 7, 1, 15, 20), -- 15/20
|
||||
(16, 7, 1, 16, 20), -- 16/20
|
||||
(17, 7, 1, 17, 20), -- 17/20
|
||||
(18, 7, 1, 18, 20), -- 18/20
|
||||
(19, 7, 1, 19, 20), -- 19/20
|
||||
(20, 7, 1, 20, 20); -- 20/20
|
||||
(1, 1, 1, 1, 20), -- 01/20
|
||||
(2, 1, 1, 2, 20), -- 02/20
|
||||
(3, 1, 1, 3, 20), -- 03/20
|
||||
(4, 1, 1, 4, 20), -- 04/20
|
||||
(5, 1, 1, 5, 20), -- 05/20
|
||||
(6, 1, 1, 6, 20), -- 06/20
|
||||
(7, 1, 1, 7, 20), -- 07/20
|
||||
(8, 1, 1, 8, 20), -- 08/20
|
||||
(9, 1, 1, 9, 20), -- 09/20
|
||||
(10, 1, 1, 10, 20), -- 10/20
|
||||
(11, 1, 1, 11, 20), -- 11/20
|
||||
(12, 1, 1, 12, 20), -- 12/20
|
||||
(13, 1, 1, 13, 20), -- 13/20
|
||||
(14, 1, 1, 14, 20), -- 14/20
|
||||
(15, 1, 1, 15, 20), -- 15/20
|
||||
(16, 1, 1, 16, 20), -- 16/20
|
||||
(17, 1, 1, 17, 20), -- 17/20
|
||||
(18, 1, 1, 18, 20), -- 18/20
|
||||
(19, 1, 1, 19, 20), -- 19/20
|
||||
(20, 1, 1, 20, 20); -- 20/20
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
@ -324,14 +324,25 @@ CREATE TABLE IF NOT EXISTS `programme` (
|
|||
--
|
||||
|
||||
INSERT INTO `programme` (`id_programme`, `id_module`, `id_ue`, `id_semestre`) VALUES
|
||||
(1, 1, 1, 1),
|
||||
(2, 2, 1, 1),
|
||||
(3, 3, 2, 2),
|
||||
(4, 4, 2, 2),
|
||||
(5, 5, 3, 3),
|
||||
(6, 6, 3, 3),
|
||||
(7, 7, 4, 4),
|
||||
(8, 8, 4, 4);
|
||||
(1, 1, 1, 1), -- M1101 - UE1 - S1
|
||||
(2, 2, 1, 1), -- M1102 - UE1 - S1
|
||||
(3, 3, 2, 1), -- M1201 - UE2 - S1
|
||||
(4, 4, 2, 1), -- M1202 - UE2 - S1
|
||||
|
||||
(5, 5, 1, 2), -- M2101 - UE1 - S2
|
||||
(6, 6, 1, 2), -- M2102 - UE1 - S2
|
||||
(7, 7, 2, 2), -- M2201 - UE2 - S2
|
||||
(8, 8, 2, 2), -- M2202 - UE2 - S2
|
||||
|
||||
(9, 9, 3, 3), -- M3301 - UE3 - S3
|
||||
(10, 10, 3, 3), -- M3302 - UE3 - S3
|
||||
(11, 11, 4, 3), -- M3401 - UE4 - S3
|
||||
(12, 12, 4, 3), -- M3402 - UE4 - S3
|
||||
|
||||
(13, 13, 3, 4), -- M4301 - UE3 - S4
|
||||
(14, 14, 3, 4), -- M4302 - UE3 - S4
|
||||
(15, 15, 4, 4), -- M4401 - UE4 - S4
|
||||
(16, 16, 4, 4); -- M4402 - UE4 - S4
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
@ -359,9 +370,9 @@ INSERT INTO `semestre` (`id_semestre`, `nom`, `rang`, `annee`) VALUES
|
|||
(4, 'S4', 4, 2015),
|
||||
|
||||
(5, 'S1', 0, 2016),
|
||||
(7, 'S2', 2, 2016),
|
||||
(8, 'S3', 3, 2016),
|
||||
(9, 'S4', 4, 2016);
|
||||
(6, 'S2', 2, 2016),
|
||||
(7, 'S3', 3, 2016),
|
||||
(8, 'S4', 4, 2016);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue