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 // Profil
$group = $this->getInput('userAddGroup', helper::FILTER_INT, true); $group = $this->getInput('userAddGroup', helper::FILTER_INT, true);
$profil = null; $profil = null;
if ($group > 1 || $group < 2 ) { if ($group > 1 || $group < 2) {
$profil = $this->getInput('userAddProfil' . $group, helper::FILTER_INT); $profil = $this->getInput('userAddProfil' . $group, helper::FILTER_INT);
} }
@ -289,6 +289,11 @@ class user extends common
$newfirstname = $this->getData(['user', $this->getUrl(2), 'firstname']); $newfirstname = $this->getData(['user', $this->getUrl(2), 'firstname']);
$newlastname = $this->getData(['user', $this->getUrl(2), 'lastname']); $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 // Modifie l'utilisateur
$this->setData([ $this->setData([
'user', 'user',
@ -297,6 +302,7 @@ class user extends common
'firstname' => $newfirstname, 'firstname' => $newfirstname,
'forgot' => 0, 'forgot' => 0,
'group' => $newGroup, 'group' => $newGroup,
'profil' => $profil,
'lastname' => $newlastname, 'lastname' => $newlastname,
'pseudo' => $this->getInput('userEditPseudo', helper::FILTER_STRING_SHORT, true), 'pseudo' => $this->getInput('userEditPseudo', helper::FILTER_STRING_SHORT, true),
'signature' => $this->getInput('userEditSignature', helper::FILTER_INT, true), 'signature' => $this->getInput('userEditSignature', helper::FILTER_INT, true),
@ -344,7 +350,6 @@ class user extends common
if ($profilId < 1 || $profilId > 2) { if ($profilId < 1 || $profilId > 2) {
continue; continue;
} }
echo $profilId;
foreach ($profilData as $key => $value) { foreach ($profilData as $key => $value) {
self::$userProfils[$profilId][$key] = $profilData[$key]['name']; self::$userProfils[$profilId][$key] = $profilData[$key]['name'];
} }

View File

@ -40,8 +40,8 @@ $("#userAddId").on("change keydown keyup", function(event) {
* Droits des groupes * Droits des groupes
*/ */
$("#userAddGroup").on("change", function() { $("#userAddGroup").on("change", function() {
$(".userAddGroupDescription").hide(); $(".userAddGroupProfil").hide();
$("#userAddGroupDescription" + $(this).val()).show(); $("#userAddGroupProfil" + $(this).val()).show();
}).trigger("change"); }).trigger("change");

View File

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

View File

@ -15,4 +15,9 @@
/** NE PAS EFFACER /** NE PAS EFFACER
* admin.css * 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(){ $(document).ready(function(){
// Membre avec ou sans gestion de fichiers $(".userEditGroupProfil").hide();
if($("#userEditGroup").val() === '1') { $("#userEditGroupProfil" + $("#userEditGroup").val()).show();
$("#userEditMemberFiles").slideDown();
}
else {
$("#userEditMemberFiles").slideUp(function() {
$("#userEditFiles").prop("checked", false).trigger("change");
});
}
}); });
$("#userEditGroup").on("change", function() { $("#userEditGroup").on("change", function() {
// Membre avec ou sans gestion de fichiers $(".userEditGroupProfil").hide();
if($("#userEditGroup").val() === '1') { $("#userEditGroupProfil" + $(this).val()).show();
$("#userEditMemberFiles").slideDown();
}
else {
$("#userEditMemberFiles").slideUp(function() {
$("#userEditFiles").prop("checked", false).trigger("change");
});
}
}).trigger("change"); }).trigger("change");

View File

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