Code Duplication    Length = 96-99 lines in 2 locations

src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestFreeAnswer.php 1 location

@@ 11-109 (lines=99) @@
8
 *
9
 * @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
10
 */
11
class TestFreeAnswer extends Basic
12
{
13
    /**
14
     * Get the toolbar config
15
     * @return array
16
     */
17
    public function getConfig()
18
    {
19
        if (api_get_setting('more_buttons_maximized_mode') != 'true') {
20
            $config['toolbar'] = $this->getNormalToolbar();
21
        } else {
22
            $config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
23
            $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
24
        }
25
26
        $config['fullPage'] = false;
27
28
        $config['extraPlugins'] = 'wordcount';
29
30
        $config['wordcount'] = array(
31
            // Whether or not you want to show the Word Count
32
            'showWordCount' => true,
33
            // Whether or not you want to show the Char Count
34
            'showCharCount' => true,
35
            // Option to limit the characters in the Editor
36
            'charLimit' => 'unlimited',
37
            // Option to limit the words in the Editor
38
            'wordLimit' => 'unlimited'
39
        );
40
41
        //$config['height'] = '200';
42
43
        return $config;
44
    }
45
46
    /**
47
     * Get the toolbar configuration when CKEditor is maximized
48
     * @return array
49
     */
50
    protected function getMaximizedToolbar()
51
    {
52
        return [
53
            ['NewPage', 'Templates', '-', 'Preview', 'Print'],
54
            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
55
            ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
56
            ['Link', 'Unlink', 'Anchor', 'Glossary'],
57
            ['Image', 'Mapping', 'Video', 'Oembed', 'Youtube', 'Flash', 'Audio', 'leaflet', 'Smiley', 'SpecialChar', 'Asciimath', ],
58
            '/',
59
            ['Table', '-', 'CreateDiv'],
60
            ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
61
            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
62
            ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
63
            [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
64
            ['Styles', 'Format', 'Font', 'FontSize'],
65
            ['PageBreak', 'ShowBlocks'],
66
            ['Toolbarswitch']
67
        ];
68
    }
69
70
    /**
71
     * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false
72
     * @return array
73
     */
74
    protected function getNormalToolbar()
75
    {
76
        return [
77
            [
78
                'Maximize',
79
                'Bold',
80
                'Image',
81
                'Link',
82
                'PasteFromWord',
83
                'Audio',
84
                'Table',
85
                'Subscript',
86
                'Superscript',
87
                'ShowBlocks'
88
            ]
89
        ];
90
    }
91
92
    /**
93
     * Get the toolbar configuration when CKEditor is minimized
94
     * @return array
95
     */
96
    protected function getMinimizedToolbar()
97
    {
98
        return [
99
            $this->getNewPageBlock(),
100
            ['Undo', 'Redo'],
101
            ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
102
            ['BulletedList', 'NumberedList', 'HorizontalRule'],
103
            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
104
            ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
105
            ['Toolbarswitch']
106
        ];
107
    }
108
109
}
110

src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestMatching.php 1 location

@@ 11-106 (lines=96) @@
8
 *
9
 * @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
10
 */
11
class TestMatching extends Basic
12
{
13
    /**
14
     * Get the toolbar config
15
     * @return array
16
     */
17
    public function getConfig()
18
    {
19
        if (api_get_setting('more_buttons_maximized_mode') != 'true') {
20
            $config['toolbar'] = $this->getNormalToolbar();
21
        } else {
22
            $config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
23
            $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
24
        }
25
26
        $config['fullPage'] = false;
27
        $config['extraPlugins'] = 'wordcount';
28
        $config['wordcount'] = array(
29
            // Whether or not you want to show the Word Count
30
            'showWordCount' => true,
31
            // Whether or not you want to show the Char Count
32
            'showCharCount' => true,
33
            // Option to limit the characters in the Editor
34
            'charLimit' => 'unlimited',
35
            // Option to limit the words in the Editor
36
            'wordLimit' => 'unlimited'
37
        );
38
39
        //$config['height'] = '200';
40
41
        return $config;
42
    }
43
44
    /**
45
     * Get the toolbar configuration when CKEditor is maximized
46
     * @return array
47
     */
48
    protected function getMaximizedToolbar()
49
    {
50
        return [
51
            ['NewPage', 'Templates', '-', 'Preview', 'Print'],
52
            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'],
53
            ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
54
            ['Link', 'Unlink', 'Anchor', 'Glossary'],
55
            ['Image', 'Mapping', 'Video', 'Oembed', 'Youtube', 'Flash', 'Audio', 'leaflet', 'Smiley', 'SpecialChar', 'Asciimath',],
56
            '/',
57
            ['Table', '-', 'CreateDiv'],
58
            ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
59
            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
60
            ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
61
            [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
62
            ['Styles', 'Format', 'Font', 'FontSize'],
63
            ['PageBreak', 'ShowBlocks'],
64
            ['Toolbarswitch']
65
        ];
66
    }
67
68
    /**
69
     * Get the default toolbar configuration when the setting more_buttons_maximized_mode is false
70
     * @return array
71
     */
72
    protected function getNormalToolbar()
73
    {
74
        return [
75
            [
76
                'Maximize',
77
                'Bold',
78
                'Image',
79
                'Link',
80
                'PasteFromWord',
81
                'Audio',
82
                'Table',
83
                'Subscript',
84
                'Superscript',
85
                'ShowBlocks'
86
            ]
87
        ];
88
    }
89
90
    /**
91
     * Get the toolbar configuration when CKEditor is minimized
92
     * @return array
93
     */
94
    protected function getMinimizedToolbar()
95
    {
96
        return [
97
            $this->getNewPageBlock(),
98
            ['Undo', 'Redo'],
99
            ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath'],
100
            ['BulletedList', 'NumberedList', 'HorizontalRule'],
101
            ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
102
            ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
103
            ['Toolbarswitch']
104
        ];
105
    }
106
}
107