create resource and page for export
This commit is contained in:
@@ -1156,8 +1156,12 @@
|
||||
|
||||
<!-- export management -->
|
||||
|
||||
<route id="export.main" path="/admin/export">
|
||||
<default key="_controller">Thelia\Controller\Admin\ExportController::indexAction</default>
|
||||
</route>
|
||||
|
||||
<route id="export.customer.newsletter" path="/admin/export/customer/newsletter">
|
||||
<default key="_controller">Thelia\Controller\Admin\ExportController::customerNewsletterAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerExportController::NewsletterExportAction</default>
|
||||
</route>
|
||||
|
||||
<!-- The default route, to display a template -->
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
use Thelia\Model\NewsletterQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Class CustomerExportController
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
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();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,11 +35,12 @@ use Thelia\Core\Security\Resource\AdminResources;
|
||||
class ExportController extends BaseAdminController
|
||||
{
|
||||
|
||||
public function customerNewsletterAction()
|
||||
public function indexAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth([AdminResources::EXPORT], [], [AccessManager::VIEW])) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
return $this->render('export');
|
||||
}
|
||||
}
|
||||
@@ -103,5 +103,7 @@ final class AdminResources
|
||||
|
||||
const EXPORT = "admin.export";
|
||||
|
||||
const EXPORT_CUSTOMER_NEWSLETTER = "admin.export.customer.newsletter";
|
||||
|
||||
const TOOLS = "admin.tools";
|
||||
}
|
||||
|
||||
@@ -49,15 +49,6 @@ INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES
|
||||
|
||||
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.configuration.advanced', NOW(), NOW());
|
||||
|
||||
@@ -83,6 +74,25 @@ 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;
|
||||
|
||||
48
templates/backOffice/default/export.html
Normal file
48
templates/backOffice/default/export.html
Normal file
@@ -0,0 +1,48 @@
|
||||
{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"}
|
||||
<div class="configuration">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{module_include location='tools_top'}
|
||||
|
||||
<h2>{intl l="Thelia tools"}</h2>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="menu-list-table general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<caption>{intl l='Customer export'}</caption>
|
||||
|
||||
{module_include location='tools_col1_top'}
|
||||
|
||||
{loop name="auth-export" type="auth" role="ADMIN" resource="admin.export.customer.newsletter" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/export/customer/newsletter'}">{intl l="newsletter subscribers"}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/export/customer/newsletter'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{module_include location='tools_col1_bottom'}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='configuration_bottom'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="javascript-last-call"}
|
||||
{module_include location='configuration-js'}
|
||||
{/block}
|
||||
@@ -24,13 +24,20 @@
|
||||
|
||||
{module_include location='tools_col1_top'}
|
||||
|
||||
{loop name="menu-auth-coupon" type="auth" role="ADMIN" resource="admin.coupon" access="VIEW"}
|
||||
{loop name="auth-coupon" type="auth" role="ADMIN" resource="admin.coupon" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/coupon'}">{intl l="Coupons"}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/coupon'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop name="auth-export" type="auth" role="ADMIN" resource="admin.export" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/export'}">{intl l="Export"}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/export'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{module_include location='tools_col1_bottom'}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user