Merge branch 'MDL-81451-main' of https://github.com/lucaboesch/moodle
[moodle.git] / mod / forum / db / services.php
blob4977e5a46f7b9c4f571aa6d6354300680b040e6a
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 /**
19 * Forum external functions and service definitions.
21 * @package mod_forum
22 * @copyright 2012 Mark Nelson <markn@moodle.com>
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 $functions = array(
28 'mod_forum_get_forums_by_courses' => array(
29 'classname' => 'mod_forum_external',
30 'methodname' => 'get_forums_by_courses',
31 'classpath' => 'mod/forum/externallib.php',
32 'description' => 'Returns a list of forum instances in a provided set of courses, if
33 no courses are provided then all the forum instances the user has access to will be
34 returned.',
35 'type' => 'read',
36 'capabilities' => 'mod/forum:viewdiscussion',
37 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
40 'mod_forum_get_discussion_posts' => array(
41 'classname' => 'mod_forum_external',
42 'methodname' => 'get_discussion_posts',
43 'classpath' => 'mod/forum/externallib.php',
44 'description' => 'Returns a list of forum posts for a discussion.',
45 'type' => 'read',
46 'ajax' => true,
47 'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
48 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
51 'mod_forum_get_forum_discussions' => array(
52 'classname' => 'mod_forum_external',
53 'methodname' => 'get_forum_discussions',
54 'classpath' => 'mod/forum/externallib.php',
55 'description' => 'Returns a list of forum discussions optionally sorted and paginated.',
56 'type' => 'read',
57 'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
58 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
61 'mod_forum_view_forum' => array(
62 'classname' => 'mod_forum_external',
63 'methodname' => 'view_forum',
64 'classpath' => 'mod/forum/externallib.php',
65 'description' => 'Trigger the course module viewed event and update the module completion status.',
66 'type' => 'write',
67 'capabilities' => 'mod/forum:viewdiscussion',
68 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
71 'mod_forum_view_forum_discussion' => array(
72 'classname' => 'mod_forum_external',
73 'methodname' => 'view_forum_discussion',
74 'classpath' => 'mod/forum/externallib.php',
75 'description' => 'Trigger the forum discussion viewed event.',
76 'type' => 'write',
77 'capabilities' => 'mod/forum:viewdiscussion',
78 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
81 'mod_forum_add_discussion_post' => array(
82 'classname' => 'mod_forum_external',
83 'methodname' => 'add_discussion_post',
84 'classpath' => 'mod/forum/externallib.php',
85 'description' => 'Create new posts into an existing discussion.',
86 'type' => 'write',
87 'ajax' => true,
88 'capabilities' => 'mod/forum:replypost',
89 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
92 'mod_forum_add_discussion' => array(
93 'classname' => 'mod_forum_external',
94 'methodname' => 'add_discussion',
95 'classpath' => 'mod/forum/externallib.php',
96 'description' => 'Add a new discussion into an existing forum.',
97 'type' => 'write',
98 'capabilities' => 'mod/forum:startdiscussion',
99 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
102 'mod_forum_can_add_discussion' => array(
103 'classname' => 'mod_forum_external',
104 'methodname' => 'can_add_discussion',
105 'classpath' => 'mod/forum/externallib.php',
106 'description' => 'Check if the current user can add discussions in the given forum (and optionally for the given group).',
107 'type' => 'read',
108 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
111 'mod_forum_get_forum_access_information' => array(
112 'classname' => 'mod_forum_external',
113 'methodname' => 'get_forum_access_information',
114 'description' => 'Return capabilities information for a given forum.',
115 'type' => 'read',
116 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
119 'mod_forum_set_subscription_state' => array(
120 'classname' => 'mod_forum_external',
121 'methodname' => 'set_subscription_state',
122 'classpath' => 'mod/forum/externallib.php',
123 'description' => 'Set the subscription state',
124 'type' => 'write',
125 'ajax' => true,
126 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
129 'mod_forum_set_lock_state' => array(
130 'classname' => 'mod_forum_external',
131 'methodname' => 'set_lock_state',
132 'classpath' => 'mod/forum/externallib.php',
133 'description' => 'Set the lock state for the discussion',
134 'type' => 'write',
135 'ajax' => true,
136 'capabilities' => 'moodle/course:manageactivities',
137 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
140 'mod_forum_toggle_favourite_state' => array(
141 'classname' => 'mod_forum_external',
142 'methodname' => 'toggle_favourite_state',
143 'classpath' => 'mod/forum/externallib.php',
144 'description' => 'Toggle the favourite state',
145 'type' => 'write',
146 'ajax' => true,
147 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
149 'mod_forum_set_pin_state' => array(
150 'classname' => 'mod_forum_external',
151 'methodname' => 'set_pin_state',
152 'classpath' => 'mod/forum/externallib.php',
153 'description' => 'Set the pin state',
154 'type' => 'write',
155 'ajax' => true,
156 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
159 'mod_forum_delete_post' => array(
160 'classname' => 'mod_forum_external',
161 'methodname' => 'delete_post',
162 'classpath' => 'mod/forum/externallib.php',
163 'description' => 'Deletes a post or a discussion completely when the post is the discussion topic.',
164 'type' => 'write',
165 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
168 'mod_forum_get_discussion_posts_by_userid' => array(
169 'classname' => 'mod_forum_external',
170 'methodname' => 'get_discussion_posts_by_userid',
171 'classpath' => 'mod/forum/externallib.php',
172 'description' => 'Returns a list of forum posts for a discussion for a user.',
173 'type' => 'read',
174 'ajax' => true,
175 'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
177 'mod_forum_get_discussion_post' => array(
178 'classname' => 'mod_forum_external',
179 'methodname' => 'get_discussion_post',
180 'classpath' => 'mod/forum/externallib.php',
181 'description' => 'Get a particular discussion post.',
182 'type' => 'read',
183 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
185 'mod_forum_prepare_draft_area_for_post' => array(
186 'classname' => 'mod_forum_external',
187 'methodname' => 'prepare_draft_area_for_post',
188 'classpath' => 'mod/forum/externallib.php',
189 'description' => 'Prepares a draft area for editing a post.',
190 'type' => 'write',
191 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
193 'mod_forum_update_discussion_post' => array(
194 'classname' => 'mod_forum_external',
195 'methodname' => 'update_discussion_post',
196 'classpath' => 'mod/forum/externallib.php',
197 'description' => 'Updates a post or a discussion topic post.',
198 'type' => 'write',
199 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)