12300 user import template

This commit is contained in:
Fred Tempez 2023-02-10 22:27:08 +01:00
parent 46482b7d2b
commit aa0b152b67
3 changed files with 29 additions and 4 deletions

View File

@ -1,2 +1,5 @@
id;nom;prenom;email;groupe id;nom;prenom;email;groupe
jbon;Bon;Jean;jean.bon@email.fr;1 jm1;Membre1;Jean;jean.membre1@email.fr;1
am2;Membre2;Albert;albert.membre2@email.fr;1
jrediteur;Editeur;Robert;robert.editeur@email.fr;2
padmin;Dupuis;Admin;paul.admin@email.fr;3

1 id nom prenom email groupe
2 jbon jm1 Bon Membre1 Jean jean.bon@email.fr jean.membre1@email.fr 1
3 am2 Membre2 Albert albert.membre2@email.fr 1
4 jrediteur Editeur Robert robert.editeur@email.fr 2
5 padmin Dupuis Admin paul.admin@email.fr 3

View File

@ -21,11 +21,12 @@ class user extends common
'delete' => self::GROUP_ADMIN, 'delete' => self::GROUP_ADMIN,
'import' => self::GROUP_ADMIN, 'import' => self::GROUP_ADMIN,
'index' => self::GROUP_ADMIN, 'index' => self::GROUP_ADMIN,
'template' => self::GROUP_ADMIN,
'edit' => self::GROUP_MEMBER, 'edit' => self::GROUP_MEMBER,
'logout' => self::GROUP_MEMBER, 'logout' => self::GROUP_MEMBER,
'forgot' => self::GROUP_VISITOR, 'forgot' => self::GROUP_VISITOR,
'login' => self::GROUP_VISITOR, 'login' => self::GROUP_VISITOR,
'reset' => self::GROUP_VISITOR 'reset' => self::GROUP_VISITOR,
]; ];
public static $users = []; public static $users = [];
@ -752,4 +753,20 @@ class user extends common
'state' => $success 'state' => $success
]); ]);
} }
/**
* Télécharge un modèle
*/
public function template() {
$file = 'template.csv';
$path = 'core/module/user/ressource/';
// Téléchargement du CSV
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: attachment; filename="' . $file . '"');
header('Content-Length: ' . filesize($path . $file));
readfile($path . $file);
exit();
}
} }

View File

@ -7,7 +7,7 @@
'value' => template::ico('left') 'value' => template::ico('left')
]); ?> ]); ?>
</div> </div>
<div class="col1">
<?php /**echo template::button('userHelp', [ <?php /**echo template::button('userHelp', [
'href' => 'https://doc.zwiicms.fr/importation-d-une-liste-d-utilisateurs', 'href' => 'https://doc.zwiicms.fr/importation-d-une-liste-d-utilisateurs',
'target' => '_blank', 'target' => '_blank',
@ -15,8 +15,13 @@
'class' => 'buttonHelp', 'class' => 'buttonHelp',
'help' => 'Consulter l\'aide en ligne' 'help' => 'Consulter l\'aide en ligne'
]);*/ ?> ]);*/ ?>
<div class="col1 offset8">
<?php echo template::button('userImporTemplate', [
'href' => helper::baseUrl() . 'user/template',
'value' => template::ico('table')
]); ?>
</div> </div>
<div class="col2 offset8"> <div class="col2">
<?php echo template::submit('userImportSubmit', [ <?php echo template::submit('userImportSubmit', [
'value' => 'Importer' 'value' => 'Importer'
]); ?> ]); ?>