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\Form\Type\Admin; |
26
|
|
|
|
27
|
|
|
use Symfony\Component\Form\AbstractType; |
28
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
29
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
30
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
31
|
|
|
|
32
|
|
|
class MemberType extends AbstractType |
33
|
|
|
{ |
34
|
|
|
private $config; |
35
|
|
|
|
36
|
663 |
|
public function __construct($config) |
37
|
|
|
{ |
38
|
663 |
|
$this->config = $config; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* {@inheritdoc} |
43
|
|
|
*/ |
44
|
23 |
|
public function buildForm(FormBuilderInterface $builder, array $options) |
45
|
|
|
{ |
46
|
|
|
$builder |
47
|
23 |
|
->add('name', 'text', array( |
48
|
23 |
|
'label' => '名前', |
49
|
|
|
'constraints' => array( |
50
|
23 |
|
new Assert\NotBlank(), |
51
|
23 |
|
new Assert\Length(array('max' => $this->config['stext_len'])), |
52
|
|
|
), |
53
|
|
|
)) |
54
|
23 |
|
->add('department', 'text', array( |
55
|
23 |
|
'required' => false, |
56
|
23 |
|
'label' => '所属', |
57
|
|
|
'constraints' => array( |
58
|
23 |
|
new Assert\NotBlank(), |
59
|
23 |
|
new Assert\Length(array('max' => $this->config['stext_len'])), |
60
|
|
|
), |
61
|
|
|
)) |
62
|
23 |
|
->add('login_id', 'text', array( |
63
|
23 |
|
'label' => 'ログインID', |
64
|
|
|
'constraints' => array( |
65
|
23 |
|
new Assert\NotBlank(), |
66
|
23 |
|
new Assert\Length(array( |
67
|
23 |
|
'min' => $this->config['id_min_len'], |
68
|
23 |
|
'max' => $this->config['id_max_len'], |
69
|
|
|
)), |
70
|
23 |
|
new Assert\Regex(array('pattern' => '/^[[:graph:][:space:]]+$/i')), |
71
|
|
|
), |
72
|
|
|
)) |
73
|
23 |
|
->add('password', 'repeated', array( |
74
|
|
|
// 'type' => 'password', |
|
|
|
|
75
|
|
|
'first_options' => array( |
76
|
|
|
'label' => 'パスワード', |
77
|
23 |
|
), |
78
|
|
|
'second_options' => array( |
79
|
|
|
'label' => 'パスワード(確認)', |
80
|
|
|
), |
81
|
|
|
'constraints' => array( |
82
|
23 |
|
new Assert\NotBlank(), |
83
|
23 |
|
new Assert\Length(array( |
84
|
23 |
|
'min' => $this->config['id_min_len'], |
85
|
23 |
|
'max' => $this->config['id_max_len'], |
86
|
|
|
)), |
87
|
23 |
|
new Assert\Regex(array('pattern' => '/^[[:graph:][:space:]]+$/i')), |
88
|
|
|
), |
89
|
|
|
)) |
90
|
23 |
|
->add('Authority', 'entity', array( |
91
|
23 |
|
'label' => '権限', |
92
|
23 |
|
'class' => 'Eccube\Entity\Master\Authority', |
93
|
|
|
'expanded' => false, |
94
|
|
|
'multiple' => false, |
95
|
23 |
|
'empty_value' => 'form.empty_value', |
96
|
|
|
'constraints' => array( |
97
|
23 |
|
new Assert\NotBlank(), |
98
|
|
|
), |
99
|
|
|
)) |
100
|
23 |
|
->add('Work', 'entity', array( |
101
|
23 |
|
'label' => '稼働/非稼働', |
102
|
23 |
|
'class' => 'Eccube\Entity\Master\Work', |
103
|
|
|
'expanded' => true, |
104
|
|
|
'multiple' => false, |
105
|
|
|
'constraints' => array( |
106
|
23 |
|
new Assert\NotBlank(), |
107
|
|
|
), |
108
|
|
|
)) |
109
|
|
|
; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* {@inheritdoc} |
114
|
|
|
*/ |
115
|
23 |
|
public function setDefaultOptions(OptionsResolverInterface $resolver) |
116
|
|
|
{ |
117
|
23 |
|
$resolver->setDefaults(array( |
118
|
23 |
|
'data_class' => 'Eccube\Entity\Member', |
119
|
|
|
)); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* {@inheritdoc} |
124
|
|
|
*/ |
125
|
663 |
|
public function getName() |
126
|
|
|
{ |
127
|
663 |
|
return 'admin_member'; |
128
|
|
|
} |
129
|
|
|
} |
130
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.