diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 118f36c5..738477fc 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -969,9 +969,6 @@ if ($this->getData(['core', 'dataVersion']) < 12400) { } } - // Création des modèles de groupe - - // Mise à jour $this->setData(['core', 'dataVersion', 12400]); diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 6c4f5e17..504aac9b 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -335,27 +335,27 @@ class init extends common 'blacklist' => [], 'language'=> [], 'group' => [ - -1 => [ + "-1" => [ 'name' => 'Banni', 'readonly' => true, - 'comment' => 'Inscription désactivée' + 'comment' => 'Accès désactivé' ], - 0 => [ + "0" => [ 'name' => 'Visiteur', 'readonly' => true, - 'comment' => 'Accès aux pages privées' + 'comment' => 'Accède au site' ], - 1 => [ + "1" => [ 'name' => 'Membre', 'readonly' => true, 'comment' => 'Accède aux pages réservées' ], - 2 => [ + "2" => [ 'name' => 'Editeur', 'readonly' => false, 'comment' => 'Edition des pages' ], - 99 => [ + "99" => [ 'name' => 'Administrateur', 'readonly' => true, 'comment' => 'Contrôle total' diff --git a/core/module/user/user.php b/core/module/user/user.php index bf714d8c..bc4c028d 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -28,6 +28,8 @@ class user extends common 'login' => self::GROUP_VISITOR, 'reset' => self::GROUP_VISITOR, 'group' => self::GROUP_ADMIN, + 'groupAdd' => self::GROUP_ADMIN, + 'groupEdit' => self::GROUP_ADMIN, ]; public static $users = []; @@ -42,6 +44,8 @@ class user extends common public static $userId = ''; + public static $userGroups = []; + public static $userLongtime = false; public static $separators = [ @@ -303,11 +307,15 @@ class user extends common } // Langues disponibles pour l'interface de l'utilisateur + self::$languagesInstalled = $this->getData(['language']); - foreach (self::$languagesInstalled as $lang => $datas) { - self::$languagesInstalled[$lang] = self::$languages[$lang]; + if (self::$languagesInstalled) { + foreach (self::$languagesInstalled as $lang => $datas) { + self::$languagesInstalled[$lang] = self::$languages[$lang]; + } } + // Valeurs en sortie $this->addOutput([ 'title' => $this->getData(['user', $this->getUrl(2), 'firstname']) . ' ' . $this->getData(['user', $this->getUrl(2), 'lastname']), @@ -401,9 +409,27 @@ class user extends common */ public function group() { - $groups = $this->getData(['group']); - foreach ($groups as $key => $value) { + $g = $this->getData(['group']); + foreach ($g as $groupId => $groupData) { + self::$userGroups[$groupId] = [ + $groupId, + $groupData['name'], + $groupData['comment'], + template::button('groupEdit' . $groupId, [ + 'href' => helper::baseUrl() . 'user/groupEdit/' . $groupId . '/' . $_SESSION['csrf'], + 'value' => template::ico('pencil'), + 'help' => 'Éditer', + 'disabled' => $groupData['readonly'], + ]), + template::button('userDelete' . $groupId, [ + 'class' => 'userDelete buttonRed', + 'href' => helper::baseUrl() . 'user/groupDelete/' . $groupId . '/' . $_SESSION['csrf'], + 'value' => template::ico('trash'), + 'help' => 'Supprimer', + 'disabled' => $groupData['readonly'], + ]) + ]; } // Valeurs en sortie $this->addOutput([ @@ -412,6 +438,19 @@ class user extends common ]); } + /** + * Edition d'un groupe + */ + public function groupEdit() + { + + // Valeurs en sortie + $this->addOutput([ + 'title' => helper::translate('Editer groupe'), + 'view' => 'groupEdit' + ]); + } + /** * Connexion diff --git a/core/module/user/view/group/group.php b/core/module/user/view/group/group.php index 066e0e97..19a51bca 100644 --- a/core/module/user/view/group/group.php +++ b/core/module/user/view/group/group.php @@ -6,7 +6,5 @@ 'value' => template::ico('left') ]); ?> -
- -
- \ No newline at end of file + + \ No newline at end of file diff --git a/core/module/user/view/groupEdit/groupEdit.css b/core/module/user/view/groupEdit/groupEdit.css new file mode 100644 index 00000000..ec846297 --- /dev/null +++ b/core/module/user/view/groupEdit/groupEdit.css @@ -0,0 +1,18 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2023, Frédéric Tempez + * @license CC Attribution-NonCommercial-NoDerivatives 4.0 International + * @link http://zwiicms.fr/ + */ + + +/** NE PAS EFFACER +* admin.css +*/ \ No newline at end of file diff --git a/core/module/user/view/groupEdit/groupEdit.php b/core/module/user/view/groupEdit/groupEdit.php new file mode 100644 index 00000000..6a9fa8c5 --- /dev/null +++ b/core/module/user/view/groupEdit/groupEdit.php @@ -0,0 +1,13 @@ + +
+
+ 'buttonGrey', + 'href' => helper::baseUrl() . 'user', + 'value' => template::ico('left') + ]); ?> +
+
+ +
+
\ No newline at end of file