|
1
|
|
|
<?php |
|
2
|
|
|
/* For licensing terms, see /license.txt */ |
|
3
|
|
|
|
|
4
|
|
|
namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* TestFreeAnswer toolbar configuration |
|
8
|
|
|
* |
|
9
|
|
|
* @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar |
|
10
|
|
|
*/ |
|
11
|
|
View Code Duplication |
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
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.