From 2ce3efb4fbaf318646c8f0e69822ffadbc4db114 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 6 May 2023 19:52:33 +0200 Subject: [PATCH] add and edit profil WIP --- core/module/user/user.php | 9 +++++-- core/module/user/view/add/add.js.php | 4 +-- core/module/user/view/add/add.php | 4 +-- core/module/user/view/edit/edit.css | 7 +++++- core/module/user/view/edit/edit.js.php | 35 +++----------------------- core/module/user/view/edit/edit.php | 32 +++++++++++------------ 6 files changed, 37 insertions(+), 54 deletions(-) diff --git a/core/module/user/user.php b/core/module/user/user.php index 7810a1ab..fb94bb15 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -94,7 +94,7 @@ class user extends common // Profil $group = $this->getInput('userAddGroup', helper::FILTER_INT, true); $profil = null; - if ($group > 1 || $group < 2 ) { + if ($group > 1 || $group < 2) { $profil = $this->getInput('userAddProfil' . $group, helper::FILTER_INT); } @@ -289,6 +289,11 @@ class user extends common $newfirstname = $this->getData(['user', $this->getUrl(2), 'firstname']); $newlastname = $this->getData(['user', $this->getUrl(2), 'lastname']); } + // Profil + $profil = null; + if ($newGroup > 1 || $newGroup < 2) { + $profil = $this->getInput('userEditProfil' . $newGroup, helper::FILTER_INT); + } // Modifie l'utilisateur $this->setData([ 'user', @@ -297,6 +302,7 @@ class user extends common 'firstname' => $newfirstname, 'forgot' => 0, 'group' => $newGroup, + 'profil' => $profil, 'lastname' => $newlastname, 'pseudo' => $this->getInput('userEditPseudo', helper::FILTER_STRING_SHORT, true), 'signature' => $this->getInput('userEditSignature', helper::FILTER_INT, true), @@ -344,7 +350,6 @@ class user extends common if ($profilId < 1 || $profilId > 2) { continue; } - echo $profilId; foreach ($profilData as $key => $value) { self::$userProfils[$profilId][$key] = $profilData[$key]['name']; } diff --git a/core/module/user/view/add/add.js.php b/core/module/user/view/add/add.js.php index ad7d7810..1634f7a9 100644 --- a/core/module/user/view/add/add.js.php +++ b/core/module/user/view/add/add.js.php @@ -40,8 +40,8 @@ $("#userAddId").on("change keydown keyup", function(event) { * Droits des groupes */ $("#userAddGroup").on("change", function() { - $(".userAddGroupDescription").hide(); - $("#userAddGroupDescription" + $(this).val()).show(); + $(".userAddGroupProfil").hide(); + $("#userAddGroupProfil" + $(this).val()).show(); }).trigger("change"); diff --git a/core/module/user/view/add/add.php b/core/module/user/view/add/add.php index 997b579f..060c8c36 100644 --- a/core/module/user/view/add/add.php +++ b/core/module/user/view/add/add.php @@ -95,12 +95,12 @@ ]); ?>
-
+
'Profil', ]); ?>
-
+
'Profil', ]); ?> diff --git a/core/module/user/view/edit/edit.css b/core/module/user/view/edit/edit.css index ec846297..03a500e6 100755 --- a/core/module/user/view/edit/edit.css +++ b/core/module/user/view/edit/edit.css @@ -15,4 +15,9 @@ /** NE PAS EFFACER * admin.css -*/ \ No newline at end of file +*/ + +#userEditProfil1Wrapper, +#userEditProfil2Wrapper { + padding: 0; +} \ No newline at end of file diff --git a/core/module/user/view/edit/edit.js.php b/core/module/user/view/edit/edit.js.php index 9eb3af61..2b2dde85 100644 --- a/core/module/user/view/edit/edit.js.php +++ b/core/module/user/view/edit/edit.js.php @@ -12,39 +12,12 @@ */ -/** - * Droits des groupes - */ -$("#userEditGroup").on("change", function() { - $(".userEditGroupDescription").hide(); - $("#userEditGroupDescription" + $(this).val()).show(); - if ($("#userEditGroup option:selected").val() < 0) { - $("#userEditLabelAuth").css("display","none"); - } else { - $("#userEditLabelAuth").css("display","inline-block"); - } -}).trigger("change"); - $(document).ready(function(){ - // Membre avec ou sans gestion de fichiers - if($("#userEditGroup").val() === '1') { - $("#userEditMemberFiles").slideDown(); - } - else { - $("#userEditMemberFiles").slideUp(function() { - $("#userEditFiles").prop("checked", false).trigger("change"); - }); - } + $(".userEditGroupProfil").hide(); + $("#userEditGroupProfil" + $("#userEditGroup").val()).show(); }); $("#userEditGroup").on("change", function() { - // Membre avec ou sans gestion de fichiers - if($("#userEditGroup").val() === '1') { - $("#userEditMemberFiles").slideDown(); - } - else { - $("#userEditMemberFiles").slideUp(function() { - $("#userEditFiles").prop("checked", false).trigger("change"); - }); - } + $(".userEditGroupProfil").hide(); + $("#userEditGroupProfil" + $(this).val()).show(); }).trigger("change"); diff --git a/core/module/user/view/edit/edit.php b/core/module/user/view/edit/edit.php index 0617a4fd..7e243e20 100644 --- a/core/module/user/view/edit/edit.php +++ b/core/module/user/view/edit/edit.php @@ -112,22 +112,22 @@ 'label' => 'Groupe', 'selected' => $this->getData(['user', $this->getUrl(2), 'group']) ]); ?> - getData(['user', $this->getUrl(2), 'group']) === self::GROUP_MEMBER): ?> -
- 'Profil', - 'selected' => $this->getData(['user', $this->getUser('id'), 'profil']) - ]); ?> -
- - getData(['user', $this->getUrl(2), 'group']) === self::GROUP_MEMBER): ?> -
- 'Profil', - 'selected' => $this->getData(['user', $this->getUser('id'), 'profil']) - ]); ?> - - + +
+
+
+ 'Profil', + 'selected' => $this->getData(['user', $this->getUser('id'), 'profil']) + ]); ?> +
+
+ 'Profil', + 'selected' => $this->getData(['user', $this->getUser('id'), 'profil']) + ]); ?>