10
10
use Chamilo \CoreBundle \Form \Type \IllustrationType ;
11
11
use Chamilo \CoreBundle \Repository \LanguageRepository ;
12
12
use Chamilo \CoreBundle \Settings \SettingsManager ;
13
+ use DateTimeZone ;
13
14
use Symfony \Component \Form \AbstractType ;
14
15
use Symfony \Component \Form \Extension \Core \Type \ChoiceType ;
15
16
use Symfony \Component \Form \Extension \Core \Type \EmailType ;
@@ -31,35 +32,35 @@ public function __construct(
31
32
public function buildForm (FormBuilderInterface $ builder , array $ options ): void
32
33
{
33
34
$ changeableOptions = $ this ->settingsManager ->getSetting ('profile.changeable_options ' , true ) ?? [];
34
- $ visibleOptions = $ this ->settingsManager ->getSetting ('profile.visible_options ' , true ) ?? [];
35
+ $ visibleOptions = $ this ->settingsManager ->getSetting ('profile.visible_options ' , true ) ?? [];
35
36
36
37
$ languages = array_flip ($ this ->languageRepository ->getAllAvailableToArray (true ));
37
38
38
39
$ fieldsMap = [
39
- 'name ' => ['field ' => 'firstname ' , 'type ' => TextType::class, 'label ' => 'Firstname ' ],
40
- 'officialcode ' => ['field ' => 'official_code ' , 'type ' => TextType::class, 'label ' => 'Official Code ' ],
41
- 'email ' => ['field ' => 'email ' , 'type ' => EmailType::class, 'label ' => 'Email ' ],
42
- 'picture ' => [
43
- 'field ' => 'illustration ' ,
44
- 'type ' => IllustrationType::class,
45
- 'label ' => 'Picture ' ,
40
+ 'name ' => ['field ' => 'firstname ' , 'type ' => TextType::class, 'label ' => 'Firstname ' ],
41
+ 'officialcode ' => ['field ' => 'official_code ' , 'type ' => TextType::class, 'label ' => 'Official Code ' ],
42
+ 'email ' => ['field ' => 'email ' , 'type ' => EmailType::class, 'label ' => 'Email ' ],
43
+ 'picture ' => [
44
+ 'field ' => 'illustration ' ,
45
+ 'type ' => IllustrationType::class,
46
+ 'label ' => 'Picture ' ,
46
47
'mapped ' => false ,
47
48
],
48
- 'login ' => ['field ' => 'login ' , 'type ' => TextType::class, 'label ' => 'Login ' ],
49
+ 'login ' => ['field ' => 'login ' , 'type ' => TextType::class, 'label ' => 'Login ' ],
49
50
'password ' => [
50
- 'field ' => 'password ' ,
51
- 'type ' => PasswordType::class,
52
- 'label ' => 'Password ' ,
53
- 'mapped ' => false ,
51
+ 'field ' => 'password ' ,
52
+ 'type ' => PasswordType::class,
53
+ 'label ' => 'Password ' ,
54
+ 'mapped ' => false ,
54
55
'required ' => false ,
55
56
],
56
57
'language ' => [
57
- 'field ' => 'locale ' ,
58
- 'type ' => ChoiceType::class,
59
- 'label ' => 'Language ' ,
60
- 'choices ' => $ languages ,
61
- 'required ' => true ,
62
- 'placeholder ' => null ,
58
+ 'field ' => 'locale ' ,
59
+ 'type ' => ChoiceType::class,
60
+ 'label ' => 'Language ' ,
61
+ 'choices ' => $ languages ,
62
+ 'required ' => true ,
63
+ 'placeholder ' => null ,
63
64
'choice_translation_domain ' => false ,
64
65
],
65
66
'phone ' => ['field ' => 'phone ' , 'type ' => TextType::class, 'label ' => 'Phone Number ' ],
@@ -71,9 +72,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
71
72
$ isEditable = \in_array ($ key , $ changeableOptions , true );
72
73
73
74
$ options = [
74
- 'label ' => $ fieldConfig ['label ' ],
75
+ 'label ' => $ fieldConfig ['label ' ],
75
76
'required ' => $ fieldConfig ['required ' ] ?? false ,
76
- 'mapped ' => $ fieldConfig ['mapped ' ] ?? true ,
77
+ 'mapped ' => $ fieldConfig ['mapped ' ] ?? true ,
77
78
];
78
79
79
80
if (isset ($ fieldConfig ['choices ' ])) {
@@ -95,16 +96,16 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
95
96
}
96
97
97
98
if ('true ' === $ this ->settingsManager ->getSetting ('profile.use_users_timezone ' , true )) {
98
- $ timezones = \ DateTimeZone::listIdentifiers ();
99
+ $ timezones = DateTimeZone::listIdentifiers ();
99
100
sort ($ timezones );
100
101
$ timezoneChoices = array_combine ($ timezones , $ timezones );
101
102
102
103
$ builder ->add (
103
104
'timezone ' ,
104
105
ChoiceType::class,
105
106
[
106
- 'label ' => 'Timezone ' ,
107
- 'choices ' => $ timezoneChoices ,
107
+ 'label ' => 'Timezone ' ,
108
+ 'choices ' => $ timezoneChoices ,
108
109
'required ' => false ,
109
110
'placeholder ' => '' ,
110
111
'choice_translation_domain ' => false ,
0 commit comments