Affichage des groupes modifié (à refaire en suivant le template@2)
This commit is contained in:
parent
41fe605d84
commit
984d60f467
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 */
|
||||
|
|
6
API.php
6
API.php
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php define('__ROOT__', dirname(__FILE__));
|
||||
|
||||
/* GESTION DE L'AUTHENTIFICATION - SI L'UTILISATEUR EST CONNECTÉ */
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
/* UTILISATEUR */
|
||||
/***************/
|
||||
case 'user':
|
||||
if( isset($request->level_1) ){ include 'manager/user.php'; user_switch_level_1($request, $answer); }
|
||||
if( isset($request->level_1) ){ require_once __ROOT__.'/manager/user.php'; user_switch_level_1($request, $answer); }
|
||||
else { $answer->request = 'missing_level_1'; }
|
||||
break;
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
|||
/* GROUPES */
|
||||
/***********/
|
||||
case 'groups':
|
||||
if( isset($request->level_1) ){ include 'manager/groups.php'; groups_switch_level_1($request, $answer); }
|
||||
if( isset($request->level_1) ){ require_once __ROOT__.'/manager/groups.php'; groups_switch_level_1($request, $answer); }
|
||||
else { $answer->request = 'missing_level_1'; }
|
||||
break;
|
||||
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
width: 100%;
|
||||
min-height: 100%;
|
||||
height: auto;
|
||||
padding: 2em;
|
||||
|
||||
/* flex (as container) */
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
|
||||
/* background */
|
||||
background-color: #ecf0f1;
|
||||
|
@ -17,64 +21,7 @@
|
|||
}
|
||||
|
||||
|
||||
#CONTAINER section.active{ display: block; }
|
||||
#CONTAINER section.active{ display: flex; }
|
||||
|
||||
|
||||
|
||||
/* STYLE "BASIC" DES TABLEAUX */
|
||||
table.basic{
|
||||
/* position */
|
||||
float: left;
|
||||
margin: 1em;
|
||||
|
||||
|
||||
|
||||
/* border */
|
||||
border-radius: 5px;
|
||||
border-spacing: 0;
|
||||
box-shadow: 0 0 4px #e3e3e3;
|
||||
}
|
||||
|
||||
|
||||
table.basic tr td,
|
||||
table.basic tr th{
|
||||
/* position */
|
||||
padding: 1em 1.5em;
|
||||
|
||||
/* border */
|
||||
border-width: 1px 1px 0 0;
|
||||
border-style: solid;
|
||||
border-color: #e0e1e3;
|
||||
|
||||
/* backgroud */
|
||||
background-color: #fff;
|
||||
|
||||
/* foreground */
|
||||
color: #4e4e4e;
|
||||
}
|
||||
|
||||
table.basic tr th{ background-color: #f7f8fc; }
|
||||
table.basic tr th:first-letter{ text-transform: uppercase; }
|
||||
|
||||
|
||||
/* on ajoute les rebords pour ceux à gauche */
|
||||
table.basic tr td:first-child,
|
||||
table.basic tr th:first-child{ border-left-width: 1px; }
|
||||
/* on ajoute les rebords pour ceux en bas */
|
||||
table.basic tr:last-child td { border-bottom-width: 1px; }
|
||||
|
||||
|
||||
/* angle haut gauche */
|
||||
table.basic tr:first-child th:first-child{ border-radius: 5px 0 0 0; }
|
||||
/* angle haut droit */
|
||||
table.basic tr:first-child th:last-child { border-radius: 0 5px 0 0; }
|
||||
/* angle bas gauche */
|
||||
table.basic tr:last-child td:first-child { border-radius: 0 0 0 5px; }
|
||||
/* angle bas droit */
|
||||
table.basic tr:last-child td:last-child { border-radius: 0 0 5px 0; }
|
||||
|
||||
/* @hover */
|
||||
table.basic tr:hover td{
|
||||
background-color: #f7f8fc;
|
||||
color: #333;
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
/* STYLE "BASIC" DES TABLEAUX */
|
||||
table.basic{
|
||||
/* position */
|
||||
margin: 2em 1em;
|
||||
|
||||
/* border */
|
||||
border-radius: 5px;
|
||||
border-spacing: 0;
|
||||
box-shadow: 0 0 4px #e3e3e3;
|
||||
}
|
||||
|
||||
/* affichage du corps si tête activée */
|
||||
table.basic thead + tbody{
|
||||
display: block;
|
||||
max-height: 3em;
|
||||
overflow: hidden;
|
||||
|
||||
transition: max-height .5s 0s ease-in-out;
|
||||
-moz-transition: max-height .5s 0s ease-in-out;
|
||||
-webkit-transition: max-height .5s 0s ease-in-out;
|
||||
-ms-transition: max-height .5s 0s ease-in-out;
|
||||
-o-transition: max-height .5s 0s ease-in-out;
|
||||
}
|
||||
table.basic thead.active + tbody{
|
||||
max-height: calc( 3*40em );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
table.basic tr td,
|
||||
table.basic tr th{
|
||||
/* position */
|
||||
padding: 1em 1.5em;
|
||||
|
||||
/* border */
|
||||
border-width: 1px 1px 0 0;
|
||||
border-style: solid;
|
||||
border-color: #e0e1e3;
|
||||
|
||||
/* backgroud */
|
||||
background-color: #fff;
|
||||
|
||||
/* foreground */
|
||||
color: #4e4e4e;
|
||||
|
||||
/* animation */
|
||||
transition: all .2s ease-in-out;
|
||||
-moz-transition: all .2s ease-in-out;
|
||||
-webkit-transition: all .2s ease-in-out;
|
||||
-ms-transition: all .2s ease-in-out;
|
||||
-o-transition: all .2s ease-in-out;
|
||||
|
||||
/* extra */
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* la ligne "Voir plus" */
|
||||
table.basic tr td.more{
|
||||
/* background */
|
||||
background: #f7f8fc url(../src/more.svg) right 1em center no-repeat;
|
||||
background-size: auto 1.5em;
|
||||
|
||||
/* foreground */
|
||||
color: #b7b7b7;
|
||||
text-align: right;
|
||||
padding-right: 3em;
|
||||
|
||||
/* extra */
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* on cache "voir plus" quand le tableau est déroulé */
|
||||
table.basic thead.active + td.more{ display: none; }
|
||||
|
||||
|
||||
/* différence avec <thead> */
|
||||
table.basic tr th{ background-color: #f7f8fc; }
|
||||
table.basic tr th:first-letter{ text-transform: uppercase; }
|
||||
|
||||
|
||||
/* on ajoute les rebords pour ceux à gauche */
|
||||
table.basic tr td:first-child,
|
||||
table.basic tr th:first-child{ border-left-width: 1px; }
|
||||
/* on ajoute les rebords pour ceux en bas */
|
||||
table.basic tr:last-child td { border-bottom-width: 1px; }
|
||||
|
||||
|
||||
/* angle haut gauche */
|
||||
table.basic tr:first-child th:first-child{ border-radius: 5px 0 0 0; }
|
||||
/* angle haut droit */
|
||||
table.basic tr:first-child th:last-child { border-radius: 0 5px 0 0; }
|
||||
/* angle bas gauche */
|
||||
table.basic tr:last-child td:first-child { border-radius: 0 0 0 5px; }
|
||||
/* angle bas droit */
|
||||
table.basic tr:last-child td:last-child { border-radius: 0 0 5px 0; }
|
||||
|
||||
/* @hover */
|
||||
table.basic tr:hover td{
|
||||
background-color: #f7f8fc;
|
||||
color: #333;
|
||||
}
|
|
@ -195,7 +195,7 @@ class DataBase{
|
|||
$groupe = new stdClass();
|
||||
$groupe->nom = $groupeUID['nom']; // attribut "nom" ajouté au groupe
|
||||
|
||||
$groupe->userlist = $this->listeUtilisateurGroupe($groupe->nom); // on charge la liste des utilisateurs de ce groupe
|
||||
$groupe->userlist = $this->listeEtudiantsGroupe($groupe->nom); // on charge la liste des utilisateurs de ce groupe
|
||||
|
||||
array_push($grouplist, $groupe); // on l'ajoute au résultat
|
||||
}
|
||||
|
@ -229,14 +229,10 @@ class DataBase{
|
|||
// [3] ensuite tu peux écrire manager/database.php en vérifiant tout les cas (ceux que j'ai cité ou oublié)
|
||||
//
|
||||
// Inspire toi de ce qui a déjà été fait au dessus et essaie de
|
||||
if(isset($nouveauGroupe) && is_string($nouveauGroupe) && $nouveauGroupe == 'A' || 'B' || 'C' || 'D' || 'E' || 'F') {
|
||||
|
||||
if(isset($nouveauGroupe) && is_string($nouveauGroupe) && $nouveauGroupe == 'A' || 'B' || 'C' || 'D' || 'E' || 'F')
|
||||
return 'L\'étudiant a été déplacé';
|
||||
}
|
||||
else {
|
||||
|
||||
else
|
||||
return 'L\'étudiant n\'a pas pu être déplacé';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php require_once __ROOT__.'/manager/security.php';
|
||||
<?php
|
||||
require_once __ROOT__.'/manager/security.php';
|
||||
require_once __ROOT__.'/manager/database.php';
|
||||
|
||||
|
||||
/***********************************************************
|
||||
* *
|
||||
* MANAGER DES UTILISATEURS *
|
||||
|
@ -43,7 +44,6 @@
|
|||
$nomCheck = $nEmptyParam && preg_match('/^[a-z -]{1,50}$/i', $request->nom); // nom bon format
|
||||
|
||||
if( $nomCheck ){ // si tout les paramètres sont bons
|
||||
require_once __ROOT__.'/manager/database.php';
|
||||
$answer->request = DataBase::getInstance()->creerGroupe($request->nom);
|
||||
}else
|
||||
$answer->request = 'param_error';
|
||||
|
@ -60,7 +60,6 @@
|
|||
$groupeCheck = $utilisateurCheck && preg_match('/^[a-z -]{1,50}$/i', $request->groupe); // groupe (nom) bon format
|
||||
|
||||
if( $groupeCheck ){ // si tout les paramètres sont bons
|
||||
require_once __ROOT__.'/manager/database.php';
|
||||
$answer->request = DataBase::getInstance()->ajouterEtudiantGroupe($request->utilisateur, $request->groupe);
|
||||
}else
|
||||
$answer->request = 'param_error';
|
||||
|
@ -76,7 +75,6 @@
|
|||
$groupeCheck = $nEmptyParam && preg_match('/^[a-z -]{1,50}$/i', $request->groupe); // groupe (nom) bon format
|
||||
|
||||
if( $groupeCheck ){ // si tout les paramètres sont bons
|
||||
require_once __ROOT__.'/manager/database.php';
|
||||
$userlist = DataBase::getInstance()->listeEtudiantsGroupe($request->groupe);
|
||||
|
||||
if( is_array($userlist) ){ // si on a récupéré la liste des utilisateurs
|
||||
|
@ -94,8 +92,6 @@
|
|||
/* retourne les utilisateurs de tous les groupe */
|
||||
/************************************************/
|
||||
case 'grouplist':
|
||||
require_once __ROOT__.'/manager/database.php';
|
||||
|
||||
$grouplist = DataBase::getInstance()->listeEtudiantsTousGroupes();
|
||||
|
||||
if( is_array($grouplist) ){ // si on a récupéré la liste des utilisateurs
|
||||
|
|
|
@ -80,5 +80,4 @@
|
|||
|
||||
|
||||
|
||||
|
||||
?>
|
|
@ -1,4 +1,6 @@
|
|||
<?php require_once __ROOT__.'/manager/security.php';
|
||||
<?php
|
||||
require_once __ROOT__.'/manager/security.php';
|
||||
require_once __ROOT__.'/manager/database.php';
|
||||
|
||||
/***********************************************************
|
||||
* *
|
||||
|
@ -83,7 +85,6 @@
|
|||
$droitsCheck = $passwordCheck && is_int(array_search($request->droits, ['student', 'teacher', 'master', 'admin'])); // droits bon format
|
||||
|
||||
if( $droitsCheck ){ // si tout les paramètres sont bons
|
||||
require_once __ROOT__.'/manager/database.php';
|
||||
$answer->request = DataBase::getInstance()->creerUtilisateur($request->username, $request->prenom, $request->nom, $request->email, $request->password, $request->droits);
|
||||
}else
|
||||
$answer->request = 'param_error';
|
||||
|
|
|
@ -41,4 +41,18 @@ var request = {
|
|||
// @ on envoie l'objet
|
||||
// @ quand réception: affichage de l'objet reçu
|
||||
//
|
||||
API.send(request, function(){} );
|
||||
API.send(request, function(r){} );
|
||||
|
||||
|
||||
/* Gestion du déroulement des tableaux */
|
||||
var allgroups = document.querySelector('#CONTAINER section[name=allgroups]');
|
||||
|
||||
allgroups.addEventListener('click', function(e){
|
||||
|
||||
// s'il s'agit de la case "Voir plus"
|
||||
if( e.target.className == 'more' ){
|
||||
var thead = e.target.parentNode.parentNode.parentNode.children[0];
|
||||
thead.className = (thead.className=='active') ? '' : 'active';
|
||||
}
|
||||
|
||||
}, false);
|
|
@ -1,6 +1,5 @@
|
|||
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
|
||||
require_once __ROOT__.'/manager/security.php'; session_init();
|
||||
// debug();
|
||||
require_once __ROOT__.'/manager/groups.php';
|
||||
|
||||
/****************************************
|
||||
* *
|
||||
|
@ -19,11 +18,9 @@ require_once __ROOT__.'/manager/security.php'; session_init();
|
|||
|
||||
|
||||
|
||||
<section name='allgroup' title='tous les groupes'>
|
||||
<section name='allgroups' title='tous les groupes'>
|
||||
<?php if( $_SESSION['username'] != null ){ // si connecté
|
||||
|
||||
|
||||
include __ROOT__.'/manager/groups.php';
|
||||
|
||||
$request = new stdClass();
|
||||
$answer = new stdClass();
|
||||
|
@ -32,36 +29,46 @@ require_once __ROOT__.'/manager/security.php'; session_init();
|
|||
|
||||
groups_switch_level_1($request, $answer);
|
||||
|
||||
foreach($answer->grouplist as $group){ // pour chaque groupe
|
||||
if( $answer->request == 'success' ){ // si pas d'erreur
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
if( count($group->userlist) > 0 ){ // s'il y a des utilisateurs
|
||||
foreach($answer->grouplist as $group){ // pour chaque groupe
|
||||
|
||||
echo "<table class='basic'>";
|
||||
if( count($group->userlist) > 0 ){ // s'il y a des utilisateurs
|
||||
|
||||
echo '<thead>';
|
||||
echo '<tr>';
|
||||
echo '<th colspan=5>Groupe '.$group->nom.'</th>';
|
||||
echo '</tr>';
|
||||
echo '</thead>';
|
||||
echo "<table class='basic'>";
|
||||
|
||||
|
||||
|
||||
echo '<tbody>';
|
||||
// pour chaque utilisateur
|
||||
foreach($group->userlist as $user){
|
||||
echo '<thead>';
|
||||
echo '<tr>';
|
||||
foreach($user as $key=>$value)
|
||||
if( $key == 'prenom' || $key == 'nom' )
|
||||
echo '<td>'.$value.'</td>';
|
||||
echo '<th colspan=5>Groupe '.$group->nom.'</th>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</thead>';
|
||||
|
||||
echo '</tbody>';
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '<tbody>';
|
||||
echo '<tr><td colspan=5 class=more>Voir plus</td></tr>';
|
||||
|
||||
// pour chaque utilisateur
|
||||
foreach($group->userlist as $user){
|
||||
|
||||
echo '<tr>';
|
||||
|
||||
foreach($user as $key=>$value)
|
||||
if( $key == 'prenom' || $key == 'nom' )
|
||||
echo '<td>'.$value.'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</tbody>';
|
||||
|
||||
echo '</table>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////
|
||||
}else
|
||||
echo "Erreur interne...";
|
||||
|
||||
|
||||
} ?>
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
<?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:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
height="22px"
|
||||
version="1.1"
|
||||
viewBox="0 0 22 22"
|
||||
width="22px"
|
||||
id="svg2"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="1445525197_circle_close_delete.svg">
|
||||
<metadata
|
||||
id="metadata17">
|
||||
<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></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="640"
|
||||
inkscape:window-height="480"
|
||||
id="namedview15"
|
||||
showgrid="false"
|
||||
inkscape:zoom="10.727273"
|
||||
inkscape:cx="11"
|
||||
inkscape:cy="11"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg2" />
|
||||
<defs
|
||||
id="defs6">
|
||||
<path
|
||||
d="M11,22 C17.0751325,22 22,17.0751325 22,11 C22,4.92486745 17.0751325,0 11,0 C4.92486745,0 0,4.92486745 0,11 C0,17.0751325 4.92486745,22 11,22 L11,22 Z M11,21 C16.5228478,21 21,16.5228478 21,11 C21,5.47715223 16.5228478,1 11,1 C5.47715223,1 1,5.47715223 1,11 C1,16.5228478 5.47715223,21 11,21 Z M6.75735931,15.9497475 L6.05025253,15.2426407 L10.2928932,11 L6.05025253,6.75735931 L6.75735931,6.05025253 L11,10.2928932 L15.2426407,6.05025253 L15.9497475,6.75735931 L11.7071068,11 L15.9497475,15.2426407 L15.2426407,15.9497475 L11,11.7071068 L6.75735931,15.9497475 Z"
|
||||
id="path-1" />
|
||||
</defs>
|
||||
<g
|
||||
fill="none"
|
||||
fill-rule="evenodd"
|
||||
id="miu"
|
||||
stroke="none"
|
||||
stroke-width="1">
|
||||
<g
|
||||
id="circle_close_delete_outline_stroke">
|
||||
<use
|
||||
fill="#000000"
|
||||
fill-rule="evenodd"
|
||||
xlink:href="#path-1"
|
||||
id="use11" />
|
||||
<use
|
||||
fill="none"
|
||||
xlink:href="#path-1"
|
||||
id="use13" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.5 KiB |
|
@ -0,0 +1 @@
|
|||
<?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>
|
After Width: | Height: | Size: 218 B |
Loading…
Reference in New Issue