1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Quiz external functions and service definitions.
|
|
|
19 |
*
|
|
|
20 |
* @package mod_quiz
|
|
|
21 |
* @category external
|
|
|
22 |
* @copyright 2016 Juan Leyva <juan@moodle.com>
|
|
|
23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
24 |
* @since Moodle 3.1
|
|
|
25 |
*/
|
|
|
26 |
|
|
|
27 |
defined('MOODLE_INTERNAL') || die;
|
|
|
28 |
|
|
|
29 |
$functions = [
|
|
|
30 |
|
|
|
31 |
'mod_quiz_get_quizzes_by_courses' => [
|
|
|
32 |
'classname' => 'mod_quiz_external',
|
|
|
33 |
'methodname' => 'get_quizzes_by_courses',
|
|
|
34 |
'description' => 'Returns a list of quizzes in a provided list of courses,
|
|
|
35 |
if no list is provided all quizzes that the user can view will be returned.',
|
|
|
36 |
'type' => 'read',
|
|
|
37 |
'capabilities' => 'mod/quiz:view',
|
|
|
38 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
39 |
],
|
|
|
40 |
|
|
|
41 |
'mod_quiz_view_quiz' => [
|
|
|
42 |
'classname' => 'mod_quiz_external',
|
|
|
43 |
'methodname' => 'view_quiz',
|
|
|
44 |
'description' => 'Trigger the course module viewed event and update the module completion status.',
|
|
|
45 |
'type' => 'write',
|
|
|
46 |
'capabilities' => 'mod/quiz:view',
|
|
|
47 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
48 |
],
|
|
|
49 |
|
|
|
50 |
'mod_quiz_get_user_attempts' => [
|
|
|
51 |
'classname' => 'mod_quiz_external',
|
|
|
52 |
'methodname' => 'get_user_attempts',
|
|
|
53 |
'description' => 'Return a list of attempts for the given quiz and user.',
|
|
|
54 |
'type' => 'read',
|
|
|
55 |
'capabilities' => 'mod/quiz:view',
|
|
|
56 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
57 |
],
|
|
|
58 |
|
|
|
59 |
'mod_quiz_get_user_best_grade' => [
|
|
|
60 |
'classname' => 'mod_quiz_external',
|
|
|
61 |
'methodname' => 'get_user_best_grade',
|
|
|
62 |
'description' => 'Get the best current grade for the given user on a quiz.',
|
|
|
63 |
'type' => 'read',
|
|
|
64 |
'capabilities' => 'mod/quiz:view',
|
|
|
65 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
66 |
],
|
|
|
67 |
|
|
|
68 |
'mod_quiz_get_combined_review_options' => [
|
|
|
69 |
'classname' => 'mod_quiz_external',
|
|
|
70 |
'methodname' => 'get_combined_review_options',
|
|
|
71 |
'description' => 'Combines the review options from a number of different quiz attempts.',
|
|
|
72 |
'type' => 'read',
|
|
|
73 |
'capabilities' => 'mod/quiz:view',
|
|
|
74 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
75 |
],
|
|
|
76 |
|
|
|
77 |
'mod_quiz_start_attempt' => [
|
|
|
78 |
'classname' => 'mod_quiz_external',
|
|
|
79 |
'methodname' => 'start_attempt',
|
|
|
80 |
'description' => 'Starts a new attempt at a quiz.',
|
|
|
81 |
'type' => 'write',
|
|
|
82 |
'capabilities' => 'mod/quiz:attempt',
|
|
|
83 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
84 |
],
|
|
|
85 |
|
|
|
86 |
'mod_quiz_get_attempt_data' => [
|
|
|
87 |
'classname' => 'mod_quiz_external',
|
|
|
88 |
'methodname' => 'get_attempt_data',
|
|
|
89 |
'description' => 'Returns information for the given attempt page for a quiz attempt in progress.',
|
|
|
90 |
'type' => 'read',
|
|
|
91 |
'capabilities' => 'mod/quiz:attempt',
|
|
|
92 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
93 |
],
|
|
|
94 |
|
|
|
95 |
'mod_quiz_get_attempt_summary' => [
|
|
|
96 |
'classname' => 'mod_quiz_external',
|
|
|
97 |
'methodname' => 'get_attempt_summary',
|
|
|
98 |
'description' => 'Returns a summary of a quiz attempt before it is submitted.',
|
|
|
99 |
'type' => 'read',
|
|
|
100 |
'capabilities' => 'mod/quiz:attempt',
|
|
|
101 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
102 |
],
|
|
|
103 |
|
|
|
104 |
'mod_quiz_save_attempt' => [
|
|
|
105 |
'classname' => 'mod_quiz_external',
|
|
|
106 |
'methodname' => 'save_attempt',
|
|
|
107 |
'description' => 'Processes save requests during the quiz.
|
|
|
108 |
This function is intended for the quiz auto-save feature.',
|
|
|
109 |
'type' => 'write',
|
|
|
110 |
'capabilities' => 'mod/quiz:attempt',
|
|
|
111 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
112 |
],
|
|
|
113 |
|
|
|
114 |
'mod_quiz_process_attempt' => [
|
|
|
115 |
'classname' => 'mod_quiz_external',
|
|
|
116 |
'methodname' => 'process_attempt',
|
|
|
117 |
'description' => 'Process responses during an attempt at a quiz and also deals with attempts finishing.',
|
|
|
118 |
'type' => 'write',
|
|
|
119 |
'capabilities' => 'mod/quiz:attempt',
|
|
|
120 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
121 |
],
|
|
|
122 |
|
|
|
123 |
'mod_quiz_get_attempt_review' => [
|
|
|
124 |
'classname' => 'mod_quiz_external',
|
|
|
125 |
'methodname' => 'get_attempt_review',
|
|
|
126 |
'description' => 'Returns review information for the given finished attempt, can be used by users or teachers.',
|
|
|
127 |
'type' => 'read',
|
|
|
128 |
'capabilities' => 'mod/quiz:reviewmyattempts',
|
|
|
129 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
130 |
],
|
|
|
131 |
|
|
|
132 |
'mod_quiz_view_attempt' => [
|
|
|
133 |
'classname' => 'mod_quiz_external',
|
|
|
134 |
'methodname' => 'view_attempt',
|
|
|
135 |
'description' => 'Trigger the attempt viewed event.',
|
|
|
136 |
'type' => 'write',
|
|
|
137 |
'capabilities' => 'mod/quiz:attempt',
|
|
|
138 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
139 |
],
|
|
|
140 |
|
|
|
141 |
'mod_quiz_view_attempt_summary' => [
|
|
|
142 |
'classname' => 'mod_quiz_external',
|
|
|
143 |
'methodname' => 'view_attempt_summary',
|
|
|
144 |
'description' => 'Trigger the attempt summary viewed event.',
|
|
|
145 |
'type' => 'write',
|
|
|
146 |
'capabilities' => 'mod/quiz:attempt',
|
|
|
147 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
148 |
],
|
|
|
149 |
|
|
|
150 |
'mod_quiz_view_attempt_review' => [
|
|
|
151 |
'classname' => 'mod_quiz_external',
|
|
|
152 |
'methodname' => 'view_attempt_review',
|
|
|
153 |
'description' => 'Trigger the attempt reviewed event.',
|
|
|
154 |
'type' => 'write',
|
|
|
155 |
'capabilities' => 'mod/quiz:reviewmyattempts',
|
|
|
156 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
157 |
],
|
|
|
158 |
|
|
|
159 |
'mod_quiz_get_quiz_feedback_for_grade' => [
|
|
|
160 |
'classname' => 'mod_quiz_external',
|
|
|
161 |
'methodname' => 'get_quiz_feedback_for_grade',
|
|
|
162 |
'description' => 'Get the feedback text that should be show to a student who got the given grade in the given quiz.',
|
|
|
163 |
'type' => 'read',
|
|
|
164 |
'capabilities' => 'mod/quiz:view',
|
|
|
165 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
166 |
],
|
|
|
167 |
|
|
|
168 |
'mod_quiz_get_quiz_access_information' => [
|
|
|
169 |
'classname' => 'mod_quiz_external',
|
|
|
170 |
'methodname' => 'get_quiz_access_information',
|
|
|
171 |
'description' => 'Return access information for a given quiz.',
|
|
|
172 |
'type' => 'read',
|
|
|
173 |
'capabilities' => 'mod/quiz:view',
|
|
|
174 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
175 |
],
|
|
|
176 |
|
|
|
177 |
'mod_quiz_get_attempt_access_information' => [
|
|
|
178 |
'classname' => 'mod_quiz_external',
|
|
|
179 |
'methodname' => 'get_attempt_access_information',
|
|
|
180 |
'description' => 'Return access information for a given attempt in a quiz.',
|
|
|
181 |
'type' => 'read',
|
|
|
182 |
'capabilities' => 'mod/quiz:view',
|
|
|
183 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
184 |
],
|
|
|
185 |
|
|
|
186 |
'mod_quiz_get_quiz_required_qtypes' => [
|
|
|
187 |
'classname' => 'mod_quiz_external',
|
|
|
188 |
'methodname' => 'get_quiz_required_qtypes',
|
|
|
189 |
'description' => 'Return the potential question types that would be required for a given quiz.',
|
|
|
190 |
'type' => 'read',
|
|
|
191 |
'capabilities' => 'mod/quiz:view',
|
|
|
192 |
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
|
|
|
193 |
],
|
|
|
194 |
|
|
|
195 |
'mod_quiz_set_question_version' => [
|
|
|
196 |
'classname' => 'mod_quiz\external\submit_question_version',
|
|
|
197 |
'description' => 'Set the version of question that would be required for a given quiz.',
|
|
|
198 |
'type' => 'write',
|
|
|
199 |
'capabilities' => 'mod/quiz:view',
|
|
|
200 |
'ajax' => true,
|
|
|
201 |
],
|
|
|
202 |
|
|
|
203 |
'mod_quiz_reopen_attempt' => [
|
|
|
204 |
'classname' => 'mod_quiz\external\reopen_attempt',
|
|
|
205 |
'description' => 'Re-open an attempt that is currently in the never submitted state.',
|
|
|
206 |
'type' => 'write',
|
|
|
207 |
'capabilities' => 'mod/quiz:reopenattempts',
|
|
|
208 |
'ajax' => true,
|
|
|
209 |
],
|
|
|
210 |
|
|
|
211 |
'mod_quiz_get_reopen_attempt_confirmation' => [
|
|
|
212 |
'classname' => 'mod_quiz\external\get_reopen_attempt_confirmation',
|
|
|
213 |
'description' => 'Verify it is OK to re-open a given quiz attempt, and if so, return a suitable confirmation message.',
|
|
|
214 |
'type' => 'read',
|
|
|
215 |
'capabilities' => 'mod/quiz:reopenattempts',
|
|
|
216 |
'ajax' => true,
|
|
|
217 |
],
|
|
|
218 |
|
|
|
219 |
'mod_quiz_add_random_questions' => [
|
|
|
220 |
'classname' => 'mod_quiz\external\add_random_questions',
|
|
|
221 |
'description' => 'Add a number of random questions to a quiz.',
|
|
|
222 |
'type' => 'write',
|
|
|
223 |
'capabilities' => 'mod/quiz:manage',
|
|
|
224 |
'ajax' => true,
|
|
|
225 |
],
|
|
|
226 |
|
|
|
227 |
'mod_quiz_update_filter_condition' => [
|
|
|
228 |
'classname' => 'mod_quiz\external\update_filter_condition',
|
|
|
229 |
'description' => 'Update filter condition for a random question slot.',
|
|
|
230 |
'type' => 'write',
|
|
|
231 |
'capabilities' => 'mod/quiz:manage',
|
|
|
232 |
'ajax' => true,
|
|
|
233 |
],
|
|
|
234 |
|
|
|
235 |
'mod_quiz_save_overrides' => [
|
|
|
236 |
'classname' => 'mod_quiz\external\save_overrides',
|
|
|
237 |
'description' => 'Update or insert quiz overrides',
|
|
|
238 |
'type' => 'write',
|
|
|
239 |
'capabilities' => 'mod/quiz:manageoverrides',
|
|
|
240 |
'ajax' => true,
|
|
|
241 |
],
|
|
|
242 |
|
|
|
243 |
'mod_quiz_delete_overrides' => [
|
|
|
244 |
'classname' => 'mod_quiz\external\delete_overrides',
|
|
|
245 |
'description' => 'Delete quiz overrides',
|
|
|
246 |
'type' => 'write',
|
|
|
247 |
'capabilities' => 'mod/quiz:manageoverrides',
|
|
|
248 |
'ajax' => true,
|
|
|
249 |
],
|
|
|
250 |
|
|
|
251 |
'mod_quiz_get_overrides' => [
|
|
|
252 |
'classname' => 'mod_quiz\external\get_overrides',
|
|
|
253 |
'description' => 'Get quiz overrides',
|
|
|
254 |
'type' => 'read',
|
|
|
255 |
'capabilities' => 'mod/quiz:manageoverrides',
|
|
|
256 |
'ajax' => true,
|
|
|
257 |
],
|
|
|
258 |
|
|
|
259 |
'mod_quiz_create_grade_items' => [
|
|
|
260 |
'classname' => 'mod_quiz\external\create_grade_items',
|
|
|
261 |
'description' => 'Create quiz grade items. All grade items must belong to the same quiz.',
|
|
|
262 |
'type' => 'write',
|
|
|
263 |
'capabilities' => 'mod/quiz:manage',
|
|
|
264 |
'ajax' => true,
|
|
|
265 |
],
|
|
|
266 |
|
|
|
267 |
'mod_quiz_delete_grade_items' => [
|
|
|
268 |
'classname' => 'mod_quiz\external\delete_grade_items',
|
|
|
269 |
'description' => 'Delete quiz grade items. All grade items must belong to the same quiz.',
|
|
|
270 |
'type' => 'write',
|
|
|
271 |
'capabilities' => 'mod/quiz:manage',
|
|
|
272 |
'ajax' => true,
|
|
|
273 |
],
|
|
|
274 |
|
|
|
275 |
'mod_quiz_update_grade_items' => [
|
|
|
276 |
'classname' => 'mod_quiz\external\update_grade_items',
|
|
|
277 |
'description' => 'Update quiz grade items. All grade items must belong to the same quiz.',
|
|
|
278 |
'type' => 'write',
|
|
|
279 |
'capabilities' => 'mod/quiz:manage',
|
|
|
280 |
'ajax' => true,
|
|
|
281 |
],
|
|
|
282 |
|
|
|
283 |
'mod_quiz_update_slots' => [
|
|
|
284 |
'classname' => 'mod_quiz\external\update_slots',
|
|
|
285 |
'description' => 'Update the properties of slots in a quiz. All slots must belong to the same quiz.',
|
|
|
286 |
'type' => 'write',
|
|
|
287 |
'capabilities' => 'mod/quiz:manage',
|
|
|
288 |
'ajax' => true,
|
|
|
289 |
],
|
|
|
290 |
|
|
|
291 |
'mod_quiz_get_edit_grading_page_data' => [
|
|
|
292 |
'classname' => 'mod_quiz\external\get_edit_grading_page_data',
|
|
|
293 |
'description' => 'Get the data required to re-render the Quiz grading setup page',
|
|
|
294 |
'type' => 'read',
|
|
|
295 |
'capabilities' => 'mod/quiz:manage',
|
|
|
296 |
'ajax' => true,
|
|
|
297 |
],
|
|
|
298 |
|
|
|
299 |
'mod_quiz_create_grade_item_per_section' => [
|
|
|
300 |
'classname' => 'mod_quiz\external\create_grade_item_per_section',
|
|
|
301 |
'description' => 'For a quiz with no grade items yet, create a grade item for each section, with the questions in that section assigned.',
|
|
|
302 |
'type' => 'write',
|
|
|
303 |
'capabilities' => 'mod/quiz:manage',
|
|
|
304 |
'ajax' => true,
|
|
|
305 |
],
|
|
|
306 |
];
|