1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of EC-CUBE |
4
|
|
|
* |
5
|
|
|
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved. |
6
|
|
|
* |
7
|
|
|
* http://www.lockon.co.jp/ |
8
|
|
|
* |
9
|
|
|
* This program is free software; you can redistribute it and/or |
10
|
|
|
* modify it under the terms of the GNU General Public License |
11
|
|
|
* as published by the Free Software Foundation; either version 2 |
12
|
|
|
* of the License, or (at your option) any later version. |
13
|
|
|
* |
14
|
|
|
* This program is distributed in the hope that it will be useful, |
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17
|
|
|
* GNU General Public License for more details. |
18
|
|
|
* |
19
|
|
|
* You should have received a copy of the GNU General Public License |
20
|
|
|
* along with this program; if not, write to the Free Software |
21
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
namespace Eccube\Controller\Admin\Setting\Shop; |
25
|
|
|
|
26
|
|
|
use Eccube\Application; |
27
|
|
|
use Eccube\Controller\AbstractController; |
28
|
|
|
use Eccube\Event\EccubeEvents; |
29
|
|
|
use Eccube\Event\EventArgs; |
30
|
|
|
use Symfony\Component\HttpFoundation\Request; |
31
|
|
|
|
32
|
|
View Code Duplication |
class CustomerAgreementController extends AbstractController |
33
|
|
|
{ |
34
|
|
|
public $form; |
35
|
|
|
|
36
|
|
|
public function __construct() |
37
|
|
|
{ |
38
|
|
|
} |
39
|
|
|
|
40
|
4 |
|
public function index(Application $app, Request $request) |
41
|
|
|
{ |
42
|
4 |
|
$Help = $app['eccube.repository.help']->get(); |
43
|
|
|
|
44
|
4 |
|
$builder = $app['form.factory'] |
45
|
4 |
|
->createBuilder('customer_agreement', $Help); |
46
|
|
|
|
47
|
4 |
|
$event = new EventArgs( |
48
|
|
|
array( |
49
|
4 |
|
'builder' => $builder, |
50
|
4 |
|
'Help' => $Help, |
51
|
|
|
), |
52
|
|
|
$request |
53
|
|
|
); |
54
|
|
|
|
55
|
4 |
|
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_CUSTOMER_AGREEMENT_INDEX_INITIALIZE, $event); |
56
|
4 |
|
$form = $builder->getForm(); |
57
|
|
|
|
58
|
4 |
|
if ('POST' === $app['request']->getMethod()) { |
59
|
2 |
|
$form->handleRequest($app['request']); |
60
|
2 |
|
if ($form->isValid()) { |
61
|
1 |
|
$Help = $form->getData(); |
62
|
1 |
|
$app['orm.em']->persist($Help); |
63
|
|
|
|
64
|
1 |
|
$app['orm.em']->flush(); |
65
|
|
|
|
66
|
1 |
|
$event = new EventArgs( |
67
|
|
|
array( |
68
|
1 |
|
'form' => $form, |
69
|
1 |
|
'Help' => $Help, |
70
|
|
|
), |
71
|
|
|
$request |
72
|
|
|
); |
73
|
1 |
|
$app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_CUSTOMER_AGREEMENT_INDEX_COMPLETE, $event); |
74
|
|
|
|
75
|
1 |
|
$app->addSuccess('admin.register.complete', 'admin'); |
76
|
1 |
|
return $app->redirect($app->url('admin_setting_shop_customer_agreement')); |
|
|
|
|
77
|
|
|
|
78
|
|
|
} else { |
79
|
1 |
|
$app->addError('admin.register.failed', 'admin'); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
83
|
3 |
|
return $app->render('Setting/Shop/customer_agreement.twig', array( |
84
|
3 |
|
'form' => $form->createView(), |
85
|
|
|
)); |
86
|
|
|
} |
87
|
|
|
} |