create resource and page for export

This commit is contained in:
Manuel Raynaud
2014-04-24 17:02:40 +02:00
parent 74e6ce1b46
commit 0deadcd247
7 changed files with 143 additions and 12 deletions

View File

@@ -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 -->

View File

@@ -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();
}
}

View File

@@ -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');
}
}

View File

@@ -103,5 +103,7 @@ final class AdminResources
const EXPORT = "admin.export";
const EXPORT_CUSTOMER_NEWSLETTER = "admin.export.customer.newsletter";
const TOOLS = "admin.tools";
}