diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 267bb2008..0e5a06c4c 100644 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -549,6 +549,10 @@ + + Thelia\Controller\Admin\ConfigurationController::indexAction + + Thelia\Controller\Admin\ConfigController::defaultAction @@ -1150,6 +1154,16 @@ Thelia\Controller\Admin\TranslationsController::updateAction + + + + Thelia\Controller\Admin\ExportController::indexAction + + + + Thelia\Controller\Admin\CustomerExportController::NewsletterExportAction + + diff --git a/core/lib/Thelia/Controller/Admin/ConfigurationController.php b/core/lib/Thelia/Controller/Admin/ConfigurationController.php new file mode 100644 index 000000000..5d091a976 --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/ConfigurationController.php @@ -0,0 +1,34 @@ + + */ +class ConfigurationController extends BaseAdminController +{ + public function indexAction() + { + if (null !== $response = $this->checkAuth([AdminResources::CONFIG], [], [AccessManager::VIEW])) { + return $response; + } + + return $this->render('configuration'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/CustomerExportController.php b/core/lib/Thelia/Controller/Admin/CustomerExportController.php new file mode 100644 index 000000000..b4a6f1448 --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/CustomerExportController.php @@ -0,0 +1,67 @@ + + */ +class CustomerExportController extends BaseAdminController +{ + + public function NewsletterExportAction() + { + if (null !== $response = $this->checkAuth([AdminResources::EXPORT_CUSTOMER_NEWSLETTER], [], [AccessManager::VIEW])) { + return $response; + } + + $data = NewsletterQuery::create() + ->select([ + 'email', + 'firstname', + 'lastname', + 'locale' + ]) + ->find(); + + $handle = fopen('php://memory', 'r+'); + + fputcsv($handle, ['email','firstname','lastname','locale'], ';', '"'); + + foreach ($data->toArray() as $customer) { + fputcsv($handle, $customer, ';', '"'); + } + + rewind($handle); + $content = stream_get_contents($handle); + fclose($handle); + + return Response::create( + $content, + 200, + array( + "Content-Type"=>"application/csv-tab-delimited-table", + "Content-disposition"=>"filename=export_customer_newsletter.csv" + ) + ); + + } + +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/ExportController.php b/core/lib/Thelia/Controller/Admin/ExportController.php new file mode 100644 index 000000000..7bdcd401d --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/ExportController.php @@ -0,0 +1,35 @@ + + */ +class ExportController extends BaseAdminController +{ + + public function indexAction() + { + if (null !== $response = $this->checkAuth([AdminResources::EXPORT], [], [AccessManager::VIEW])) { + return $response; + } + + return $this->render('export'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Controller/Admin/ToolsController.php b/core/lib/Thelia/Controller/Admin/ToolsController.php new file mode 100644 index 000000000..0f99ded04 --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/ToolsController.php @@ -0,0 +1,34 @@ + + */ +class ToolsController extends BaseAdminController +{ + public function indexAction() + { + if (null !== $response = $this->checkAuth([AdminResources::TOOLS], [], [AccessManager::VIEW])) { + return $response; + } + + return $this->render('tools'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Security/Resource/AdminResources.php b/core/lib/Thelia/Core/Security/Resource/AdminResources.php index 5e78efd7e..107aef017 100644 --- a/core/lib/Thelia/Core/Security/Resource/AdminResources.php +++ b/core/lib/Thelia/Core/Security/Resource/AdminResources.php @@ -100,4 +100,10 @@ final class AdminResources const TRANSLATIONS = "admin.configuration.translations"; const UPDATE = "admin.configuration.update"; + + const EXPORT = "admin.export"; + + const EXPORT_CUSTOMER_NEWSLETTER = "admin.export.customer.newsletter"; + + const TOOLS = "admin.tools"; } diff --git a/setup/insert.sql b/setup/insert.sql index f7c5a2db8..c53ff0a40 100644 --- a/setup/insert.sql +++ b/setup/insert.sql @@ -1277,7 +1277,9 @@ INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES (29, 'admin.configuration.admin-logs', NOW(), NOW()), (30, 'admin.configuration.system-logs', NOW(), NOW()), (31, 'admin.configuration.advanced', NOW(), NOW()), -(32, 'admin.configuration.translations', NOW(), NOW()); +(32, 'admin.configuration.translations', NOW(), NOW()), +(33, 'admin.export', NOW(), NOW()), +(34, 'admin.tools', NOW(), NOW()); /** generated with command : php Thelia thelia:generate-resources --output sql-i18n @@ -1346,7 +1348,11 @@ INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES (31, 'en_US', 'Advanced configuration'), (31, 'fr_FR', 'Configuration avancée'), (32, 'en_US', 'Translations'), -(32, 'fr_FR', 'Traductions'); +(32, 'fr_FR', 'Traductions'), +(33, 'en_US', 'Back-office export management'), +(33, 'fr_FR', 'gestion des exports'), +(34, 'en_US', 'Tools panel'), +(34, 'fr_FR', 'Outils'); INSERT INTO `message` (`id`, `name`, `secured`, `text_layout_file_name`, `text_template_file_name`, `html_layout_file_name`, `html_template_file_name`, `created_at`, `updated_at`) VALUES diff --git a/setup/update/2.0.1.sql b/setup/update/2.0.1.sql index e1bf8e310..f3d7be46f 100644 --- a/setup/update/2.0.1.sql +++ b/setup/update/2.0.1.sql @@ -12,6 +12,7 @@ ALTER TABLE `module` ADD INDEX `idx_module_activate` (`activate`); SELECT @max := MAX(`id`) FROM `resource`; SET @max := @max+1; + INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES (@max, 'admin.configuration.store', NOW(), NOW()); @@ -64,4 +65,34 @@ INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES (@max, 'en_US', 'Translations'), (@max, 'fr_FR', 'Traductions'); +SET @max := @max+1; + +INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES +(@max, 'admin.tools', NOW(), NOW()); + +INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES +(@max, 'en_US', 'Tools panel'), +(@max, 'fr_FR', 'Outils'); + +SET @max := @max+1; + +INSERT INTO `resource` (`id`, `code`, `created_at`, `updated_at`) VALUES +(@max, 'admin.export', NOW(), NOW()); + +INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES +(@max, 'en_US', 'Back-office export management'), +(@max, 'fr_FR', 'gestion des exports'); + + +SET @max := @max+1; + +INSERT INTO `resource` (`id`, `code`, `created_at`, `updated_at`) VALUES +(@max, 'admin.export.customer.newsletter', NOW(), NOW()); + +INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES +(@max, 'en_US', 'export of newsletter subscribers'), +(@max, 'fr_FR', 'export des inscrits à la newsletter'); + + + SET FOREIGN_KEY_CHECKS = 1; diff --git a/templates/backOffice/default/I18n/fr_FR.php b/templates/backOffice/default/I18n/fr_FR.php index 812e7f221..a7aaf03de 100755 --- a/templates/backOffice/default/I18n/fr_FR.php +++ b/templates/backOffice/default/I18n/fr_FR.php @@ -205,6 +205,7 @@ return array( 'Current quantity' => 'Quantité actuelle', 'Current version' => 'Version en cours', 'Customer' => 'Client', + 'Customer export' => 'Export client', 'Customer informations' => 'Informations client', 'Customers' => 'Clients', 'Customers list' => 'Liste des clients', @@ -456,6 +457,8 @@ return array( 'Existing combinations will be deleted. Do you want to continue ?' => 'Les combinaisons existantes seront supprimées. Voulez-vous continuer ?', 'Expiration date' => 'Date de fin de validité', 'Expiration date :' => 'Date de fin de validité : ', + 'Export' => 'Export', + 'Exports' => 'Exports', 'Failed to get converted prices. Please try again.' => 'Erreur lors de la récupération des prix convertis. Veuillez réessayer.', 'Failed to get prices. Please try again.' => 'Erreur lors de la récupération des prix. Veuillez réessayer.', 'Fax number' => 'Numéro de fax', @@ -487,6 +490,7 @@ return array( 'General' => 'Général', 'General configuration' => 'Configuration générale', 'General description' => 'Description générale', + 'General tools' => 'outils généraux', 'Go to administration home' => 'Aller à l\'accueil de l\'interface d\'administration', 'Go to first page' => 'Aller à la première page', 'Go to last page' => 'Aller à la dernière page', @@ -837,6 +841,7 @@ return array( 'Thelia product templates' => 'templates produit Thelia', 'Thelia support forum' => 'Forum de Thelia', 'Thelia system variables' => 'Variables Thelia', + 'Thelia tools' => 'Outils Thelia', 'Thelia, the open source e-commerce solution' => 'Thelia, la solution e-commerce libre', 'There are no shipping zones attached to this module.' => 'Ce module de transport n\'est associé à aucune zone de livraison', 'There is currently no active module here.' => 'Il n\'y a aucun module actif ici', @@ -880,6 +885,7 @@ return array( 'To remove a value from the combination, select it and click "remove"' => 'Afin de supprimer une valeur de la combinaison, sélectionnez la et cliquez sur "Enlever"', 'To use features or attributes on this product, please select a product template. You can define product templates in the configuration section of the administration.' => 'Pour utiliser les déclinaisons et les caractéristiques sur ce produit, choisissez un tempplate produit. Vous pouvez gérer les templates de produit dans la section configuration de l\'administration.', 'Today' => 'Aujourd\'hui', + 'Tools' => 'Outils', 'Top level' => 'Niveau 1', 'Top level Contents' => 'Contenus de niveau 1', 'Top level Products' => 'Produits mis en avant', @@ -970,6 +976,7 @@ return array( 'last order' => 'Dernière commande', 'long description' => 'description longue', 'max usage' => 'utilisations max', + 'newsletter subscribers' => 'Inscrits à la newsletter', 'order amount' => 'Montant de la commande', 'orders for this customer' => 'commandes pour ce client', 'short description' => 'description court', diff --git a/templates/backOffice/default/admin-layout.tpl b/templates/backOffice/default/admin-layout.tpl index 73bf88590..fe80d0330 100644 --- a/templates/backOffice/default/admin-layout.tpl +++ b/templates/backOffice/default/admin-layout.tpl @@ -187,26 +187,28 @@ {/loop} - {loop name="menu-auth-coupon" type="auth" role="ADMIN" resource="admin.coupon" access="VIEW"} - - {intl l="Coupons"} + {loop name="menu-auth-tools" type="auth" role="ADMIN" resource="admin.tools" access="VIEW"} + + {intl l="Tools"} {/loop} + {loop name="menu-auth-modules" type="auth" role="ADMIN" resource="admin.module" access="VIEW"} + + {intl l="Modules"} + + {/loop} + {loop name="menu-auth-config" type="auth" role="ADMIN" resource="admin.configuration" access="VIEW"} {intl l="Configuration"} {/loop} - {loop name="menu-auth-modules" type="auth" role="ADMIN" resource="admin.module" access="VIEW"} - - {intl l="Modules"} - {module_include location='in_top_menu_items'} - {/loop} + {loop name="top-bar-search" type="auth" role="ADMIN" resource="admin.search" access="VIEW"} diff --git a/templates/backOffice/default/coupon-create.html b/templates/backOffice/default/coupon-create.html index 79cf6e4fa..8dab9585e 100644 --- a/templates/backOffice/default/coupon-create.html +++ b/templates/backOffice/default/coupon-create.html @@ -11,6 +11,7 @@ {intl l='Home'} + {intl l='Tools'} {intl l='Coupon'} {intl l='Create'} diff --git a/templates/backOffice/default/coupon-list.html b/templates/backOffice/default/coupon-list.html index 50d4ee5cb..4ba344601 100644 --- a/templates/backOffice/default/coupon-list.html +++ b/templates/backOffice/default/coupon-list.html @@ -13,6 +13,7 @@ {intl l='Home'} + {intl l='Tools'} {intl l='Coupon'} diff --git a/templates/backOffice/default/coupon-read.html b/templates/backOffice/default/coupon-read.html index c6dab9462..3492bd605 100644 --- a/templates/backOffice/default/coupon-read.html +++ b/templates/backOffice/default/coupon-read.html @@ -14,6 +14,7 @@ {intl l='Home'} + {intl l='Tools'} {intl l='Coupon'} {$CODE} diff --git a/templates/backOffice/default/coupon-update.html b/templates/backOffice/default/coupon-update.html index 5a2d89ccc..9a70d6fa0 100644 --- a/templates/backOffice/default/coupon-update.html +++ b/templates/backOffice/default/coupon-update.html @@ -12,6 +12,7 @@ {intl l='Home'} + {intl l='Tools'} {intl l='Coupon'} {intl l="Editing %title" title="$couponCode"} diff --git a/templates/backOffice/default/export.html b/templates/backOffice/default/export.html new file mode 100644 index 000000000..ca2892000 --- /dev/null +++ b/templates/backOffice/default/export.html @@ -0,0 +1,56 @@ +{extends file="admin-layout.tpl"} + +{block name="page-title"}{intl l='Exports'}{/block} + +{block name="check-resource"}admin.export{/block} +{block name="check-access"}view{/block} + +{block name="main-content"} + + + + + + + {intl l='Home'} + {intl l='Tools'} + {intl l="Exports"} + + + + {module_include location='tools_top'} + + {intl l="Thelia tools"} + + + + + + + + {intl l='Customer export'} + + {module_include location='tools_col1_top'} + + {loop name="auth-export" type="auth" role="ADMIN" resource="admin.export.customer.newsletter" access="VIEW"} + + {intl l="newsletter subscribers"} + + + {/loop} + + {module_include location='tools_col1_bottom'} + + + + + + {module_include location='configuration_bottom'} + + + +{/block} + +{block name="javascript-last-call"} + {module_include location='configuration-js'} +{/block} \ No newline at end of file diff --git a/templates/backOffice/default/tools.html b/templates/backOffice/default/tools.html new file mode 100644 index 000000000..ca41db425 --- /dev/null +++ b/templates/backOffice/default/tools.html @@ -0,0 +1,55 @@ +{extends file="admin-layout.tpl"} + +{block name="page-title"}{intl l='Tools'}{/block} + +{block name="check-resource"}admin.tools{/block} +{block name="check-access"}view{/block} + +{block name="main-content"} + + + + + {module_include location='tools_top'} + + {intl l="Thelia tools"} + + + + + + + + {intl l='General tools'} + + {module_include location='tools_col1_top'} + + {loop name="auth-coupon" type="auth" role="ADMIN" resource="admin.coupon" access="VIEW"} + + {intl l="Coupons"} + + + {/loop} + + {loop name="auth-export" type="auth" role="ADMIN" resource="admin.export" access="VIEW"} + + {intl l="Export"} + + + {/loop} + + {module_include location='tools_col1_bottom'} + + + + + + {module_include location='configuration_bottom'} + + + +{/block} + +{block name="javascript-last-call"} + {module_include location='configuration-js'} +{/block} \ No newline at end of file