Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 218 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
QtiCategoryPresetProvider | |
0.00% |
0 / 218 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
registerPresets | |
0.00% |
0 / 218 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | |
3 | /** |
4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License |
6 | * as published by the Free Software Foundation; under version 2 |
7 | * of the License (non-upgradable). |
8 | * |
9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write to the Free Software |
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | * |
18 | * Copyright (c) 2024 (original work) Open Assessment Technologies SA; |
19 | */ |
20 | |
21 | namespace oat\taoQtiTest\models; |
22 | |
23 | class QtiCategoryPresetProvider implements TestCategoryPresetProviderInterface |
24 | { |
25 | /** |
26 | * @param TestCategoryPresetProvider $presetService |
27 | * @throws \common_exception_InconsistentData |
28 | */ |
29 | public function registerPresets(TestCategoryPresetProvider $presetService) |
30 | { |
31 | $presetService->register( |
32 | TestCategoryPresetProvider::GROUP_NAVIGATION, |
33 | [ |
34 | TestCategoryPreset::fromArray([ |
35 | 'id' => 'reviewScreen', |
36 | 'label' => __('Enable Review Screen'), |
37 | 'qtiCategory' => 'x-tao-option-reviewScreen', |
38 | 'description' => __('Enable the item review screen / navigator.'), |
39 | 'order' => 100, |
40 | 'pluginId' => 'review' |
41 | ]), |
42 | TestCategoryPreset::fromArray([ |
43 | 'id' => 'markReview', |
44 | 'label' => __('Enable Mark for Review'), |
45 | 'qtiCategory' => 'x-tao-option-markReview', |
46 | 'description' => __('Enable mark for review of items. Requires the Review Screen option.'), |
47 | 'order' => 200, |
48 | 'pluginId' => 'review' |
49 | ]), |
50 | TestCategoryPreset::fromArray([ |
51 | 'id' => 'informational', |
52 | 'label' => __('Informational Item Usage'), |
53 | 'qtiCategory' => 'x-tao-itemusage-informational', |
54 | // phpcs:disable Generic.Files.LineLength |
55 | 'description' => __('Force the item to be considered as informational and not taken into account in (un)answered / flagged counters.'), |
56 | // phpcs:enable Generic.Files.LineLength |
57 | 'order' => 300, |
58 | 'pluginId' => 'review' |
59 | ]), |
60 | TestCategoryPreset::fromArray([ |
61 | 'id' => 'nextSection', |
62 | 'label' => __('Allow Section Skipping'), |
63 | 'qtiCategory' => 'x-tao-option-nextSection', |
64 | 'description' => __('Allow skipping of the current section.'), |
65 | 'order' => 400, |
66 | 'pluginId' => 'nextSection', |
67 | 'featureFlag' => 'next-section' |
68 | ]) |
69 | ] |
70 | ); |
71 | |
72 | $presetService->register( |
73 | TestCategoryPresetProvider::GROUP_WARNING, |
74 | [ |
75 | TestCategoryPreset::fromArray([ |
76 | 'id' => 'endTestWarning', |
77 | 'label' => __('Display End Test Warning'), |
78 | 'qtiCategory' => 'x-tao-option-endTestWarning', |
79 | 'description' => __('Display a warning before the test-taker ends the test.'), |
80 | 'order' => 100, |
81 | 'pluginId' => 'next' |
82 | ]), |
83 | TestCategoryPreset::fromArray([ |
84 | 'id' => 'nextPartWarning', |
85 | 'label' => __('Display Next Part Warning'), |
86 | 'qtiCategory' => 'x-tao-option-nextPartWarning', |
87 | 'description' => __('Display a warning before the test-taker ends the test part.'), |
88 | 'order' => 200, |
89 | 'pluginId' => 'next' |
90 | ]), |
91 | TestCategoryPreset::fromArray([ |
92 | 'id' => 'nextSectionWarning', |
93 | 'label' => __('Display Next Section Warning'), |
94 | 'qtiCategory' => 'x-tao-option-nextSectionWarning', |
95 | // phpcs:disable Generic.Files.LineLength |
96 | 'description' => __('Display a warning before the test-taker skips the section. Requires the Section Skipping option.'), |
97 | // phpcs:enable Generic.Files.LineLength |
98 | 'order' => 300, |
99 | 'pluginId' => 'nextSection' |
100 | ]), |
101 | TestCategoryPreset::fromArray([ |
102 | 'id' => 'noExitTimedSectionWarning', |
103 | 'label' => __('Hide Timed Section Warning'), |
104 | 'qtiCategory' => 'x-tao-option-noExitTimedSectionWarning', |
105 | // phpcs:disable Generic.Files.LineLength |
106 | 'description' => __('Hide the warning automatically displayed when a test-taker exit a timed section.'), |
107 | // phpcs:enable Generic.Files.LineLength |
108 | 'order' => 400, |
109 | 'pluginId' => 'next' |
110 | ]), |
111 | TestCategoryPreset::fromArray([ |
112 | 'id' => 'unansweredWarning', |
113 | 'label' => __('Display Unanswered Warning'), |
114 | 'qtiCategory' => 'x-tao-option-unansweredWarning', |
115 | // phpcs:disable Generic.Files.LineLength |
116 | 'description' => __('Display a warning before the test-taker ends a test part and there are still items left unanswered or marked for review.'), |
117 | // phpcs:enable Generic.Files.LineLength |
118 | 'order' => 500, |
119 | 'pluginId' => 'next' |
120 | ]), |
121 | TestCategoryPreset::fromArray([ |
122 | 'id' => 'noAlertTimeout', |
123 | 'label' => __('Do not show alert on timeout'), |
124 | 'qtiCategory' => 'x-tao-option-noAlertTimeout', |
125 | 'description' => __('Moving to the next item without time limit reached message.'), |
126 | 'order' => 600, |
127 | 'pluginId' => 'next' |
128 | ]), |
129 | ] |
130 | ); |
131 | |
132 | $presetService->register( |
133 | TestCategoryPresetProvider::GROUP_TOOLS, |
134 | [ |
135 | TestCategoryPreset::fromArray([ |
136 | 'id' => 'eliminator', |
137 | 'label' => __('Answer Eliminator'), |
138 | 'qtiCategory' => 'x-tao-option-eliminator', |
139 | // phpcs:disable Generic.Files.LineLength |
140 | 'description' => __('Allow the test-taker to eliminate / strikethrough answers in choice interactions.'), |
141 | // phpcs:enable Generic.Files.LineLength |
142 | 'order' => 100, |
143 | 'pluginId' => 'eliminator' |
144 | ]), |
145 | TestCategoryPreset::fromArray([ |
146 | 'id' => 'answerMasking', |
147 | 'label' => __('Answer Masking'), |
148 | 'qtiCategory' => 'x-tao-option-answerMasking', |
149 | 'description' => __('Allow the test-taker to mask and unmask answers in choice interactions.'), |
150 | 'order' => 200, |
151 | 'pluginId' => 'answerMasking' |
152 | ]), |
153 | TestCategoryPreset::fromArray([ |
154 | 'id' => 'areaMasking', |
155 | 'label' => __('Area Masking'), |
156 | 'qtiCategory' => 'x-tao-option-areaMasking', |
157 | 'description' => __('Allow the test-taker to mask parts of the item with a movable mask.'), |
158 | 'order' => 300, |
159 | 'pluginId' => 'area-masking' |
160 | ]), |
161 | TestCategoryPreset::fromArray([ |
162 | 'id' => 'calculator', |
163 | 'label' => __('Calculator'), |
164 | 'qtiCategory' => 'x-tao-option-calculator', |
165 | 'description' => __('Allow the test-taker to use a basic calculator.'), |
166 | 'order' => 400, |
167 | 'pluginId' => 'calculator' |
168 | ]), |
169 | TestCategoryPreset::fromArray([ |
170 | 'id' => 'calculatorBodmas', |
171 | 'label' => __('Calculator BODMAS'), |
172 | 'qtiCategory' => 'x-tao-option-calculatorBodmas', |
173 | // phpcs:disable Generic.Files.LineLength |
174 | 'description' => __('Allow the test-taker to use a calculator respecting the order of operations (BODMAS).'), |
175 | // phpcs:enable Generic.Files.LineLength |
176 | 'order' => 400, |
177 | 'pluginId' => 'calculator' |
178 | ]), |
179 | TestCategoryPreset::fromArray([ |
180 | 'id' => 'calculatorScientific', |
181 | 'label' => __('Scientific Calculator'), |
182 | 'qtiCategory' => 'x-tao-option-calculator-scientific', |
183 | 'description' => __('Allow the test-taker to use a scientific calculator.'), |
184 | 'order' => 400, |
185 | 'pluginId' => 'calculator' |
186 | ]), |
187 | TestCategoryPreset::fromArray([ |
188 | 'id' => 'highlighter', |
189 | 'label' => __('Highlighter'), |
190 | 'qtiCategory' => 'x-tao-option-highlighter', |
191 | 'description' => __('Allow the test-taker to highlight parts of the item text.'), |
192 | 'order' => 500, |
193 | 'pluginId' => 'highlighter' |
194 | ]), |
195 | TestCategoryPreset::fromArray([ |
196 | 'id' => 'lineReader', |
197 | 'label' => __('Line Reader'), |
198 | 'qtiCategory' => 'x-tao-option-lineReader', |
199 | 'description' => __('Allow the test-taker to visually isolate a line of text.'), |
200 | 'order' => 600, |
201 | 'pluginId' => 'lineReader' |
202 | ]), |
203 | TestCategoryPreset::fromArray([ |
204 | 'id' => 'magnifier', |
205 | 'label' => __('Magnifier'), |
206 | 'qtiCategory' => 'x-tao-option-magnifier', |
207 | 'description' => __('Allow the test-taker to use a movable magnifier tool.'), |
208 | 'order' => 700, |
209 | 'pluginId' => 'magnifier' |
210 | ]), |
211 | TestCategoryPreset::fromArray([ |
212 | 'id' => 'zoom', |
213 | 'label' => __('Zoom'), |
214 | 'qtiCategory' => 'x-tao-option-zoom', |
215 | 'description' => __('Allows Test-taker to zoom in and out the item content.'), |
216 | 'order' => 700, |
217 | 'pluginId' => 'zoom' |
218 | ]), |
219 | TestCategoryPreset::fromArray([ |
220 | 'id' => 'printable', |
221 | 'label' => __('Print Out'), |
222 | 'qtiCategory' => 'x-tao-printable', |
223 | 'description' => __('Allow a Test Taker to print out the item.'), |
224 | 'order' => 700, |
225 | ]), |
226 | TestCategoryPreset::fromArray([ |
227 | 'id' => 'apiptts', |
228 | 'label' => __('APIP Text To Speech'), |
229 | 'qtiCategory' => 'x-tao-option-apiptts', |
230 | // phpcs:disable Generic.Files.LineLength |
231 | 'description' => __('Allow Test-taker to playback media files associated according to APIP protocol to item content.'), |
232 | // phpcs:enable Generic.Files.LineLength |
233 | 'order' => 900, |
234 | 'pluginId' => 'apiptts' |
235 | ]), |
236 | TestCategoryPreset::fromArray([ |
237 | 'id' => 'textToSpeech', |
238 | 'label' => __('Text To Speech'), |
239 | 'qtiCategory' => 'x-tao-option-tts', |
240 | // phpcs:disable Generic.Files.LineLength |
241 | 'description' => __('Accessibility tool that enables Test Taker to have the item content read aloud.'), |
242 | // phpcs:enable Generic.Files.LineLength |
243 | 'order' => 950, |
244 | 'featureFlag' => 'enable-read-aloud-text-to-speech' |
245 | ]), |
246 | ] |
247 | ); |
248 | |
249 | //TAO-7239, register new feature category only if it is enabled in config |
250 | /** @var \common_ext_ExtensionsManager $tt */ |
251 | $extManager = $presetService->getServiceLocator()->get(\common_ext_ExtensionsManager::SERVICE_ID); |
252 | $testRunnerConfig = $extManager->getExtensionById('taoQtiTest')->getConfig('testRunner'); |
253 | |
254 | $isSkipaheadEnabled = isset($testRunnerConfig['test-taker-review-skipahead']) |
255 | && $testRunnerConfig['test-taker-review-skipahead']; |
256 | if ($isSkipaheadEnabled) { |
257 | $presetService->register( |
258 | TestCategoryPresetProvider::GROUP_NAVIGATION, |
259 | [ |
260 | TestCategoryPreset::fromArray([ |
261 | 'id' => 'skipAhead', |
262 | 'label' => __('Enable Skipping Ahead'), |
263 | 'qtiCategory' => 'x-tao-option-review-skipahead', |
264 | // phpcs:disable Generic.Files.LineLength |
265 | 'description' => __('Enables skipping to items within this section. Requires the review screen option.'), |
266 | // phpcs:enable Generic.Files.LineLength |
267 | 'order' => 250, |
268 | 'pluginId' => 'review', |
269 | 'featureFlag' => 'skip-ahead' |
270 | ]), |
271 | ] |
272 | ); |
273 | } |
274 | } |
275 | } |