b6bc6aa242660bdbc3d3c5b8d265d01dd838e5fb
[moodle.git] / mod / lesson / db / services.php
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/>.
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  */
27 defined('MOODLE_INTERNAL') || die;
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 );