En cours d'intégration du type de formation

This commit is contained in:
xdrm-brackets 2015-11-16 12:42:36 +01:00
parent 4d4f2aae45
commit c7063cb958
5 changed files with 135 additions and 37 deletions

View File

@ -439,8 +439,6 @@ class DataBase{
/***************************************************/ /***************************************************/
public function getModulesByUEByYear($semestre_pair, $annee){ // ***OPTIONNEL*** semestre_pair public function getModulesByUEByYear($semestre_pair, $annee){ // ***OPTIONNEL*** semestre_pair
debug();
// on récupère les semestres de cette année // on récupère les semestres de cette année
$semestreList = semestreRepo::forYear($annee); $semestreList = semestreRepo::forYear($annee);

View File

@ -130,6 +130,35 @@ require_once __ROOT__.'/manager/database.php';
break; 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;
/***********/ /***********/

View File

@ -57,7 +57,10 @@ 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 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 )); $getSemestreInfo->execute(array( ':semestreUID' => $semestreUID ));
// on retourne le résultat en supprimant les doublons à indices numériques // on retourne le résultat en supprimant les doublons à indices numériques
@ -86,9 +89,10 @@ 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 ". $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 ". "FROM semestre as s, appartenance as app, formation as f ".
"WHERE app.id_semestre = s.id_semestre ". "WHERE s.formation = f.id_formation ".
"AND app.id_semestre = s.id_semestre ".
"AND app.id_etudiant = :etudiant ". "AND app.id_etudiant = :etudiant ".
"AND s.annee = :annee ". "AND s.annee = :annee ".
@ -116,9 +120,10 @@ class semestreRepo extends DBAccess{
* *
*/ */
public static function forYear($annee){ public static function forYear($annee){
$getSemestreList = DataBase::getPDO()->prepare("SELECT id_semestre as id, nom, rang, 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 ". "FROM semestre as s, formation as f ".
"WHERE annee = :annee ". "WHERE s.formation = f.id_formation ".
"AND annee = :annee ".
"ORDER BY rang ASC"); "ORDER BY rang ASC");
$getSemestreList->execute(array( ':annee' => $annee )); $getSemestreList->execute(array( ':annee' => $annee ));

View File

@ -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 if( $ueOpt == null || $UE['nom'] == $ueOpt ){ // on affiche les UEs en fonction de l'affinage
echo "<table class='basic'>"; echo "<table class='basic'>";
echo "<thead class='normal'>"; echo "<thead>";
echo '<tr>'; echo '<tr>';
echo '<th colspan=5><strong>'.$semestre['nom'].'</strong> - '.$UE['nom'].' - '.$UE['libelle'].'</th>'; echo '<th colspan=5>'.$semestre['nom_formation'].' - '.$semestre['nom'].'</th>';
echo '</tr>'; echo '</tr>';
echo '</thead>'; echo '</thead>';
echo '<tbody>'; echo '<tbody>';
@ -249,6 +249,7 @@ if( permission('admin') ){ // si l'utilisateur est un admin
echo '<tr>'; echo '<tr>';
echo '<td>'.$MODULE['nom'].'</td>'; echo '<td>'.$MODULE['nom'].'</td>';
echo '<td>'.$MODULE['libelle'].'</td>'; echo '<td>'.$MODULE['libelle'].'</td>';
echo '<td>'.$UE['nom'].' - '.$UE['libelle'].'</td>';
echo '</tr>'; echo '</tr>';
} }
@ -289,8 +290,8 @@ if( permission('admin') ){ // si l'utilisateur est un admin
modules_switch_level_1($request, $answer); 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 if( $answer->request == 'success' ){ // si on a bien récupéré les membres du groupe
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
echo "<section name='managemcc' data-title='MCC' class='basic'>"; echo "<section name='managemcc' data-title='MCC' class='basic'>";

View File

@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net -- http://www.phpmyadmin.net
-- --
-- Client: localhost -- 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 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
@ -56,15 +56,15 @@ CREATE TABLE IF NOT EXISTS `appartenance` (
-- --
INSERT INTO `appartenance` (`id_appartenance`, `id_etudiant`, `id_groupe`, `id_semestre`) VALUES INSERT INTO `appartenance` (`id_appartenance`, `id_etudiant`, `id_groupe`, `id_semestre`) VALUES
(1, 'mrd1609a', 6, 2), (1, 'mrd1609a', 2, 2),
(2, 'ihf1991a', 16, 4), (2, 'ihf1991a', 8, 4),
(3, 'mma1990a', 13, 1), (3, 'mma1990a', 13, 1),
(4, 'lme1952a', 15, 3), (4, 'lme1952a', 15, 3),
(5, 'imf1922a', 21, 1), (5, 'imf1922a', 21, 1),
(6, 'gyy1983a', 4, 4), (6, 'gyy1983a', 4, 4),
(7, 'otm1902a', 14, 2), (7, 'otm1902a', 14, 2),
(8, 'tnx1949a', 12, 4), (8, 'tnx1949a', 12, 4),
(9, 'sjl1937a', 12, 4), (9, 'sjl1937a', 4, 4),
(10, 'anj1991a', 16, 4), (10, 'anj1991a', 16, 4),
(11, 'xdh1989a', 20, 4), (11, 'xdh1989a', 20, 4),
(12, 'agl1956a', 3, 3), (12, 'agl1956a', 3, 3),
@ -80,8 +80,8 @@ INSERT INTO `appartenance` (`id_appartenance`, `id_etudiant`, `id_groupe`, `id_s
(22, 'dtg1946a', 18, 2), (22, 'dtg1946a', 18, 2),
(23, 'oxz1985a', 7, 3), (23, 'oxz1985a', 7, 3),
(24, 'ono1984a', 14, 2), (24, 'ono1984a', 14, 2),
(25, 'auy1966a', 3, 3), (25, 'auy1966a', 15, 3),
(26, 'dui1946a', 5, 1), (26, 'dui1946a', 1, 1),
(27, 'cyw1979a', 24, 4), (27, 'cyw1979a', 24, 4),
(28, 'pfv1965a', 3, 3), (28, 'pfv1965a', 3, 3),
(29, 'oqz1937a', 24, 4), (29, 'oqz1937a', 24, 4),
@ -106,7 +106,7 @@ INSERT INTO `appartenance` (`id_appartenance`, `id_etudiant`, `id_groupe`, `id_s
(48, 'xtb1903a', 11, 3), (48, 'xtb1903a', 11, 3),
(49, 'msj1985a', 13, 1), (49, 'msj1985a', 13, 1),
(50, 'wvn1982a', 9, 1), (50, 'wvn1982a', 9, 1),
(51, 'psg1965a', 8, 4), (51, 'psg1965a', 4, 4),
(52, 'hpa1908a', 5, 1), (52, 'hpa1908a', 5, 1),
(53, 'maq1980a', 19, 3), (53, 'maq1980a', 19, 3),
(54, 'agq1929a', 13, 1), (54, 'agq1929a', 13, 1),
@ -138,7 +138,7 @@ INSERT INTO `appartenance` (`id_appartenance`, `id_etudiant`, `id_groupe`, `id_s
(80, 'kfx1995a', 18, 2), (80, 'kfx1995a', 18, 2),
(81, 'jgd1966a', 3, 3), (81, 'jgd1966a', 3, 3),
(82, 'rwg1909a', 14, 2), (82, 'rwg1909a', 14, 2),
(83, 'ngw1997a', 1, 1), (83, 'ngw1997a', 17, 1),
(84, 'obg1973a', 2, 2), (84, 'obg1973a', 2, 2),
(85, 'hzg1935a', 12, 4), (85, 'hzg1935a', 12, 4),
(86, 'iyh1918a', 3, 3), (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` ( CREATE TABLE IF NOT EXISTS `controle` (
`id_controle` int(11) NOT NULL AUTO_INCREMENT, `id_controle` int(11) NOT NULL AUTO_INCREMENT,
`id_mcc_module` int(11) NOT NULL, `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, `base` int(11) NOT NULL,
`coefficient` float NOT NULL, `coefficient` float NOT NULL,
`date_publication` date NOT NULL, `date_publication` date NOT NULL,
PRIMARY KEY (`id_controle`), PRIMARY KEY (`id_controle`),
KEY `id_mcc_module` (`id_mcc_module`) 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`: -- 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'), (7, 4, 'Partiel 7', 20, 1, '2015-11-15'),
(8, 4, 'Partiel 8', 20, 1, '2015-11-16'), (8, 4, 'Partiel 8', 20, 1, '2015-11-16'),
(9, 5, 'Partiel 9', 20, 9, '2015-11-17'), (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` -- Structure de la table `groupe`
-- --
@ -406,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=22 ; ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=50 ;
-- --
-- RELATIONS POUR LA TABLE `note`: -- 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 INSERT INTO `note` (`id_note`, `id_appartenance`, `id_controle`, `valeur`) VALUES
(11, 103, 1, 1), (11, 103, 1, 15.25),
(12, 54, 2, 2), (12, 54, 2, 2),
(13, 103, 3, 3), (13, 103, 3, 3),
(14, 103, 4, 4), (14, 103, 4, 4),
@ -431,7 +454,35 @@ INSERT INTO `note` (`id_note`, `id_appartenance`, `id_controle`, `valeur`) VALUE
(18, 103, 8, 8), (18, 103, 8, 8),
(19, 103, 9, 9), (19, 103, 9, 9),
(20, 20, 1, 19), (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` ( 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,
`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`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
--
-- RELATIONS POUR LA TABLE `semestre`:
-- `formation`
-- `formation` -> `id_formation`
--
-- --
-- Contenu de la table `semestre` -- Contenu de la table `semestre`
-- --
INSERT INTO `semestre` (`id_semestre`, `nom`, `rang`, `annee`) VALUES INSERT INTO `semestre` (`id_semestre`, `formation`, `nom`, `rang`, `annee`) VALUES
(1, 'S1', 1, 2015), (1, 1, 'S1', 1, 2015),
(2, 'S2', 2, 2015), (2, 1, 'S2', 2, 2015),
(3, 'S3', 3, 2015), (3, 2, 'S3', 3, 2015),
(4, 'S4', 4, 2015), (4, 2, 'S4', 4, 2015),
(5, 'S1', 1, 2016), (5, 1, 'S1', 1, 2016),
(6, 'S2', 2, 2016), (6, 1, 'S2', 2, 2016),
(7, 'S3', 3, 2016), (7, 2, 'S3', 3, 2016),
(8, 'S4', 4, 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_appartenance` FOREIGN KEY (`id_appartenance`) REFERENCES `appartenance` (`id_appartenance`),
ADD CONSTRAINT `note_id_controle` FOREIGN KEY (`id_controle`) REFERENCES `controle` (`id_controle`); 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_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;