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 |
* Lesson external functions and service definitions.
|
|
|
19 |
*
|
|
|
20 |
* @package mod_lesson
|
|
|
21 |
* @category external
|
|
|
22 |
* @copyright 2017 Juan Leyva <juan@moodle.com>
|
|
|
23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
24 |
* @since Moodle 3.3
|
|
|
25 |
*/
|
|
|
26 |
|
|
|
27 |
defined('MOODLE_INTERNAL') || die;
|
|
|
28 |
|
|
|
29 |
$functions = array(
|
|
|
30 |
'mod_lesson_get_lessons_by_courses' => array(
|
|
|
31 |
'classname' => 'mod_lesson_external',
|
|
|
32 |
'methodname' => 'get_lessons_by_courses',
|
|
|
33 |
'description' => 'Returns a list of lessons in a provided list of courses,
|
|
|
34 |
if no list is provided all lessons that the user can view will be returned.',
|
|
|
35 |
'type' => 'read',
|
|
|
36 |
'capabilities' => 'mod/lesson:view',
|
|
|
37 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
|
|
|
38 |
),
|
|
|
39 |
'mod_lesson_get_lesson_access_information' => array(
|
|
|
40 |
'classname' => 'mod_lesson_external',
|
|
|
41 |
'methodname' => 'get_lesson_access_information',
|
|
|
42 |
'description' => 'Return access information for a given lesson.',
|
|
|
43 |
'type' => 'read',
|
|
|
44 |
'capabilities' => 'mod/lesson:view',
|
|
|
45 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
|
|
|
46 |
),
|
|
|
47 |
'mod_lesson_view_lesson' => array(
|
|
|
48 |
'classname' => 'mod_lesson_external',
|
|
|
49 |
'methodname' => 'view_lesson',
|
|
|
50 |
'description' => 'Trigger the course module viewed event and update the module completion status.',
|
|
|
51 |
'type' => 'write',
|
|
|
52 |
'capabilities' => 'mod/lesson:view',
|
|
|
53 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
54 |
),
|
|
|
55 |
'mod_lesson_get_questions_attempts' => array(
|
|
|
56 |
'classname' => 'mod_lesson_external',
|
|
|
57 |
'methodname' => 'get_questions_attempts',
|
|
|
58 |
'description' => 'Return the list of questions attempts in a given lesson.',
|
|
|
59 |
'type' => 'read',
|
|
|
60 |
'capabilities' => 'mod/lesson:view',
|
|
|
61 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
62 |
),
|
|
|
63 |
'mod_lesson_get_user_grade' => array(
|
|
|
64 |
'classname' => 'mod_lesson_external',
|
|
|
65 |
'methodname' => 'get_user_grade',
|
|
|
66 |
'description' => 'Return the final grade in the lesson for the given user.',
|
|
|
67 |
'type' => 'read',
|
|
|
68 |
'capabilities' => 'mod/lesson:view',
|
|
|
69 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
70 |
),
|
|
|
71 |
'mod_lesson_get_user_attempt_grade' => array(
|
|
|
72 |
'classname' => 'mod_lesson_external',
|
|
|
73 |
'methodname' => 'get_user_attempt_grade',
|
|
|
74 |
'description' => 'Return grade information in the attempt for a given user.',
|
|
|
75 |
'type' => 'read',
|
|
|
76 |
'capabilities' => 'mod/lesson:view',
|
|
|
77 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
78 |
),
|
|
|
79 |
'mod_lesson_get_content_pages_viewed' => array(
|
|
|
80 |
'classname' => 'mod_lesson_external',
|
|
|
81 |
'methodname' => 'get_content_pages_viewed',
|
|
|
82 |
'description' => 'Return the list of content pages viewed by a user during a lesson attempt.',
|
|
|
83 |
'type' => 'read',
|
|
|
84 |
'capabilities' => 'mod/lesson:view',
|
|
|
85 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
86 |
),
|
|
|
87 |
'mod_lesson_get_user_timers' => array(
|
|
|
88 |
'classname' => 'mod_lesson_external',
|
|
|
89 |
'methodname' => 'get_user_timers',
|
|
|
90 |
'description' => 'Return the timers in the current lesson for the given user.',
|
|
|
91 |
'type' => 'read',
|
|
|
92 |
'capabilities' => 'mod/lesson:view',
|
|
|
93 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
94 |
),
|
|
|
95 |
'mod_lesson_get_pages' => array(
|
|
|
96 |
'classname' => 'mod_lesson_external',
|
|
|
97 |
'methodname' => 'get_pages',
|
|
|
98 |
'description' => 'Return the list of pages in a lesson (based on the user permissions).',
|
|
|
99 |
'type' => 'read',
|
|
|
100 |
'capabilities' => 'mod/lesson:view',
|
|
|
101 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
102 |
),
|
|
|
103 |
'mod_lesson_launch_attempt' => array(
|
|
|
104 |
'classname' => 'mod_lesson_external',
|
|
|
105 |
'methodname' => 'launch_attempt',
|
|
|
106 |
'description' => 'Starts a new attempt or continues an existing one.',
|
|
|
107 |
'type' => 'write',
|
|
|
108 |
'capabilities' => 'mod/lesson:view',
|
|
|
109 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
110 |
),
|
|
|
111 |
'mod_lesson_get_page_data' => array(
|
|
|
112 |
'classname' => 'mod_lesson_external',
|
|
|
113 |
'methodname' => 'get_page_data',
|
|
|
114 |
'description' => 'Return information of a given page, including its contents.',
|
|
|
115 |
'type' => 'read',
|
|
|
116 |
'capabilities' => 'mod/lesson:view',
|
|
|
117 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
118 |
),
|
|
|
119 |
'mod_lesson_process_page' => array(
|
|
|
120 |
'classname' => 'mod_lesson_external',
|
|
|
121 |
'methodname' => 'process_page',
|
|
|
122 |
'description' => 'Processes page responses.',
|
|
|
123 |
'type' => 'write',
|
|
|
124 |
'capabilities' => 'mod/lesson:view',
|
|
|
125 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
126 |
),
|
|
|
127 |
'mod_lesson_finish_attempt' => array(
|
|
|
128 |
'classname' => 'mod_lesson_external',
|
|
|
129 |
'methodname' => 'finish_attempt',
|
|
|
130 |
'description' => 'Finishes the current attempt.',
|
|
|
131 |
'type' => 'write',
|
|
|
132 |
'capabilities' => 'mod/lesson:view',
|
|
|
133 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
134 |
),
|
|
|
135 |
'mod_lesson_get_attempts_overview' => array(
|
|
|
136 |
'classname' => 'mod_lesson_external',
|
|
|
137 |
'methodname' => 'get_attempts_overview',
|
|
|
138 |
'description' => 'Get a list of all the attempts made by users in a lesson.',
|
|
|
139 |
'type' => 'read',
|
|
|
140 |
'capabilities' => 'mod/lesson:viewreports',
|
|
|
141 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
142 |
),
|
|
|
143 |
'mod_lesson_get_user_attempt' => array(
|
|
|
144 |
'classname' => 'mod_lesson_external',
|
|
|
145 |
'methodname' => 'get_user_attempt',
|
|
|
146 |
'description' => 'Return information about the given user attempt (including answers).',
|
|
|
147 |
'type' => 'read',
|
|
|
148 |
'capabilities' => 'mod/lesson:viewreports',
|
|
|
149 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
150 |
),
|
|
|
151 |
'mod_lesson_get_pages_possible_jumps' => array(
|
|
|
152 |
'classname' => 'mod_lesson_external',
|
|
|
153 |
'methodname' => 'get_pages_possible_jumps',
|
|
|
154 |
'description' => 'Return all the possible jumps for the pages in a given lesson.',
|
|
|
155 |
'type' => 'read',
|
|
|
156 |
'capabilities' => 'mod/lesson:view',
|
|
|
157 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
|
|
|
158 |
),
|
|
|
159 |
'mod_lesson_get_lesson' => array(
|
|
|
160 |
'classname' => 'mod_lesson_external',
|
|
|
161 |
'methodname' => 'get_lesson',
|
|
|
162 |
'description' => 'Return information of a given lesson.',
|
|
|
163 |
'type' => 'read',
|
|
|
164 |
'capabilities' => 'mod/lesson:view',
|
|
|
165 |
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
|
|
|
166 |
),
|
|
|
167 |
);
|