Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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',
1441 ariadna 53
        'description'   => 'Return a list of attempts for the given quiz and user. ' .
54
            '(Deprecated in favour of mod_quiz_get_user_quiz_attempts).',
1 efrain 55
        'type'          => 'read',
56
        'capabilities'  => 'mod/quiz:view',
57
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
58
    ],
59
 
1441 ariadna 60
    'mod_quiz_get_user_quiz_attempts' => [
61
        'classname'     => 'mod_quiz_external',
62
        'methodname'    => 'get_user_quiz_attempts',
63
        'description'   => 'Return a list of attempts for the given quiz and user.',
64
        'type'          => 'read',
65
        'capabilities'  => 'mod/quiz:view',
66
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE],
67
    ],
68
 
1 efrain 69
    'mod_quiz_get_user_best_grade' => [
70
        'classname'     => 'mod_quiz_external',
71
        'methodname'    => 'get_user_best_grade',
72
        'description'   => 'Get the best current grade for the given user on a quiz.',
73
        'type'          => 'read',
74
        'capabilities'  => 'mod/quiz:view',
75
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
76
    ],
77
 
78
    'mod_quiz_get_combined_review_options' => [
79
        'classname'     => 'mod_quiz_external',
80
        'methodname'    => 'get_combined_review_options',
81
        'description'   => 'Combines the review options from a number of different quiz attempts.',
82
        'type'          => 'read',
83
        'capabilities'  => 'mod/quiz:view',
84
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
85
    ],
86
 
87
    'mod_quiz_start_attempt' => [
88
        'classname'     => 'mod_quiz_external',
89
        'methodname'    => 'start_attempt',
90
        'description'   => 'Starts a new attempt at a quiz.',
91
        'type'          => 'write',
92
        'capabilities'  => 'mod/quiz:attempt',
93
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
94
    ],
95
 
96
    'mod_quiz_get_attempt_data' => [
97
        'classname'     => 'mod_quiz_external',
98
        'methodname'    => 'get_attempt_data',
99
        'description'   => 'Returns information for the given attempt page for a quiz attempt in progress.',
100
        'type'          => 'read',
101
        'capabilities'  => 'mod/quiz:attempt',
102
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
103
    ],
104
 
105
    'mod_quiz_get_attempt_summary' => [
106
        'classname'     => 'mod_quiz_external',
107
        'methodname'    => 'get_attempt_summary',
108
        'description'   => 'Returns a summary of a quiz attempt before it is submitted.',
109
        'type'          => 'read',
110
        'capabilities'  => 'mod/quiz:attempt',
111
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
112
    ],
113
 
114
    'mod_quiz_save_attempt' => [
115
        'classname'     => 'mod_quiz_external',
116
        'methodname'    => 'save_attempt',
117
        'description'   => 'Processes save requests during the quiz.
118
                            This function is intended for the quiz auto-save feature.',
119
        'type'          => 'write',
120
        'capabilities'  => 'mod/quiz:attempt',
121
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
122
    ],
123
 
124
    'mod_quiz_process_attempt' => [
125
        'classname'     => 'mod_quiz_external',
126
        'methodname'    => 'process_attempt',
127
        'description'   => 'Process responses during an attempt at a quiz and also deals with attempts finishing.',
128
        'type'          => 'write',
129
        'capabilities'  => 'mod/quiz:attempt',
130
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
131
    ],
132
 
133
    'mod_quiz_get_attempt_review' => [
134
        'classname'     => 'mod_quiz_external',
135
        'methodname'    => 'get_attempt_review',
136
        'description'   => 'Returns review information for the given finished attempt, can be used by users or teachers.',
137
        'type'          => 'read',
138
        'capabilities'  => 'mod/quiz:reviewmyattempts',
139
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
140
    ],
141
 
142
    'mod_quiz_view_attempt' => [
143
        'classname'     => 'mod_quiz_external',
144
        'methodname'    => 'view_attempt',
145
        'description'   => 'Trigger the attempt viewed event.',
146
        'type'          => 'write',
147
        'capabilities'  => 'mod/quiz:attempt',
148
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
149
    ],
150
 
151
    'mod_quiz_view_attempt_summary' => [
152
        'classname'     => 'mod_quiz_external',
153
        'methodname'    => 'view_attempt_summary',
154
        'description'   => 'Trigger the attempt summary viewed event.',
155
        'type'          => 'write',
156
        'capabilities'  => 'mod/quiz:attempt',
157
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
158
    ],
159
 
160
    'mod_quiz_view_attempt_review' => [
161
        'classname'     => 'mod_quiz_external',
162
        'methodname'    => 'view_attempt_review',
163
        'description'   => 'Trigger the attempt reviewed event.',
164
        'type'          => 'write',
165
        'capabilities'  => 'mod/quiz:reviewmyattempts',
166
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
167
    ],
168
 
169
    'mod_quiz_get_quiz_feedback_for_grade' => [
170
        'classname'     => 'mod_quiz_external',
171
        'methodname'    => 'get_quiz_feedback_for_grade',
172
        'description'   => 'Get the feedback text that should be show to a student who got the given grade in the given quiz.',
173
        'type'          => 'read',
174
        'capabilities'  => 'mod/quiz:view',
175
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
176
    ],
177
 
178
    'mod_quiz_get_quiz_access_information' => [
179
        'classname'     => 'mod_quiz_external',
180
        'methodname'    => 'get_quiz_access_information',
181
        'description'   => 'Return access information for a given quiz.',
182
        'type'          => 'read',
183
        'capabilities'  => 'mod/quiz:view',
184
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
185
    ],
186
 
187
    'mod_quiz_get_attempt_access_information' => [
188
        'classname'     => 'mod_quiz_external',
189
        'methodname'    => 'get_attempt_access_information',
190
        'description'   => 'Return access information for a given attempt in a quiz.',
191
        'type'          => 'read',
192
        'capabilities'  => 'mod/quiz:view',
193
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
194
    ],
195
 
196
    'mod_quiz_get_quiz_required_qtypes' => [
197
        'classname'     => 'mod_quiz_external',
198
        'methodname'    => 'get_quiz_required_qtypes',
199
        'description'   => 'Return the potential question types that would be required for a given quiz.',
200
        'type'          => 'read',
201
        'capabilities'  => 'mod/quiz:view',
202
        'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
203
    ],
204
 
205
    'mod_quiz_set_question_version' => [
206
        'classname'     => 'mod_quiz\external\submit_question_version',
207
        'description'   => 'Set the version of question that would be required for a given quiz.',
208
        'type'          => 'write',
209
        'capabilities'  => 'mod/quiz:view',
210
        'ajax'          => true,
211
    ],
212
 
213
    'mod_quiz_reopen_attempt' => [
214
        'classname' => 'mod_quiz\external\reopen_attempt',
215
        'description' => 'Re-open an attempt that is currently in the never submitted state.',
216
        'type' => 'write',
217
        'capabilities' => 'mod/quiz:reopenattempts',
218
        'ajax' => true,
219
    ],
220
 
221
    'mod_quiz_get_reopen_attempt_confirmation' => [
222
        'classname' => 'mod_quiz\external\get_reopen_attempt_confirmation',
223
        'description' => 'Verify it is OK to re-open a given quiz attempt, and if so, return a suitable confirmation message.',
224
        'type' => 'read',
225
        'capabilities' => 'mod/quiz:reopenattempts',
226
        'ajax' => true,
227
    ],
228
 
229
    'mod_quiz_add_random_questions' => [
230
        'classname'     => 'mod_quiz\external\add_random_questions',
231
        'description'   => 'Add a number of random questions to a quiz.',
232
        'type'          => 'write',
233
        'capabilities'  => 'mod/quiz:manage',
234
        'ajax'          => true,
235
    ],
236
 
237
    'mod_quiz_update_filter_condition' => [
238
        'classname'     => 'mod_quiz\external\update_filter_condition',
239
        'description'   => 'Update filter condition for a random question slot.',
240
        'type'          => 'write',
241
        'capabilities'  => 'mod/quiz:manage',
242
        'ajax'          => true,
243
    ],
244
 
245
    'mod_quiz_save_overrides' => [
246
        'classname'     => 'mod_quiz\external\save_overrides',
247
        'description'   => 'Update or insert quiz overrides',
248
        'type'          => 'write',
249
        'capabilities'  => 'mod/quiz:manageoverrides',
250
        'ajax'          => true,
251
    ],
252
 
253
    'mod_quiz_delete_overrides' => [
254
        'classname'     => 'mod_quiz\external\delete_overrides',
255
        'description'   => 'Delete quiz overrides',
256
        'type'          => 'write',
257
        'capabilities'  => 'mod/quiz:manageoverrides',
258
        'ajax'          => true,
259
    ],
260
 
261
    'mod_quiz_get_overrides' => [
262
        'classname'     => 'mod_quiz\external\get_overrides',
263
        'description'   => 'Get quiz overrides',
264
        'type'          => 'read',
265
        'capabilities'  => 'mod/quiz:manageoverrides',
266
        'ajax'          => true,
267
    ],
268
 
269
    'mod_quiz_create_grade_items' => [
270
        'classname' => 'mod_quiz\external\create_grade_items',
271
        'description' => 'Create quiz grade items. All grade items must belong to the same quiz.',
272
        'type' => 'write',
273
        'capabilities' => 'mod/quiz:manage',
274
        'ajax' => true,
275
    ],
276
 
277
    'mod_quiz_delete_grade_items' => [
278
        'classname' => 'mod_quiz\external\delete_grade_items',
279
        'description' => 'Delete quiz grade items. All grade items must belong to the same quiz.',
280
        'type' => 'write',
281
        'capabilities' => 'mod/quiz:manage',
282
        'ajax' => true,
283
    ],
284
 
285
    'mod_quiz_update_grade_items' => [
286
        'classname' => 'mod_quiz\external\update_grade_items',
287
        'description' => 'Update quiz grade items. All grade items must belong to the same quiz.',
288
        'type' => 'write',
289
        'capabilities' => 'mod/quiz:manage',
290
        'ajax' => true,
291
    ],
292
 
293
    'mod_quiz_update_slots' => [
294
        'classname' => 'mod_quiz\external\update_slots',
295
        'description' => 'Update the properties of slots in a quiz. All slots must belong to the same quiz.',
296
        'type' => 'write',
297
        'capabilities' => 'mod/quiz:manage',
298
        'ajax' => true,
299
    ],
300
 
301
    'mod_quiz_get_edit_grading_page_data' => [
302
        'classname' => 'mod_quiz\external\get_edit_grading_page_data',
303
        'description' => 'Get the data required to re-render the Quiz grading setup page',
304
        'type' => 'read',
305
        'capabilities' => 'mod/quiz:manage',
306
        'ajax' => true,
307
    ],
308
 
309
    'mod_quiz_create_grade_item_per_section' => [
310
        'classname' => 'mod_quiz\external\create_grade_item_per_section',
311
        'description' => 'For a quiz with no grade items yet, create a grade item for each section, with the questions in that section assigned.',
312
        'type' => 'write',
313
        'capabilities' => 'mod/quiz:manage',
314
        'ajax' => true,
315
    ],
316
];