add and edit profil WIP

This commit is contained in:
Fred Tempez 2023-05-06 19:52:33 +02:00
parent da2c0b6440
commit 2ce3efb4fb
6 changed files with 37 additions and 54 deletions

View File

@ -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'];
}

View File

@ -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");

View File

@ -95,12 +95,12 @@
]); ?>
</div>
<div class="col6">
<div class="userAddGroupDescription displayNone" id="userAddGroupDescription<?php echo self::GROUP_MEMBER; ?>">
<div class="userAddGroupProfil displayNone" id="userAddGroupProfil<?php echo self::GROUP_MEMBER; ?>">
<?php echo template::select('userAddProfil' . self::GROUP_MEMBER, $module::$userProfils[self::GROUP_MEMBER], [
'label' => 'Profil',
]); ?>
</div>
<div class="userAddGroupDescription displayNone" id="userAddGroupDescription<?php echo self::GROUP_MODERATOR; ?>">
<div class="userAddGroupProfil displayNone" id="userAddGroupProfil<?php echo self::GROUP_MODERATOR; ?>">
<?php echo template::select('userAddProfil' . self::GROUP_MODERATOR, $module::$userProfils[self::GROUP_MODERATOR], [
'label' => 'Profil',
]); ?>

View File

@ -15,4 +15,9 @@
/** NE PAS EFFACER
* admin.css
*/
*/
#userEditProfil1Wrapper,
#userEditProfil2Wrapper {
padding: 0;
}

View File

@ -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");

View File

@ -112,22 +112,22 @@
'label' => 'Groupe',
'selected' => $this->getData(['user', $this->getUrl(2), 'group'])
]); ?>
<?php if ($this->getData(['user', $this->getUrl(2), 'group']) === self::GROUP_MEMBER): ?>
<div class="col6">
<?php echo template::select('userEditProfil', $module::$userProfils[self::GROUP_MEMBER], [
'label' => 'Profil',
'selected' => $this->getData(['user', $this->getUser('id'), 'profil'])
]); ?>
</div>
<?php endif; ?>
<?php if ($this->getData(['user', $this->getUrl(2), 'group']) === self::GROUP_MEMBER): ?>
<div class="col6">
<?php echo template::select('userEditProfil', $module::$userProfils[self::GROUP_MODERATOR], [
'label' => 'Profil',
'selected' => $this->getData(['user', $this->getUser('id'), 'profil'])
]); ?>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="col6">
<div class="userEditGroupProfil displayNone"
id="userEditGroupProfil<?php echo self::GROUP_MEMBER; ?>">
<?php echo template::select('userEditProfil' . self::GROUP_MEMBER, $module::$userProfils[self::GROUP_MEMBER], [
'label' => 'Profil',
'selected' => $this->getData(['user', $this->getUser('id'), 'profil'])
]); ?>
</div>
<div class="userEditGroupProfil displayNone"
id="userEditGroupProfil<?php echo self::GROUP_MODERATOR; ?>">
<?php echo template::select('userEditProfil' . self::GROUP_MODERATOR, $module::$userProfils[self::GROUP_MODERATOR], [
'label' => 'Profil',
'selected' => $this->getData(['user', $this->getUser('id'), 'profil'])
]); ?>
</div>
</div>
</div>