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\Extension\Core\Type\TextType; |
15
|
|
|
use Symfony\Component\Form\Extension\Core\Type\TimezoneType; |
16
|
|
|
use Symfony\Component\Form\Extension\Core\Type\UrlType; |
17
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
18
|
|
|
|
19
|
|
|
class PlatformSettingsSchema extends AbstractSettingsSchema |
20
|
|
|
{ |
21
|
|
|
private static array $tabs = [ |
22
|
|
|
'MenuCampusHomepage' => 'campus_homepage', |
23
|
|
|
'MenuMyCourses' => 'my_courses', |
24
|
|
|
'MenuReporting' => 'reporting', |
25
|
|
|
'MenuPlatformAdministration' => 'platform_administration', |
26
|
|
|
'MenuMyAgenda' => 'my_agenda', |
27
|
|
|
'MenuSocial' => 'social', |
28
|
|
|
'MenuVideoConference' => 'videoconference', |
29
|
|
|
'MenuDiagnostics' => 'diagnostics', |
30
|
|
|
'MenuCatalogue' => 'catalogue', |
31
|
|
|
'MenuSessionAdmin' => 'session_admin', |
32
|
|
|
'TopbarCertificate' => 'topbar_certificate', |
33
|
|
|
'TopbarSkills' => 'topbar_skills', |
34
|
|
|
]; |
35
|
|
|
|
36
|
|
|
public function buildSettings(AbstractSettingsBuilder $builder): void |
37
|
|
|
{ |
38
|
|
|
$builder |
39
|
|
|
->setDefaults( |
40
|
|
|
[ |
41
|
|
|
'institution' => 'Chamilo.org', |
42
|
|
|
'institution_url' => 'http://www.chamilo.org', |
43
|
|
|
'institution_address' => '', |
44
|
|
|
'site_name' => 'Chamilo site', |
45
|
|
|
'timezone' => 'Europe/Paris', |
46
|
|
|
'cookie_warning' => 'false', |
47
|
|
|
'donotlistcampus' => 'false', |
48
|
|
|
'use_custom_pages' => 'false', |
49
|
|
|
'allow_my_files' => 'true', |
50
|
|
|
'registered' => 'false', |
51
|
|
|
'server_type' => 'prod', |
52
|
|
|
'show_tabs' => array_values(array_diff(self::$tabs, ['videoconference', 'diagnostics'])), |
53
|
|
|
'chamilo_database_version' => '2.0.0', |
54
|
|
|
'unoconv_binaries' => '/usr/bin/unoconv', |
55
|
|
|
'pdf_img_dpi' => '96', |
56
|
|
|
'hosting_limit_users_per_course' => '0', |
57
|
|
|
'generate_random_login' => 'false', |
58
|
|
|
'timepicker_increment' => '5', |
59
|
|
|
'user_status_show_options_enabled' => 'false', |
60
|
|
|
'user_status_show_option' => '', |
61
|
|
|
'platform_logo_url' => 'https://chamilo.org', |
62
|
|
|
'use_career_external_id_as_identifier_in_diagrams' => 'false', |
63
|
|
|
'portfolio_advanced_sharing' => 'false', |
64
|
|
|
'notification_event' => 'false', |
65
|
|
|
'push_notification_settings' => '', |
66
|
|
|
'hosting_limit_identical_email' => '0', |
67
|
|
|
'session_admin_access_to_all_users_on_all_urls' => 'false', |
68
|
|
|
'use_virtual_keyboard' => 'false', |
69
|
|
|
'disable_copy_paste' => 'false', |
70
|
|
|
] |
71
|
|
|
) |
72
|
|
|
->setTransformer( |
73
|
|
|
'show_tabs', |
74
|
|
|
new ArrayToIdentifierTransformer() |
75
|
|
|
) |
76
|
|
|
; |
77
|
|
|
|
78
|
|
|
$allowedTypes = [ |
79
|
|
|
'institution' => ['string'], |
80
|
|
|
'institution_url' => ['string'], |
81
|
|
|
'site_name' => ['string'], |
82
|
|
|
'timezone' => ['string'], |
83
|
|
|
'show_tabs' => ['array', 'null'], |
84
|
|
|
]; |
85
|
|
|
|
86
|
|
|
$this->setMultipleAllowedTypes($allowedTypes, $builder); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function buildForm(FormBuilderInterface $builder): void |
90
|
|
|
{ |
91
|
|
|
$builder |
92
|
|
|
->add('institution') |
93
|
|
|
->add('institution_url', UrlType::class) |
94
|
|
|
->add('institution_address') |
95
|
|
|
->add('site_name') |
96
|
|
|
->add('timezone', TimezoneType::class) |
97
|
|
|
->add('cookie_warning', YesNoType::class) |
98
|
|
|
->add('donotlistcampus', YesNoType::class) |
99
|
|
|
->add('use_custom_pages', YesNoType::class) |
100
|
|
|
->add('allow_my_files', YesNoType::class) |
101
|
|
|
->add( |
102
|
|
|
'server_type', |
103
|
|
|
ChoiceType::class, |
104
|
|
|
[ |
105
|
|
|
'label' => 'Server Type', |
106
|
|
|
'choices' => [ |
107
|
|
|
'Production' => 'prod', |
108
|
|
|
'Validation' => 'validation', |
109
|
|
|
'Test/Development' => 'test', |
110
|
|
|
], |
111
|
|
|
] |
112
|
|
|
) |
113
|
|
|
->add( |
114
|
|
|
'show_tabs', |
115
|
|
|
ChoiceType::class, |
116
|
|
|
[ |
117
|
|
|
'multiple' => true, |
118
|
|
|
'choices' => self::$tabs, |
119
|
|
|
], |
120
|
|
|
) |
121
|
|
|
->add('unoconv_binaries', TextType::class) |
122
|
|
|
->add('pdf_img_dpi', TextType::class) |
123
|
|
|
->add('hosting_limit_users_per_course', TextType::class) |
124
|
|
|
->add('generate_random_login', YesNoType::class) |
125
|
|
|
->add('timepicker_increment', TextType::class) |
126
|
|
|
->add('user_status_show_options_enabled', YesNoType::class) |
127
|
|
|
->add('user_status_show_option', TextareaType::class) |
128
|
|
|
->add('platform_logo_url', TextType::class) |
129
|
|
|
->add('use_career_external_id_as_identifier_in_diagrams', YesNoType::class) |
130
|
|
|
->add('portfolio_advanced_sharing', TextType::class) |
131
|
|
|
->add('notification_event', YesNoType::class) |
132
|
|
|
->add('push_notification_settings', TextareaType::class) |
133
|
|
|
->add( |
134
|
|
|
'hosting_limit_identical_email', |
135
|
|
|
TextType::class, |
136
|
|
|
[ |
137
|
|
|
'label' => 'Limit identical emails', |
138
|
|
|
'help' => 'Maximum number of accounts allowed with the same email. Set to 0 to disable limit.', |
139
|
|
|
] |
140
|
|
|
) |
141
|
|
|
->add('session_admin_access_to_all_users_on_all_urls', YesNoType::class) |
142
|
|
|
->add('use_virtual_keyboard', YesNoType::class) |
143
|
|
|
->add('disable_copy_paste', YesNoType::class) |
144
|
|
|
; |
145
|
|
|
|
146
|
|
|
$this->updateFormFieldsFromSettingsInfo($builder); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
public function getHiddenSettings(): array |
150
|
|
|
{ |
151
|
|
|
return [ |
152
|
|
|
'registered', |
153
|
|
|
'chamilo_database_version', |
154
|
|
|
]; |
155
|
|
|
} |
156
|
|
|
} |
157
|
|
|
|