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
|
|
|
|
25
|
|
|
namespace Eccube\Controller; |
26
|
|
|
|
27
|
|
|
use Eccube\Application; |
28
|
|
|
use Symfony\Component\HttpFoundation\Request; |
29
|
|
|
|
30
|
|
|
class ContactController |
|
|
|
|
31
|
|
|
{ |
32
|
5 |
|
public function index(Application $app, Request $request) |
|
|
|
|
33
|
|
|
{ |
34
|
|
|
/* @var $builder \Symfony\Component\Form\FormBuilderInterface */ |
35
|
|
|
$builder = $app['form.factory']->createBuilder('contact'); |
36
|
|
|
|
37
|
|
|
/* @var $form \Symfony\Component\Form\FormInterface */ |
38
|
|
|
$form = $builder->getForm(); |
39
|
|
|
|
40
|
|
|
if ($app['security']->isGranted('ROLE_USER')) { |
41
|
|
|
/* @var $user \Eccube\Entity\Customer */ |
42
|
|
|
$user = $app['user']; |
43
|
|
|
$form->setData(array( |
44
|
|
|
'name01' => $user->getName01(), |
45
|
|
|
'name02' => $user->getName02(), |
46
|
|
|
'kana01' => $user->getKana01(), |
47
|
|
|
'kana02' => $user->getKana02(), |
48
|
|
|
'zip01' => $user->getZip01(), |
49
|
|
|
'zip02' => $user->getZip02(), |
50
|
|
|
'pref' => $user->getPref(), |
51
|
|
|
'addr01' => $user->getAddr01(), |
52
|
|
|
'addr02' => $user->getAddr02(), |
53
|
|
|
'tel01' => $user->getTel01(), |
54
|
|
|
'tel02' => $user->getTel02(), |
55
|
|
|
'tel03' => $user->getTel03(), |
56
|
|
|
'email' => $user->getEmail(), |
57
|
|
|
)); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
$form->handleRequest($request); |
61
|
|
|
|
62
|
|
|
if ($form->isSubmitted() && $form->isValid()) { |
63
|
4 |
|
switch ($request->get('mode')) { |
64
|
4 |
View Code Duplication |
case 'confirm': |
|
|
|
|
65
|
|
|
$builder->setAttribute('freeze', true); |
66
|
|
|
$form = $builder->getForm(); |
67
|
|
|
$form->handleRequest($request); |
68
|
|
|
|
69
|
1 |
|
return $app->render('Contact/confirm.twig', array( |
70
|
1 |
|
'form' => $form->createView(), |
71
|
|
|
)); |
72
|
|
|
|
73
|
3 |
|
case 'complete': |
74
|
|
|
// メール送信 |
75
|
|
|
$app['eccube.service.mail']->sendrContactMail($form->getData()); |
76
|
|
|
|
77
|
|
|
return $app->redirect($app->url('contact_complete')); |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|
81
|
1 |
|
return $app->render('Contact/index.twig', array( |
82
|
1 |
|
'form' => $form->createView(), |
83
|
|
|
)); |
84
|
5 |
|
} |
85
|
|
|
|
86
|
1 |
|
public function complete(Application $app) |
|
|
|
|
87
|
|
|
{ |
88
|
|
|
return $app->render('Contact/complete.twig'); |
89
|
1 |
|
} |
90
|
|
|
} |
91
|
|
|
|