Users tags

This commit is contained in:
Fred Tempez 2023-11-30 13:23:41 +01:00
parent fe9fe030b9
commit dcd00033aa
6 changed files with 89 additions and 37 deletions

View File

@ -1,5 +1,5 @@
id;nom;prenom;email;groupe;passe
jm1;Membre1;Jean;jean.membre1@email.fr;1;jEan05
am2;Membre2;Albert;albert.membre2@email.fr;1;alBertAG
jrediteur;Editeur;Robert;robert.editeur@email.fr;2;roBert54
padmin;Dupuis;Admin;paul.admin@email.fr;3;paul;32Mirabel32
id;nom;prenom;email;groupe;profil;passe;tags
jm1;Membre1;Jean;jean.membre1@email.fr;1;1;jEan05;"adhérent"
am2;Membre2;Albert;albert.membre2@email.fr;1;1;alBertAG;"adhérent"
jrediteur;Editeur;Robert;robert.editeur@email.fr;2;1;roBert54;"trésorier"
padmin;Dupuis;Admin;paul.admin@email.fr;3;0;paul32Mirabel32;"président"
1 id;nom;prenom;email;groupe;passe id nom prenom email groupe profil passe tags
2 jm1;Membre1;Jean;jean.membre1@email.fr;1;jEan05 jm1 Membre1 Jean jean.membre1@email.fr 1 1 jEan05 adhérent
3 am2;Membre2;Albert;albert.membre2@email.fr;1;alBertAG am2 Membre2 Albert albert.membre2@email.fr 1 1 alBertAG adhérent
4 jrediteur;Editeur;Robert;robert.editeur@email.fr;2;roBert54 jrediteur Editeur Robert robert.editeur@email.fr 2 1 roBert54 trésorier
5 padmin;Dupuis;Admin;paul.admin@email.fr;3;paul;32Mirabel32 padmin Dupuis Admin paul.admin@email.fr 3 0 paul32Mirabel32 président

View File

@ -133,6 +133,7 @@ class user extends common
'accessTimer' => null,
'accessCsrf' => null,
'language' => $this->getInput('userEditLanguage', helper::FILTER_STRING_SHORT),
'tags' => ''
]
]);
@ -343,6 +344,7 @@ class user extends common
'accessCsrf' => $this->getData(['user', $this->getUrl(2), 'accessCsrf']),
'files' => $this->getInput('userEditFiles', helper::FILTER_BOOLEAN),
'language' => $this->getInput('userEditLanguage', helper::FILTER_STRING_SHORT),
'tags' => $this->getInput('userEditTags', helper::FILTER_STRING_SHORT),
]
]);
// Redirection spécifique si l'utilisateur change son mot de passe
@ -519,6 +521,7 @@ class user extends common
empty($this->getData(['profil', $this->getData(['user', $userId, 'group']), $this->getData(['user', $userId, 'profil']), 'name']))
? helper::translate(self::$groups[(int) $this->getData(['user', $userId, 'group'])])
: $this->getData(['profil', $this->getData(['user', $userId, 'group']), $this->getData(['user', $userId, 'profil']), 'name']),
$this->getData(['user', $userId, 'tags']),
template::button('userEdit' . $userId, [
'href' => helper::baseUrl() . 'user/edit/' . $userId,
'value' => template::ico('pencil'),
@ -1201,17 +1204,22 @@ class user extends common
and array_key_exists('prenom', $item)
and array_key_exists('nom', $item)
and array_key_exists('groupe', $item)
and array_key_exists('profil', $item)
and array_key_exists('email', $item)
and array_key_exists('passe', $item)
and $item['nom']
and $item['prenom']
and $item['id']
and $item['email']
and $item['groupe']
and $item['passe']
and array_key_exists('tags', $item)
and isset($item['id'])
and isset($item['nom'])
and isset($item['prenom'])
and isset($item['email'])
and isset($item['groupe'])
and isset($item['profil'])
and isset($item['passe'])
and isset($item['tags'])
) {
// Validation du groupe
$item['groupe'] = (int) $item['groupe'];
$item['profil'] = (int) $item['profil'];
$item['groupe'] = ($item['groupe'] >= self::GROUP_BANNED and $item['groupe'] <= self::GROUP_ADMIN)
? $item['groupe'] : 1;
// L'utilisateur existe
@ -1224,8 +1232,12 @@ class user extends common
$item['nom'],
$item['prenom'],
self::$groups[$item['groupe']],
($this->getData(['profil', $item['groupe'], $item['profil'], 'name']) !== null )
? $this->getData(['profil', $item['groupe'], $item['profil'], 'name'])
: $item['profil'],
$item['prenom'],
helper::filter($item['email'], helper::FILTER_MAIL),
$item['tags'],
$item['notification']
];
// L'utilisateur n'existe pas
@ -1240,6 +1252,7 @@ class user extends common
'firstname' => $item['prenom'],
'forgot' => 0,
'group' => $item['groupe'],
'profil' => $item['profil'],
'lastname' => $item['nom'],
'mail' => $item['email'],
'pseudo' => $item['prenom'],
@ -1251,7 +1264,8 @@ class user extends common
"connectTimeout" => null,
"accessUrl" => null,
"accessTimer" => null,
"accessCsrf" => null
"accessCsrf" => null,
'tags' => $item['tags']
]
]);
// Icône de notification
@ -1277,17 +1291,23 @@ class user extends common
}
}
// Création du tableau de confirmation
var_dump( $item['profil']);
self::$users[] = [
$userId,
$item['nom'],
$item['prenom'],
self::$groups[$item['groupe']],
($this->getData(['profil', $item['groupe'], $item['profil'], 'name']) !== null )
? $this->getData(['profil', $item['groupe'], $item['profil'], 'name'])
: $item['profil'],
$item['prenom'],
$item['email'],
$item['tags'],
$item['notification']
];
}
}
}
if (empty(self::$users)) {
$notification = helper::translate('Rien à importer, erreur de format ou fichier incorrect');

View File

@ -46,13 +46,28 @@
]); ?>
</div>
</div>
<?php echo template::mail('userAddMail', [
'autocomplete' => 'off',
'label' => 'Adresse électronique'
]); ?>
<?php echo template::select('userAddLanguage', $module::$languagesInstalled, [
'label' => 'Langues'
]); ?>
<div class="row">
<div class="col6">
<?php echo template::mail('userAddMail', [
'autocomplete' => 'off',
'label' => 'Adresse électronique'
]); ?>
</div>
<div class="col6">
<?php echo template::select('userAddLanguage', $module::$languagesInstalled, [
'label' => 'Langues'
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::text('userAddTags', [
'label' => 'Etiquettes',
'value' => $this->getData(['user', $this->getUrl(2), 'tags']),
'help' => 'Le séparateur d\'étiquettes est l\'espace'
]); ?>
</div>
</div>
</div>
</div>
<div class="col6">
@ -110,21 +125,23 @@
</div>
</div>
<div class="row">
<div id="userCommentProfil<?php echo self::GROUP_MEMBER; ?>" class="col12 displayNone userCommentProfil">
<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])
"value" => implode("\n", $module::$userProfilsComments[self::GROUP_MEMBER])
]);
?>
</div>
<div id="userCommentProfil<?php echo self::GROUP_EDITOR; ?>" class="col12 displayNone userCommentProfil">
<div id="userCommentProfil<?php echo self::GROUP_EDITOR; ?>"
class="col12 displayNone userCommentProfil">
<?php echo template::textarea('useraddProfilComment2' . self::GROUP_EDITOR, [
"value" => implode("\n",$module::$userProfilsComments[self::GROUP_EDITOR])
"value" => implode("\n", $module::$userProfilsComments[self::GROUP_EDITOR])
]);
?>
</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])
"value" => implode("\n", $module::$userProfilsComments[self::GROUP_ADMIN])
]);
?>
</div>

View File

@ -58,15 +58,30 @@
]); ?>
</div>
</div>
<?php echo template::mail('userEditMail', [
'autocomplete' => 'off',
'label' => 'Adresse électronique',
'value' => $this->getData(['user', $this->getUrl(2), 'mail'])
]); ?>
<?php echo template::select('userEditLanguage', $module::$languagesInstalled, [
'label' => 'Langue',
'selected' => $this->getData(['user', $this->getUrl(2), 'language'])
]); ?>
<div class="row">
<div class="col6">
<?php echo template::mail('userEditMail', [
'autocomplete' => 'off',
'label' => 'Adresse électronique',
'value' => $this->getData(['user', $this->getUrl(2), 'mail'])
]); ?>
</div>
<div class="col6">
<?php echo template::select('userEditLanguage', $module::$languagesInstalled, [
'label' => 'Langue',
'selected' => $this->getData(['user', $this->getUrl(2), 'language'])
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::text('userEditTags', [
'label' => 'Etiquettes',
'value' => $this->getData(['user', $this->getUrl(2), 'tags']),
'help' => 'Le séparateur d\'étiquettes est l\'espace'
]); ?>
</div>
</div>
</div>
</div>
<div class="col6">
@ -81,7 +96,7 @@
'readonly' => true,
'value' => $this->getUrl(2)
]); ?>
<?php
<?php
// Les admins ont le pouvoir de forcer le changement de mot de passe
if ($this->getUser('group') < self::GROUP_ADMIN): ?>
<?php echo template::password('userEditOldPassword', [

View File

@ -61,10 +61,10 @@
<?php if ($module::$users): ?>
<div class="row">
<div class="col12 textAlignCenter">
<?php echo template::table([1, 3, 3, 1, 1, 2, 1], $module::$users, ['Id', 'Nom', 'Prénom', 'Groupe', 'Pseudo', 'eMail', '']); ?>
<?php echo template::table([1, 2, 2, 1, 1, 1, 2, 1, 1], $module::$users, ['Id', 'Nom', 'Prénom', 'Groupe', 'Profil', 'Pseudo', 'eMail', 'Etiquettes', '']); ?>
<?php echo template::ico('check'); ?> Compte créé |
<?php echo template::ico('mail'); ?> Compte créé et notifié |
<?php echo template::ico('cancel'); ?> Erreur dans le fichier, compte non créé.
<?php echo template::ico('cancel'); ?> Erreur dans le fichier ou le compte existe.
</div>
</div>
<?php endif; ?>

View File

@ -60,4 +60,4 @@
</div>
</div>
<?php echo template::formClose(); ?>
<?php echo template::table([2, 2, 3, 3, 1, 1], $module::$users, ['Identifiant', 'Nom', 'Groupe', 'Profil', '', ''], ['id' => 'dataTables']); ?>
<?php echo template::table([2, 2, 2, 2, 2, 1, 1], $module::$users, ['Identifiant', 'Nom', 'Groupe', 'Profil', 'Etiquette', '', ''], ['id' => 'dataTables']); ?>