From c663e62d93de9bb5a096ba14e1e9c05bd6367164 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Fri, 20 Nov 2015 10:32:07 +0100 Subject: [PATCH] =?UTF-8?q?Page=20de=20modification=20des=20r=C3=B4les=20+?= =?UTF-8?q?=20checkbox=20hack?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/global.css | 46 +++++++++++++++++++++++++++++++++++++++++++ manager/repo/user.php | 14 +++++++++++-- page/settings.php | 21 ++++++++++++++++++-- 3 files changed, 77 insertions(+), 4 deletions(-) diff --git a/css/global.css b/css/global.css index 1e30c91..c3e5a51 100755 --- a/css/global.css +++ b/css/global.css @@ -392,4 +392,50 @@ tr.grayscale input:focus{ #CONTAINER > section div.partlist > span.active{ background-color: #2dcc70; color: #fff; +} + + +/* CHECKBOXES (HACK) */ +td input[type=checkbox]{ + display: none; +} + +td input[type=checkbox] + label{ + /* position */ + display: inline-block; + position: relative; + width: 1em; + height: 1em; + margin-bottom: -.25em; + + /* border */ + border-radius: 3px; + border: 1px solid #7c7c7c; + + /* background */ + background: transparent none center center no-repeat; + background-size: auto 100%; + + /* 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: pointer; + + user-select: none; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + -o-user-select: none; + +} + +/* @checked */ +td input[type=checkbox]:checked + label{ + border-color: #2dcc70; + background-image: url(../src/validate.svg); } \ No newline at end of file diff --git a/manager/repo/user.php b/manager/repo/user.php index 7fccd23..360b9ce 100755 --- a/manager/repo/user.php +++ b/manager/repo/user.php @@ -95,12 +95,22 @@ class userRepo extends DBAccess{ * */ public static function getRoleUsers(){ - $getListeEnseignants = DataBase::getPDO()->query("SELECT DISTINCT identifiant as id, nom, prenom + $getListeUtilisateurs = DataBase::getPDO()->query("SELECT DISTINCT identifiant as id, nom, prenom, droits as role FROM utilisateur WHERE droits <> 'student' ORDER BY identifiant ASC"); - return DataBase::delNumeric( $getListeEnseignants->fetchAll() ); + // si aucun résultat, on retourne false + if( !($userlist=$getListeUtilisateurs->fetchAll()) ) + return false; + + $userlist = DataBase::delNumeric( $userlist ); + + // sinon on met les rôles sous forme de tableau + foreach($userlist as $iter=>$user) + $userlist[$iter]['role'] = explode(',', $user['role']); + + return $userlist; } diff --git a/page/settings.php b/page/settings.php index 26149f0..e517dd4 100755 --- a/page/settings.php +++ b/page/settings.php @@ -31,9 +31,26 @@ if( permission('admin') ){ if( $answer->request == 'success' ){ // si aucune erreur - echo "
"; + echo "
"; - var_dump( $answer->userlist ); + // var_dump( $answer->userlist ); + + echo ""; + foreach($answer->userlist as $user){ + echo ""; + echo ""; + echo ""; + echo ""; + + // si l'utilisateur est admin + if( in_array('admin', $user['role']) ) + echo ""; + else + echo ""; + + echo ""; + } + echo "
".$user['id']."".$user['prenom']."".$user['nom']." admin admin
"; echo "
";