|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
|
6
|
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Settings; |
|
8
|
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Form\Type\YesNoType; |
|
10
|
|
|
use Chamilo\CoreBundle\Transformer\ArrayToIdentifierTransformer; |
|
11
|
|
|
use Sylius\Bundle\SettingsBundle\Schema\AbstractSettingsBuilder; |
|
12
|
|
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; |
|
13
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType; |
|
14
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
|
15
|
|
|
|
|
16
|
|
|
class RegistrationSettingsSchema extends AbstractSettingsSchema |
|
17
|
|
|
{ |
|
18
|
|
|
public function buildSettings(AbstractSettingsBuilder $builder): void |
|
19
|
|
|
{ |
|
20
|
|
|
$builder |
|
21
|
|
|
->setDefaults([ |
|
22
|
|
|
'required_profile_fields' => [], |
|
23
|
|
|
'allow_registration' => 'false', |
|
24
|
|
|
'allow_registration_as_teacher' => 'false', |
|
25
|
|
|
'allow_lostpassword' => 'true', |
|
26
|
|
|
'extendedprofile_registration' => [], |
|
27
|
|
|
'extendedprofile_registrationrequired' => [], |
|
28
|
|
|
'allow_terms_conditions' => 'false', |
|
29
|
|
|
'student_autosubscribe' => '', |
|
30
|
|
|
'teacher_autosubscribe' => '', |
|
31
|
|
|
'drh_autosubscribe' => '', |
|
32
|
|
|
'sessionadmin_autosubscribe' => '', |
|
33
|
|
|
'platform_unsubscribe_allowed' => 'false', |
|
34
|
|
|
'required_extra_fields_in_inscription' => '', |
|
35
|
|
|
'allow_fields_inscription' => '', |
|
36
|
|
|
'send_inscription_msg_to_inbox' => 'false', |
|
37
|
|
|
'redirect_after_login' => '', |
|
38
|
|
|
]) |
|
39
|
|
|
->setTransformer('required_profile_fields', new ArrayToIdentifierTransformer()) |
|
40
|
|
|
->setTransformer('extendedprofile_registration', new ArrayToIdentifierTransformer()) |
|
41
|
|
|
->setTransformer('extendedprofile_registrationrequired', new ArrayToIdentifierTransformer()) |
|
42
|
|
|
; |
|
43
|
|
|
|
|
44
|
|
|
$allowedTypes = [ |
|
45
|
|
|
'required_profile_fields' => ['array'], |
|
46
|
|
|
'extendedprofile_registration' => ['array'], |
|
47
|
|
|
'extendedprofile_registrationrequired' => ['array'], |
|
48
|
|
|
'allow_registration' => ['string'], |
|
49
|
|
|
'allow_registration_as_teacher' => ['string'], |
|
50
|
|
|
'allow_lostpassword' => ['string'], |
|
51
|
|
|
]; |
|
52
|
|
|
$this->setMultipleAllowedTypes($allowedTypes, $builder); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function buildForm(FormBuilderInterface $builder): void |
|
56
|
|
|
{ |
|
57
|
|
|
$extendedProfileOptions = [ |
|
58
|
|
|
'MyCompetences' => 'mycompetences', |
|
59
|
|
|
'MyDiplomas' => 'mydiplomas', |
|
60
|
|
|
'MyTeach' => 'myteach', |
|
61
|
|
|
'MyPersonalOpenArea' => 'mypersonalopenarea', |
|
62
|
|
|
]; |
|
63
|
|
|
|
|
64
|
|
|
$builder |
|
65
|
|
|
->add('required_profile_fields', ChoiceType::class, [ |
|
66
|
|
|
'multiple' => true, |
|
67
|
|
|
'choices' => [ |
|
68
|
|
|
'Official code' => 'officialcode', |
|
69
|
|
|
'E-mail' => 'email', |
|
70
|
|
|
'Language' => 'language', |
|
71
|
|
|
'Phone' => 'phone', |
|
72
|
|
|
], |
|
73
|
|
|
]) |
|
74
|
|
|
->add('allow_registration', ChoiceType::class, [ |
|
75
|
|
|
'choices' => [ |
|
76
|
|
|
'Yes' => 'true', |
|
77
|
|
|
'No' => 'false', |
|
78
|
|
|
'Mail confirmation' => 'confirmation', |
|
79
|
|
|
'Approval' => 'approval', |
|
80
|
|
|
], |
|
81
|
|
|
]) |
|
82
|
|
|
->add('allow_registration_as_teacher', YesNoType::class) |
|
83
|
|
|
->add('allow_lostpassword', YesNoType::class) |
|
84
|
|
|
->add('extendedprofile_registration', ChoiceType::class, [ |
|
85
|
|
|
'multiple' => true, |
|
86
|
|
|
'choices' => $extendedProfileOptions, |
|
87
|
|
|
]) |
|
88
|
|
|
->add('extendedprofile_registrationrequired', ChoiceType::class, [ |
|
89
|
|
|
'multiple' => true, |
|
90
|
|
|
'choices' => $extendedProfileOptions, |
|
91
|
|
|
]) |
|
92
|
|
|
->add('allow_terms_conditions', YesNoType::class) |
|
93
|
|
|
->add('student_autosubscribe') |
|
94
|
|
|
->add('teacher_autosubscribe') |
|
95
|
|
|
->add('drh_autosubscribe') |
|
96
|
|
|
->add('sessionadmin_autosubscribe') |
|
97
|
|
|
->add('platform_unsubscribe_allowed', YesNoType::class) |
|
98
|
|
|
->add('required_extra_fields_in_inscription', TextareaType::class) |
|
99
|
|
|
->add('allow_fields_inscription', TextareaType::class) |
|
100
|
|
|
->add('send_inscription_msg_to_inbox', YesNoType::class) |
|
101
|
|
|
->add('redirect_after_login', TextareaType::class, [ |
|
102
|
|
|
'required' => false, |
|
103
|
|
|
]) |
|
104
|
|
|
; |
|
105
|
|
|
|
|
106
|
|
|
$this->updateFormFieldsFromSettingsInfo($builder); |
|
107
|
|
|
} |
|
108
|
|
|
} |
|
109
|
|
|
|