Remplacement D&D par <select> étape 1 : CSS créé, html/php créé, reste le JS à faire

This commit is contained in:
xdrm-brackets 2015-11-13 17:24:58 +01:00
parent 79d9f63602
commit 5375d79a52
14 changed files with 247 additions and 53 deletions

2
API.js
View File

@ -52,7 +52,7 @@ APIClass.prototype = {
/* DEBUG : affiche la réponse BRUTE de API.php */
// console.log('API.php => '+ptrAPI.xhr[i].responseText);
console.log(JSON.parse(ptrAPI.xhr[i].responseText) );
console.log( JSON.parse(ptrAPI.xhr[i].responseText) );
/* si success de requête */
if( [0,200].indexOf(ptrAPI.xhr[i].status) > -1 ){ // si fichier existe et reçu

View File

@ -77,6 +77,7 @@ table.basic.col2 tr td, table.basic.col2 tr th{ width: 50%; }
table.basic.col3 tr td, table.basic.col3 tr th{ width: 33%; }
table.basic.col4 tr td, table.basic.col4 tr th{ width: 25%; }
table.basic.col5 tr td, table.basic.col5 tr th{ width: 20%; }
table.basic.col5 tr td, table.basic.col6 tr th{ width: 16%; }
/* titre aligné à gauche */
@ -92,6 +93,7 @@ table.basic:nth-child(4n+3) tr td:first-child{ border-left: 10px solid #2dcc70;
/* @hover */
table.basic tr:hover td{ color: #fff; }
@ -169,9 +171,10 @@ select{
-webkit-appearance:none;
-moz-appearance:none;
appearance:none;
}
td select{ margin: 0; }
select > option{
/* position */
padding: 1em 0;
@ -187,4 +190,27 @@ select > option{
select > option:nth-child(4n+0){ color: #e63c54; }
select > option:nth-child(4n+1){ color: #3c73e6; }
select > option:nth-child(4n+2){ color: #e6983c; }
select > option:nth-child(4n+3){ color: #2dcc70; }*/
select > option:nth-child(4n+3){ color: #2dcc70; }*/
.valider_deplacement{
/* position */
/*display: inline-block;*/ display: none;
position: absolute;
margin-left: 2em;
margin-top: .5em;
width: 2em;
height: 2em;
/* background */
background: transparent center center no-repeat;
background-size: 90% auto;
/* extra */
cursor: pointer;
}
.valider_deplacement.active{ display: inline-block; background-image: url(../src/validate.svg); }
tr:hover td .valider_deplacement.active{ background-image: url(../src/validate@hover.svg); }

View File

@ -223,7 +223,6 @@ class DataBase{
$groupeOpt = '%';
if( $pGroupe != null ) $groupeOpt = $pGroupe; // si le groupe est donné, on le définit
/*** on cherche un semestre avec ce rang et cette année (qui est unique) ***/
$checkAnnee = DataBase::getPDO()->prepare("SELECT id_semestre as id FROM semestre WHERE annee = :annee");
$checkAnnee->execute(array( ':annee' => $annee ));
@ -289,10 +288,7 @@ class DataBase{
"AND app.id_semestre = :semestreUID ".
"ORDER BY g.nom");
$getNomGroupe->execute(array(
':etudiantUID' => $etudiantUID,
':semestreUID' => $semestreUID
));
$getNomGroupe->execute(array( ':etudiantUID' => $etudiantUID, ':semestreUID' => $semestreUID ));
// si on a un résultat
if( $nomGroupe = $getNomGroupe->fetch()['nom'] )

View File

@ -221,7 +221,8 @@ require_once __ROOT__.'/manager/database.php';
if( $anneeCheck ){
$grouplist = DataBase::getInstance()->listeEtudiantsTousGroupesAnnee($request->annee, $_SESSION['semestre_pair'], $semestre, $groupe);
// $grouplist = DataBase::getInstance()->listeEtudiantsTousGroupesAnnee($request->annee, $_SESSION['semestre_pair'], $semestre, $groupe);
$grouplist = DataBase::getInstance()->listeEtudiantsTousGroupesAnnee($request->annee, null, $semestre, $groupe);
if( is_array($grouplist) ){ // si on a récupéré la liste des utilisateurs
$answer->grouplist = $grouplist;

View File

@ -202,6 +202,34 @@ class groupRepo extends DBAccess{
/* RETOURNE LE GROUPE AUQUEL EST INSCRIT UN ETUDIANT POUR UN SEMESTRE DONNÉ
*
* @etudiant<String> l'UID de l'étudiant en question
* @semestre<int> l'UID du semestre en question
*
* @return trouve<Boolean> FAUX si aucun groupe ne correspond aux critères
* @return groupe<int> retourne l'UID du groupe correspondant
*
*/
public static function forStudent($etudiant, $semestre){
$getGroupe = DataBase::getPDO()->prepare("SELECT g.id_groupe as id, g.nom, g.libelle ".
"FROM utilisateur as u, groupe as g, appartenance as app ".
"WHERE app.id_etudiant = u.identifiant ".
"AND app.id_groupe = g.id_groupe ".
"AND u.identifiant = :etudiantUID ".
"AND app.id_semestre = :semestreUID ".
"ORDER BY g.nom");
$getGroupe->execute(array( ':etudiantUID' => $etudiantUID, ':semestreUID' => $semestreUID ));
return DataBase::delNumeric( $getGroupe->fetch() );
}
/* RETOURNE TOUS LES GROUPES QUI ONT UN ENSEIGNANT PARTICULIER POUR UNE ANNEE DONNEE
*
* @enseignant<String> l'UID de l'enseignant recherché
@ -234,6 +262,7 @@ class groupRepo extends DBAccess{
"AND mcc_m.id_mcc_module = ens.id_mcc_module ".
"AND ens.id_enseignant = u.identifiant ".
"AND ens.correcteur = 1 ". // uniquement les groupes pour lesquels il est correcteur
"AND app.id_etudiant = eleve.identifiant ".
"AND app.id_semestre = s.id_semestre ".
@ -272,7 +301,10 @@ class groupRepo extends DBAccess{
// si le groupe est donné, on cherche uniquement celui-ci, sinon on les affiche tous
$groupeOpt = '%';
if( $pGroupe != null ){ $groupeOpt = $pGroupe; }
$semestrePair0 = '0'; $semestrePair1 = '1';
if( is_bool($semestre_pair) ){ $semestrePair0 = $semestre_pair; $semestrePair1 = $semestre_pair; }
$getGroupeList = DataBase::getPDO()->prepare("SELECT DISTINCT g.id_groupe as id, g.nom, s.rang, s.id_semestre, s.nom as semestre ".
"FROM groupe as g, semestre as s, appartenance as app ".
"WHERE g.id_groupe = app.id_groupe ".
@ -280,10 +312,10 @@ class groupRepo extends DBAccess{
"AND g.nom LIKE '".$groupeOpt."' ".
"AND s.nom LIKE '".$semestreOpt."' ".
"AND s.rang % 2 = :semestre_pair ".
"AND (s.rang % 2 = :semestre_pair0 OR s.rang % 2 = :semestre_pair1) ".
"AND s.annee = :annee ".
"ORDER BY g.nom");
$getGroupeList->execute(array( ':semestre_pair' => ($semestre_pair) ? '0' : '1', ':annee' => $annee ));
$getGroupeList->execute(array( ':semestre_pair0' => $semestrePair0, ':semestre_pair1' => $semestrePair1, ':annee' => $annee ));
return DataBase::delNumeric( $getGroupeList->fetchAll() );
}

View File

@ -87,6 +87,7 @@ class ueRepo extends DBAccess{
$getUesForTeacher = DataBase::getPDO()->prepare("SELECT DISTINCT ue.id_ue as id, s.annee, s.rang, ue.nom, ue.libelle ".
"FROM enseignement as ens, semestre as s, ue, mcc_ue, mcc_module as mcc_m ".
"WHERE ens.id_mcc_module = mcc_m.id_mcc_module ".
"AND ens.correcteur = 1 ". // si l'enseignant est correcteur uniquement
"AND mcc_m.id_mcc_ue = mcc_ue.id_mcc_ue ".
"AND mcc_ue.id_semestre = s.id_semestre ".
"AND mcc_ue.id_ue = ue.id_ue ".

View File

@ -45,25 +45,31 @@ if( permission('student') ){ // si l'utilisateur est connecté et que c'est un
foreach($answer->UEs as $UE){ // pour chaque UE
echo "<table class='basic col4'>";
echo "<thead class='active'>";
echo "<thead>";
echo '<tr>';
echo '<th colspan=5>'.$UE['nom'].' - '.$UE['libelle'].'</th>';
echo "<th colspan=5 style='font-size:1.5em; text-align:center;'>".$UE['nom'].' - '.$UE['libelle'].'</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
foreach($UE['modules'] as $module) // pour chaque module
foreach($module['controles'] as $controle) // pour chaque contrôle
foreach($controle['notes'] as $note){ // pour chaque note
echo '<tr>';
echo '<td><span class=link>'.$controle['intitule'].'</span></td>';
echo '<td>'.number_format($note['valeur'], 2).' <span class=unstressed>/</span> '.$controle['base'].'</td>';
echo "<td>".$module['nom']." - ".$module['libelle']."</td>";
echo '<td>Coefficient '.number_format($controle['coefficient'], 2).'</td>';
echo '</tr>';
}
echo '</thead></table>';
foreach($UE['modules'] as $module){ // pour chaque module
echo '<table class=basic><thead>';
echo '<tr><th colspan=5>'.$module['nom'].' - '.$module['libelle'].'</th></tr></thead><tbody>';
echo '</tbody>';
foreach($module['controles'] as $controle){ // pour chaque contrôle
echo '<tr>';
echo '<td><span class=link>'.$controle['intitule'].'</span></td>';
if( count($controle['notes']) == 0 ) // si aucune note pour ce controle on affiche 'Pas de note'
echo '<td><span class=unstressed>Pas de note</span></td>';
else // si une note, alors on l'affiche
echo '<td>'.number_format($controle['notes'][0]['valeur'], 2).' <span class=unstressed>/</span> '.$controle['base'].'</td>';
echo "<td>".$module['nom']." - ".$module['libelle']."</td>";
echo '<td>Coefficient '.number_format($controle['coefficient'], 2).'</td>';
echo '</tr>';
}
echo '</tbody>';
}
echo '</table>';
}

View File

@ -43,7 +43,6 @@ require_once __ROOT__.'/manager/groups.php';
/************************/
/*
* UTILISATEUR -> affichage du même semestre
*
*
*/
if( permission('student') ){ // si connecté && utilisateur
@ -115,7 +114,7 @@ if( permission('student') ){ // si connecté && utilisateur
*
*
*/
if( permission('teacher') ){ // si connecté && prof
if( false && permission('teacher') ){ // si connecté && prof
$request = new stdClass();
$answer = new stdClass();
@ -318,7 +317,7 @@ if( permission('teacher') ){ // si l'utilisateur est connecté et que c'est un
groups_switch_level_1($request, $answer);
if( $answer->request == 'success' ){ // si on a bien récupéré les membres du groupe
if( $answer->request == 'success' && count($answer->grouplist) > 0 ){ // si on a bien récupéré les membres du groupe
////////////////////////////////////////////////////////////////////////////////
echo "<section name='teachersgroups' title='Mes groupes' class='basic'>";
@ -475,7 +474,7 @@ if( permission('admin') ){ // si l'utilisateur est connecté et que c'est un adm
if( count($group['userlist']) > 0 ){ // s'il y a des utilisateurs
echo "<table class='basic col4'>";
echo "<table class='basic col5'>";
echo '<thead>';
echo '<tr>';
@ -498,6 +497,18 @@ if( permission('admin') ){ // si l'utilisateur est connecté et que c'est un adm
echo '<td>'.$user['prenom'].'</td>';
echo '<td>'.$user['nom'].'</td>';
echo '<td><strong><span>'.$group['nom'].'</span></strong></td>';
// changement de groupe
echo '<td>';
echo "<select class='deplacement_groupe'>";
foreach($answer->grouplist as $groupemodif) // pour tous les groupes
if( $groupemodif['semestre'] == $group['semestre'] ) // si c'est un groupe du même semestre
if( $groupemodif['nom'] == $group['nom'] ) // s'il s'agit du groupe courant, on met en sélection
echo "<option value='".$groupemodif['nom']."' selected>".$groupemodif['nom']."</option>";
else // s'il s'agit d'un autre groupe, c'est normal
echo "<option value='".$groupemodif['nom']."'>".$groupemodif['nom']."</option>";
echo '</select>';
echo "<div class='valider_deplacement'></div>";
echo '</td>';
echo '</tr>';
}

6
rdv1.client Normal file → Executable file
View File

@ -4,13 +4,13 @@ Utilisateur
[*] PARCOURS
UE
MODULE
CONTROLE (même si pas de note)
NOTES
[fait] CONTROLE (même si pas de note)
NOTES
Enseignant
[*] GROUPES
ceux à qui j'ai des notes à donner
[fait] ceux à qui j'ai des notes à donner
[*] NOTES
afficher celles pour les modules ou il est correcteur

View File

@ -1 +0,0 @@
<?xml version="1.0" ?><svg height="48" viewBox="0 0 48 48" width="48" xmlns="http://www.w3.org/2000/svg"><path d="M33.17 17.17l-9.17 9.17-9.17-9.17-2.83 2.83 12 12 12-12z"/><path d="M0 0h48v48h-48z" fill="none"/></svg>

Before

Width:  |  Height:  |  Size: 218 B

View File

@ -3,6 +3,10 @@
"password" : "password"
},
"agq1929a": {
"password" : "password"
},
"mrd1609a": {
"password" : "password"
},

59
src/validate.svg Executable file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
enable-background="new 45.6 168.9 504 504"
id="Layer_1"
version="1.1"
viewBox="45.6 168.9 468.79999 468.79999"
xml:space="preserve"
inkscape:version="0.48.4 r9939"
width="100%"
height="100%"
sodipodi:docname="validate.svg"><metadata
id="metadata11"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs9" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1056"
id="namedview7"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="1.3244222"
inkscape:cx="410.94807"
inkscape:cy="117.90095"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><circle
cx="297.60001"
cy="420.89999"
r="234.39999"
id="circle3"
sodipodi:cx="297.60001"
sodipodi:cy="420.89999"
sodipodi:rx="234.39999"
sodipodi:ry="234.39999"
style="fill:none"
transform="translate(-17.600012,-17.6)" /><polygon
points="170.4,436.6 264.1,530.3 447.2,347.3 416,316 264.1,467.8 201.6,405.3 "
id="polygon5"
style="fill:#666666"
transform="translate(-17.600012,-17.6)" /></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

59
src/validate@hover.svg Executable file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
enable-background="new 45.6 168.9 504 504"
id="Layer_1"
version="1.1"
viewBox="45.6 168.9 468.79999 468.79999"
xml:space="preserve"
inkscape:version="0.48.4 r9939"
width="100%"
height="100%"
sodipodi:docname="validate@hover.svg"><metadata
id="metadata11"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
id="defs9" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1056"
id="namedview7"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="1.3244222"
inkscape:cx="410.94807"
inkscape:cy="117.90095"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><circle
cx="297.60001"
cy="420.89999"
r="234.39999"
id="circle3"
sodipodi:cx="297.60001"
sodipodi:cy="420.89999"
sodipodi:rx="234.39999"
sodipodi:ry="234.39999"
style="fill:none"
transform="translate(-17.600012,-17.6)" /><polygon
points="170.4,436.6 264.1,530.3 447.2,347.3 416,316 264.1,467.8 201.6,405.3 "
id="polygon5"
style="fill:#ffffff"
transform="translate(-17.600012,-17.6)" /></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -47,32 +47,32 @@ require_once __ROOT__.'/manager/security.php';
require_once __ROOT__.'/manager/database.php';
debug();
// $_SESSION['semestre_pair'] = !$_SESSION['semestre_pair'];
// var_dump( $_SESSION['semestre_pair'] );
$_SESSION['semestre_pair'] = !$_SESSION['semestre_pair'];
var_dump( $_SESSION['semestre_pair'] );
// on affiche les modules d'un étudiant
var_dump( DataBase::getInstance()->getModulesByUEByEtudiant(
$_SESSION['identifiant'],
$_SESSION['semestre'],
$_SESSION['annee']
) );
// var_dump( DataBase::getInstance()->getModulesByUEByEtudiant(
// $_SESSION['identifiant'],
// $_SESSION['semestre'],
// $_SESSION['annee']
// ) );
// on affiche les controle d'un étudiant pour un module, semestre particulier
$UEList = ueRepo::forStudent($_SESSION['identifiant'], $_SESSION['semestre']);
// // on affiche les controle d'un étudiant pour un module, semestre particulier
// $UEList = ueRepo::forStudent($_SESSION['identifiant'], $_SESSION['semestre']);
foreach($UEList as $iter_ue=>$a){
$UEList[$iter_ue]['modules'] = moduleRepo::forStudent($UEList[$iter_ue]['id'], $UEList[$iter_ue]['id_semestre']);
// foreach($UEList as $iter_ue=>$a){
// $UEList[$iter_ue]['modules'] = moduleRepo::forStudent($UEList[$iter_ue]['id'], $UEList[$iter_ue]['id_semestre']);
foreach($UEList[$iter_ue]['modules'] as $iter_mod=>$b){
$UEList[$iter_ue]['modules'][$iter_mod]['controles'] = controleRepo::forStudent($UEList[$iter_ue]['modules'][$iter_mod]['id'], $UEList[$iter_ue]['id_semestre']);
// foreach($UEList[$iter_ue]['modules'] as $iter_mod=>$b){
// $UEList[$iter_ue]['modules'][$iter_mod]['controles'] = controleRepo::forStudent($UEList[$iter_ue]['modules'][$iter_mod]['id'], $UEList[$iter_ue]['id_semestre']);
foreach($UEList[$iter_ue]['modules'][$iter_mod]['controles'] as $iter_ct=>$c)
$UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['notes'] = noteRepo::forStudent($_SESSION['identifiant'], $UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['id']);
}
// foreach($UEList[$iter_ue]['modules'][$iter_mod]['controles'] as $iter_ct=>$c)
// $UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['notes'] = noteRepo::forStudent($_SESSION['identifiant'], $UEList[$iter_ue]['modules'][$iter_mod]['controles'][$iter_ct]['id']);
// }
}
var_dump( $UEList[0]['modules'][0]['controles'][0] );
// }
// var_dump( $UEList[0]['modules'][0]['controles'][0] );