diff --git a/core/module/user/ressource/template.csv b/core/module/user/ressource/template.csv index ff495590..3c528550 100755 --- a/core/module/user/ressource/template.csv +++ b/core/module/user/ressource/template.csv @@ -1,2 +1,5 @@ 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 diff --git a/core/module/user/user.php b/core/module/user/user.php index 1c888668..2816fb5c 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -21,11 +21,12 @@ class user extends common 'delete' => self::GROUP_ADMIN, 'import' => self::GROUP_ADMIN, 'index' => self::GROUP_ADMIN, + 'template' => self::GROUP_ADMIN, 'edit' => self::GROUP_MEMBER, 'logout' => self::GROUP_MEMBER, 'forgot' => self::GROUP_VISITOR, 'login' => self::GROUP_VISITOR, - 'reset' => self::GROUP_VISITOR + 'reset' => self::GROUP_VISITOR, ]; public static $users = []; @@ -752,4 +753,20 @@ class user extends common '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(); + } } diff --git a/core/module/user/view/import/import.php b/core/module/user/view/import/import.php index 7345bd88..64ea6420 100644 --- a/core/module/user/view/import/import.php +++ b/core/module/user/view/import/import.php @@ -7,7 +7,7 @@ 'value' => template::ico('left') ]); ?> -
+ 'https://doc.zwiicms.fr/importation-d-une-liste-d-utilisateurs', 'target' => '_blank', @@ -15,8 +15,13 @@ 'class' => 'buttonHelp', 'help' => 'Consulter l\'aide en ligne' ]);*/ ?> +
+ helper::baseUrl() . 'user/template', + 'value' => template::ico('table') + ]); ?>
-
+
'Importer' ]); ?>