Passed
Push — master ( 702f24...55adc1 )
by Yannick
09:28
created

AgendaSettingsSchema::settingArrayHelpValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 49
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 2
nop 1
dl 0
loc 49
rs 9.9666
c 0
b 0
f 0
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 Sylius\Bundle\SettingsBundle\Schema\AbstractSettingsBuilder;
11
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
12
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
13
use Symfony\Component\Form\Extension\Core\Type\TextType;
14
use Symfony\Component\Form\FormBuilderInterface;
15
16
class AgendaSettingsSchema extends AbstractSettingsSchema
17
{
18
    public function buildSettings(AbstractSettingsBuilder $builder): void
19
    {
20
        $builder
21
            ->setDefaults(
22
                [
23
                    'allow_personal_agenda' => 'true',
24
                    'default_calendar_view' => 'month',
25
                    'personal_calendar_show_sessions_occupation' => 'false',
26
                    'personal_agenda_show_all_session_events' => 'false',
27
                    'allow_agenda_edit_for_hrm' => 'false',
28
                    'agenda_legend' => '',
29
                    'agenda_colors' => '',
30
                    'agenda_on_hover_info' => '',
31
                    'agenda_reminders_sender_id' => '0',
32
                    'fullcalendar_settings' => '',
33
                    'allow_careers_in_global_agenda' => 'false',
34
                ]
35
            )
36
        ;
37
38
        $allowedTypes = [
39
            'allow_personal_agenda' => ['string'],
40
            'default_calendar_view' => ['string'],
41
        ];
42
        $this->setMultipleAllowedTypes($allowedTypes, $builder);
43
    }
44
45
    public function buildForm(FormBuilderInterface $builder): void
46
    {
47
        $builder
48
            ->add('allow_personal_agenda', YesNoType::class)
49
            ->add(
50
                'default_calendar_view',
51
                ChoiceType::class,
52
                [
53
                    'choices' => [
54
                        'Month' => 'month',
55
                        'Week' => 'week',
56
                    ],
57
                ]
58
            )
59
            ->add('personal_calendar_show_sessions_occupation', YesNoType::class)
60
            ->add('personal_agenda_show_all_session_events', YesNoType::class)
61
            ->add('allow_agenda_edit_for_hrm', YesNoType::class)
62
            ->add(
63
                'agenda_legend',
64
                TextareaType::class,
65
                [
66
                    'help_html' => true,
67
                ]
68
            )
69
            ->add(
70
                'agenda_colors',
71
                TextareaType::class,
72
                [
73
                    'help_html' => true,
74
                ]
75
            )
76
            ->add(
77
                'agenda_on_hover_info',
78
                TextareaType::class,
79
                [
80
                    'help_html' => true,
81
                ]
82
            )
83
            ->add('agenda_reminders_sender_id', TextType::class)
84
            ->add(
85
                'fullcalendar_settings',
86
                TextareaType::class,
87
                [
88
                    'help_html' => true,
89
                ]
90
            )
91
            ->add('allow_careers_in_global_agenda', YesNoType::class)
92
        ;
93
94
        $this->updateFormFieldsFromSettingsInfo($builder);
95
    }
96
}
97