Add profil

This commit is contained in:
Fred Tempez 2023-05-10 16:58:56 +02:00
parent f2636c87d8
commit ab46dd9ab2
2 changed files with 8 additions and 5 deletions

View File

@ -595,11 +595,14 @@ class user extends common
{ {
// Soumission du formulaire // Soumission du formulaire
if ($this->isPost()) { if ($this->isPost()) {
// Nombre de profils de ce groupe
$group = $this->getInput('profilAddGroup');
$profil = (string) (count($this->getData(['profil', $group])) + 1);
// Sauvegarder les données // Sauvegarder les données
$this->setData([ $this->setData([
'profil', 'profil',
$this->getInput('profilAddGroup'), $group,
$this->getInput('profilAddProfil'), $profil,
[ [
'name' => $this->getInput('profilAddName', helper::FILTER_STRING_SHORT, true), 'name' => $this->getInput('profilAddName', helper::FILTER_STRING_SHORT, true),
'readonly' => false, 'readonly' => false,

View File

@ -21,13 +21,13 @@
<div class="col6"> <div class="col6">
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<?php echo template::text('profilEditName', [ <?php echo template::text('profilAddName', [
'label' => 'Nom du profil', 'label' => 'Nom du profil',
'value' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'name']) 'value' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'name'])
]); ?> ]); ?>
</div> </div>
<div class="col12"> <div class="col12">
<?php echo template::select('profilEditGroup', $module::$groupProfils, [ <?php echo template::select('profilAddGroup', $module::$groupProfils, [
'label' => 'Groupe', 'label' => 'Groupe',
'selected' => $this->getUrl(2) 'selected' => $this->getUrl(2)
]); ?> ]); ?>
@ -35,7 +35,7 @@
</div> </div>
</div> </div>
<div class="col6"> <div class="col6">
<?php echo template::textarea('profilEditComment', [ <?php echo template::textarea('profilAddComment', [
'label' => 'Commentaire', 'label' => 'Commentaire',
'value' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'comment']) 'value' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'comment'])
]); ?> ]); ?>