diff --git a/manager/database.php b/manager/database.php index cd8db30..2a9511d 100755 --- a/manager/database.php +++ b/manager/database.php @@ -439,8 +439,6 @@ class DataBase{ /***************************************************/ public function getModulesByUEByYear($semestre_pair, $annee){ // ***OPTIONNEL*** semestre_pair - debug(); - // on récupère les semestres de cette année $semestreList = semestreRepo::forYear($annee); diff --git a/manager/modules.php b/manager/modules.php index e8ae6c2..5d6c2e5 100755 --- a/manager/modules.php +++ b/manager/modules.php @@ -130,6 +130,35 @@ require_once __ROOT__.'/manager/database.php'; break; + /**********************************/ + /* liste des informations des MCC */ + /**********************************/ + case 'getMCC': if( permission('admin') ){ + + $areSetParam = isset($request->annee); // les arguments existent + $typeOkParam = $areSetParam && is_string($request->annee); // si c'est des strings + $nEmptyParam = $typeOkParam && is_numeric($request->annee); // des bon types + $anneeCheck = $nEmptyParam && preg_match('/^[0-9]{4}$/i', $request->annee); // semestre (annee) bon format + + if( $anneeCheck ){ // si tout les paramètres sont bons + $semestreList = DataBase::getInstance()->getModulesByUEByYear(null, $request->annee); + + // STRUCTURE + // tableau d'UES contenant un tableau de MODULES + + if( is_array($semestreList) ){ // si on a bien un tableau + $answer->semestres = $semestreList; // on renvoie dans answer->ues + $answer->request = 'success'; // et on renvoie success + }else // sinon si c'est pas un tableau + $answer->request = $UEList; // on retourne l'erreur + }else + $answer->request = 'param_error'; + + }else + $answer->request = 'permission_error'; + break; + + /***********/ diff --git a/manager/repo/semestre.php b/manager/repo/semestre.php index 0c2c76d..363ac97 100755 --- a/manager/repo/semestre.php +++ b/manager/repo/semestre.php @@ -57,7 +57,10 @@ class semestreRepo extends DBAccess{ */ public static function info($semestreUID){ // on considère que le semestre existe - $getSemestreInfo = DataBase::getPDO()->prepare("SELECT id_semestre as id, nom, rang, annee FROM semestre WHERE id_semestre = :semestreUID"); + $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 ". + "FROM semestre as s, formation as f ". + "WHERE s.formation = f.id_formation ". + "AND id_semestre = :semestreUID"); $getSemestreInfo->execute(array( ':semestreUID' => $semestreUID )); // on retourne le résultat en supprimant les doublons à indices numériques @@ -86,9 +89,10 @@ class semestreRepo extends DBAccess{ // on formate les variables $semestre_pair = ($semestre_pair) ? '0' : '1'; - $getSemestreUID = DataBase::getPDO()->prepare("SELECT s.id_semestre as id ". - "FROM semestre as s, appartenance as app ". - "WHERE app.id_semestre = s.id_semestre ". + $getSemestreUID = DataBase::getPDO()->prepare("SELECT s.id_semestre as id, f.code as formation, f.nom as nom_formation ". + "FROM semestre as s, appartenance as app, formation as f ". + "WHERE s.formation = f.id_formation ". + "AND app.id_semestre = s.id_semestre ". "AND app.id_etudiant = :etudiant ". "AND s.annee = :annee ". @@ -116,9 +120,10 @@ class semestreRepo extends DBAccess{ * */ public static function forYear($annee){ - $getSemestreList = DataBase::getPDO()->prepare("SELECT id_semestre as id, nom, rang, annee ". - "FROM semestre ". - "WHERE annee = :annee ". + $getSemestreList = DataBase::getPDO()->prepare("SELECT s.id_semestre as id, f.code as formation, f.nom as nom_formation, s.nom, s.rang, s.annee ". + "FROM semestre as s, formation as f ". + "WHERE s.formation = f.id_formation ". + "AND annee = :annee ". "ORDER BY rang ASC"); $getSemestreList->execute(array( ':annee' => $annee )); diff --git a/page/modules.php b/page/modules.php index ce1a4ed..7fb7a7d 100755 --- a/page/modules.php +++ b/page/modules.php @@ -239,9 +239,9 @@ if( permission('admin') ){ // si l'utilisateur est un admin if( $ueOpt == null || $UE['nom'] == $ueOpt ){ // on affiche les UEs en fonction de l'affinage echo ""; - echo ""; + echo ""; echo ''; - echo ''; + echo ''; echo ''; echo ''; echo ''; @@ -249,6 +249,7 @@ if( permission('admin') ){ // si l'utilisateur est un admin echo ''; echo ''; echo ''; + echo ''; echo ''; } @@ -289,8 +290,8 @@ if( permission('admin') ){ // si l'utilisateur est un admin modules_switch_level_1($request, $answer); - var_dump( $answer ); - + // var_dump( $answer ) +; if( $answer->request == 'success' ){ // si on a bien récupéré les membres du groupe //////////////////////////////////////////////////////////////////////////////// echo "
"; diff --git a/xdoc/sid.sql b/xdoc/sid.sql index 155cd24..5d36a16 100755 --- a/xdoc/sid.sql +++ b/xdoc/sid.sql @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Client: localhost --- Généré le: Sam 14 Novembre 2015 à 18:33 +-- Généré le: Lun 16 Novembre 2015 à 12:42 -- Version du serveur: 5.5.46-0ubuntu0.14.04.2 -- Version de PHP: 5.5.9-1ubuntu4.14 @@ -56,15 +56,15 @@ CREATE TABLE IF NOT EXISTS `appartenance` ( -- INSERT INTO `appartenance` (`id_appartenance`, `id_etudiant`, `id_groupe`, `id_semestre`) VALUES -(1, 'mrd1609a', 6, 2), -(2, 'ihf1991a', 16, 4), +(1, 'mrd1609a', 2, 2), +(2, 'ihf1991a', 8, 4), (3, 'mma1990a', 13, 1), (4, 'lme1952a', 15, 3), (5, 'imf1922a', 21, 1), (6, 'gyy1983a', 4, 4), (7, 'otm1902a', 14, 2), (8, 'tnx1949a', 12, 4), -(9, 'sjl1937a', 12, 4), +(9, 'sjl1937a', 4, 4), (10, 'anj1991a', 16, 4), (11, 'xdh1989a', 20, 4), (12, 'agl1956a', 3, 3), @@ -80,8 +80,8 @@ INSERT INTO `appartenance` (`id_appartenance`, `id_etudiant`, `id_groupe`, `id_s (22, 'dtg1946a', 18, 2), (23, 'oxz1985a', 7, 3), (24, 'ono1984a', 14, 2), -(25, 'auy1966a', 3, 3), -(26, 'dui1946a', 5, 1), +(25, 'auy1966a', 15, 3), +(26, 'dui1946a', 1, 1), (27, 'cyw1979a', 24, 4), (28, 'pfv1965a', 3, 3), (29, 'oqz1937a', 24, 4), @@ -106,7 +106,7 @@ INSERT INTO `appartenance` (`id_appartenance`, `id_etudiant`, `id_groupe`, `id_s (48, 'xtb1903a', 11, 3), (49, 'msj1985a', 13, 1), (50, 'wvn1982a', 9, 1), -(51, 'psg1965a', 8, 4), +(51, 'psg1965a', 4, 4), (52, 'hpa1908a', 5, 1), (53, 'maq1980a', 19, 3), (54, 'agq1929a', 13, 1), @@ -138,7 +138,7 @@ INSERT INTO `appartenance` (`id_appartenance`, `id_etudiant`, `id_groupe`, `id_s (80, 'kfx1995a', 18, 2), (81, 'jgd1966a', 3, 3), (82, 'rwg1909a', 14, 2), -(83, 'ngw1997a', 1, 1), +(83, 'ngw1997a', 17, 1), (84, 'obg1973a', 2, 2), (85, 'hzg1935a', 12, 4), (86, 'iyh1918a', 3, 3), @@ -167,13 +167,13 @@ INSERT INTO `appartenance` (`id_appartenance`, `id_etudiant`, `id_groupe`, `id_s CREATE TABLE IF NOT EXISTS `controle` ( `id_controle` int(11) NOT NULL AUTO_INCREMENT, `id_mcc_module` int(11) NOT NULL, - `intitule` varchar(50) NOT NULL, + `intitule` varchar(50) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL, `base` int(11) NOT NULL, `coefficient` float NOT NULL, `date_publication` date NOT NULL, PRIMARY KEY (`id_controle`), KEY `id_mcc_module` (`id_mcc_module`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ; +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ; -- -- RELATIONS POUR LA TABLE `controle`: @@ -195,7 +195,8 @@ INSERT INTO `controle` (`id_controle`, `id_mcc_module`, `intitule`, `base`, `coe (7, 4, 'Partiel 7', 20, 1, '2015-11-15'), (8, 4, 'Partiel 8', 20, 1, '2015-11-16'), (9, 5, 'Partiel 9', 20, 9, '2015-11-17'), -(10, 10, 'Partiel 10', 20, 10, '2015-11-18'); +(10, 10, 'Partiel 10', 20, 10, '2015-11-18'), +(11, 9, 'Controle de TP', 20, 20, '2015-11-19'); -- -------------------------------------------------------- @@ -233,6 +234,28 @@ INSERT INTO `enseignement` (`id_enseignement`, `id_enseignant`, `id_mcc_module`, -- -------------------------------------------------------- +-- +-- Structure de la table `formation` +-- + +CREATE TABLE IF NOT EXISTS `formation` ( + `id_formation` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, + `nom` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, + `nb_semestres` int(11) NOT NULL, + PRIMARY KEY (`id_formation`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; + +-- +-- Contenu de la table `formation` +-- + +INSERT INTO `formation` (`id_formation`, `code`, `nom`, `nb_semestres`) VALUES +(1, 'ITINN1', 'DUT 1A INFORMATIQUE', 2), +(2, 'ITINN2', 'DUT 2A INFORMATIQUE', 2); + +-- -------------------------------------------------------- + -- -- Structure de la table `groupe` -- @@ -406,7 +429,7 @@ CREATE TABLE IF NOT EXISTS `note` ( PRIMARY KEY (`id_note`), KEY `id_appartenance` (`id_appartenance`), KEY `id_controle` (`id_controle`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=22 ; +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=50 ; -- -- RELATIONS POUR LA TABLE `note`: @@ -421,7 +444,7 @@ CREATE TABLE IF NOT EXISTS `note` ( -- INSERT INTO `note` (`id_note`, `id_appartenance`, `id_controle`, `valeur`) VALUES -(11, 103, 1, 1), +(11, 103, 1, 15.25), (12, 54, 2, 2), (13, 103, 3, 3), (14, 103, 4, 4), @@ -431,7 +454,35 @@ INSERT INTO `note` (`id_note`, `id_appartenance`, `id_controle`, `valeur`) VALUE (18, 103, 8, 8), (19, 103, 9, 9), (20, 20, 1, 19), -(21, 77, 1, 18); +(21, 77, 1, 19.75), +(22, 83, 1, 2.5), +(23, 91, 1, 3.5), +(24, 19, 1, 4.5), +(25, 58, 1, 5.25), +(26, 49, 2, 3), +(27, 87, 2, 4), +(28, 3, 2, 5), +(29, 74, 1, 14.75), +(30, 26, 1, 1.9), +(31, 97, 1, 10), +(32, 32, 1, 10), +(33, 50, 1, 10), +(34, 73, 1, 20), +(35, 52, 1, 20), +(36, 4, 10, 10), +(37, 56, 10, 1), +(38, 94, 10, 3), +(39, 64, 10, 2), +(40, 100, 10, 4), +(41, 23, 10, 5), +(42, 30, 10, 6), +(43, 103, 2, 1), +(44, 83, 2, 2), +(45, 91, 2, 3), +(46, 13, 1, 2), +(47, 67, 1, 0), +(48, 70, 1, 0.5), +(49, 5, 1, 1.75); -- -------------------------------------------------------- @@ -441,26 +492,34 @@ INSERT INTO `note` (`id_note`, `id_appartenance`, `id_controle`, `valeur`) VALUE CREATE TABLE IF NOT EXISTS `semestre` ( `id_semestre` int(11) NOT NULL AUTO_INCREMENT, + `formation` int(11) NOT NULL, `nom` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `rang` tinyint(4) NOT NULL, `annee` year(4) NOT NULL, PRIMARY KEY (`id_semestre`), - UNIQUE KEY `rang` (`rang`,`annee`) + UNIQUE KEY `rang` (`rang`,`annee`), + KEY `id_formation` (`formation`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; +-- +-- RELATIONS POUR LA TABLE `semestre`: +-- `formation` +-- `formation` -> `id_formation` +-- + -- -- Contenu de la table `semestre` -- -INSERT INTO `semestre` (`id_semestre`, `nom`, `rang`, `annee`) VALUES -(1, 'S1', 1, 2015), -(2, 'S2', 2, 2015), -(3, 'S3', 3, 2015), -(4, 'S4', 4, 2015), -(5, 'S1', 1, 2016), -(6, 'S2', 2, 2016), -(7, 'S3', 3, 2016), -(8, 'S4', 4, 2016); +INSERT INTO `semestre` (`id_semestre`, `formation`, `nom`, `rang`, `annee`) VALUES +(1, 1, 'S1', 1, 2015), +(2, 1, 'S2', 2, 2015), +(3, 2, 'S3', 3, 2015), +(4, 2, 'S4', 4, 2015), +(5, 1, 'S1', 1, 2016), +(6, 1, 'S2', 2, 2016), +(7, 2, 'S3', 3, 2016), +(8, 2, 'S4', 4, 2016); -- -------------------------------------------------------- @@ -658,6 +717,12 @@ ALTER TABLE `note` ADD CONSTRAINT `note_id_appartenance` FOREIGN KEY (`id_appartenance`) REFERENCES `appartenance` (`id_appartenance`), ADD CONSTRAINT `note_id_controle` FOREIGN KEY (`id_controle`) REFERENCES `controle` (`id_controle`); +-- +-- Contraintes pour la table `semestre` +-- +ALTER TABLE `semestre` + ADD CONSTRAINT `semestre_id_formation` FOREIGN KEY (`formation`) REFERENCES `formation` (`id_formation`); + /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; \ No newline at end of file
'.$semestre['nom'].' - '.$UE['nom'].' - '.$UE['libelle'].''.$semestre['nom_formation'].' - '.$semestre['nom'].'
'.$MODULE['nom'].''.$MODULE['libelle'].''.$UE['nom'].' - '.$UE['libelle'].'