Edit and Add to test profil

This commit is contained in:
Fred Tempez 2023-05-29 18:43:30 +02:00
parent 7c7c36a5e6
commit de84e3471b
5 changed files with 86 additions and 58 deletions

View File

@ -154,7 +154,7 @@ class user extends common
// Profils disponibles
foreach ($this->getData(['profil']) as $profilId => $profilData) {
if ($profilId < self::GROUP_MEMBER ) {
if ($profilId < self::GROUP_MEMBER) {
continue;
}
if ($profilId === self::GROUP_ADMIN) {
@ -354,11 +354,17 @@ class user extends common
// Profils disponibles
foreach ($this->getData(['profil']) as $profilId => $profilData) {
if ($profilId < 1 || $profilId > 2) {
if ($profilId < self::GROUP_MEMBER) {
continue;
}
if ($profilId === self::GROUP_ADMIN) {
self::$userProfils[$profilId][self::GROUP_ADMIN] = $profilData['name'];
self::$userProfilsComments[$profilId][self::GROUP_ADMIN] = $profilData['comment'];
continue;
}
foreach ($profilData as $key => $value) {
self::$userProfils[$profilId][$key] = $profilData[$key]['name'];
self::$userProfilsComments[$profilId][$key] = $profilData[$key]['name'] . ' : ' . $profilData[$key]['comment'];
}
}
@ -592,7 +598,7 @@ class user extends common
// Valeurs en sortie;
$this->addOutput([
'title' => sprintf(helper::translate('Éditer le profil : %s'),$this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'name'])),
'title' => sprintf(helper::translate('Éditer le profil : %s'), $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'name'])),
'view' => 'profilEdit'
]);
}

View File

@ -11,12 +11,13 @@
* @link http://zwiicms.fr/
*/
/**
$(document).ready(function () {
/**
* Affichage de l'id en simulant FILTER_ID
*/
$("#userAddId").on("change keydown keyup", function(event) {
$("#userAddId").on("change keydown keyup", function (event) {
var userId = $(this).val();
if(
if (
event.keyCode !== 8 // BACKSPACE
&& event.keyCode !== 37 // LEFT
&& event.keyCode !== 39 // RIGHT
@ -28,23 +29,22 @@ $("#userAddId").on("change keydown keyup", function(event) {
"Á": "A", "À": "A", "Â": "A", "Ä": "A", "Ã": "A", "Å": "A", "Ç": "C", "É": "E", "È": "E", "Ê": "E", "Ë": "E", "Í": "I", "Ì": "I", "Î": "I", "Ï": "I", "Ñ": "N", "Ó": "O", "Ò": "O", "Ô": "O", "Ö": "O", "Õ": "O", "Ú": "U", "Ù": "U", "Û": "U", "Ü": "U", "Ý": "Y", "Ÿ": "Y",
"'": "-", "\"": "-", " ": "-"
};
userId = userId.replace(/[áàâäãåçéèêëíìîïñóòôöõúùûüýÿ'" ]/ig, function(match) {
userId = userId.replace(/[áàâäãåçéèêëíìîïñóòôöõúùûüýÿ'" ]/ig, function (match) {
return searchReplace[match];
});
userId = userId.replace(/[^a-z0-9-]/ig, "");
$(this).val(userId);
}
});
});
/**
/**
* Droits des groupes
*/
$("#userAddGroup").on("change", function() {
$("#userAddGroup").on("change", function () {
$(".userAddGroupProfil").hide();
$(".userCommentProfil").hide();
$("#userAddGroupProfil" + $(this).val()).show();
$("#userCommentProfil" + $(this).val()).show();
}).trigger("change");
}).trigger("change");
});

View File

@ -108,6 +108,7 @@
]); ?>
</div>
</div>
</div>
<div class="row">
<div id="userCommentProfil<?php echo self::GROUP_MEMBER; ?>" class="col12 displayNone userCommentProfil">
<?php echo template::textarea('useraddProfilComment' . self::GROUP_MEMBER, [
@ -130,5 +131,4 @@
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>

View File

@ -18,7 +18,9 @@ $(document).ready(function () {
$("#userEditGroup").on("change", function () {
$(".userEditGroupProfil").hide();
$(".userCommentProfil").hide();
$("#userEditGroupProfil" + $(this).val()).show();
$("#userCommentProfil" + $(this).val()).show();
});
});

View File

@ -131,6 +131,26 @@
</div>
</div>
</div>
<div class="row">
<div id="userCommentProfil<?php echo self::GROUP_MEMBER; ?>" class="col12 displayNone userCommentProfil">
<?php echo template::textarea('useraddProfilComment' . self::GROUP_MEMBER, [
"value" => implode("\n",$module::$userProfilsComments[self::GROUP_MEMBER])
]);
?>
</div>
<div id="userCommentProfil<?php echo self::GROUP_MODERATOR; ?>" class="col12 displayNone userCommentProfil">
<?php echo template::textarea('useraddProfilComment2' . self::GROUP_MODERATOR, [
"value" => implode("\n",$module::$userProfilsComments[self::GROUP_MODERATOR])
]);
?>
</div>
<div id="userCommentProfil<?php echo self::GROUP_ADMIN; ?>" class="col12 displayNone userCommentProfil">
<?php echo template::textarea('useraddProfilComment' . self::GROUP_ADMIN, [
"value" => implode("\n",$module::$userProfilsComments[self::GROUP_ADMIN])
]);
?>
</div>
</div>
</div>
</div>
</div>