Merge branch 'MDL-65017-master' of git://github.com/jleyva/moodle
[moodle.git] / mod / forum / db / services.php
CommitLineData
2b9fe87d
MN
1<?php
2
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.
14//
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/>.
17
18/**
19 * Forum external functions and service definitions.
20 *
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
24 */
25
26$functions = array(
27
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',
0ca559a1
JL
36 'capabilities' => 'mod/forum:viewdiscussion',
37 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
a9a0cb69
MN
38 ),
39
bc4c7337
AN
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 'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
47 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
48 ),
49
e2ede426
JL
50 'mod_forum_get_forum_discussion_posts' => array(
51 'classname' => 'mod_forum_external',
52 'methodname' => 'get_forum_discussion_posts',
53 'classpath' => 'mod/forum/externallib.php',
54 'description' => 'Returns a list of forum posts for a discussion.',
55 'type' => 'read',
0ca559a1
JL
56 'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
57 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
2ce8934b
JL
58 ),
59
60 'mod_forum_get_forum_discussions_paginated' => array(
61 'classname' => 'mod_forum_external',
62 'methodname' => 'get_forum_discussions_paginated',
63 'classpath' => 'mod/forum/externallib.php',
1a9c60e9
MG
64 'description' => '** DEPRECATED ** Please do not call this function any more.
65 Returns a list of forum discussions optionally sorted and paginated.',
66 'type' => 'read',
67 'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
68 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
69 ),
70
71 'mod_forum_get_forum_discussions' => array(
72 'classname' => 'mod_forum_external',
73 'methodname' => 'get_forum_discussions',
74 'classpath' => 'mod/forum/externallib.php',
2ce8934b
JL
75 'description' => 'Returns a list of forum discussions optionally sorted and paginated.',
76 'type' => 'read',
0ca559a1
JL
77 'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
78 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
2ce8934b 79 ),
449a6304
JL
80
81 'mod_forum_view_forum' => array(
82 'classname' => 'mod_forum_external',
83 'methodname' => 'view_forum',
84 'classpath' => 'mod/forum/externallib.php',
1c2b7882 85 'description' => 'Trigger the course module viewed event and update the module completion status.',
449a6304 86 'type' => 'write',
0ca559a1
JL
87 'capabilities' => 'mod/forum:viewdiscussion',
88 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
449a6304 89 ),
d508dfe7
JL
90
91 'mod_forum_view_forum_discussion' => array(
92 'classname' => 'mod_forum_external',
93 'methodname' => 'view_forum_discussion',
94 'classpath' => 'mod/forum/externallib.php',
1c2b7882 95 'description' => 'Trigger the forum discussion viewed event.',
d508dfe7 96 'type' => 'write',
0ca559a1
JL
97 'capabilities' => 'mod/forum:viewdiscussion',
98 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
d508dfe7 99 ),
50a20317
JL
100
101 'mod_forum_add_discussion_post' => array(
102 'classname' => 'mod_forum_external',
103 'methodname' => 'add_discussion_post',
104 'classpath' => 'mod/forum/externallib.php',
105 'description' => 'Create new posts into an existing discussion.',
106 'type' => 'write',
9b4f09ba 107 'ajax' => true,
0ca559a1
JL
108 'capabilities' => 'mod/forum:replypost',
109 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
50a20317 110 ),
7ab43ac8
JL
111
112 'mod_forum_add_discussion' => array(
113 'classname' => 'mod_forum_external',
114 'methodname' => 'add_discussion',
115 'classpath' => 'mod/forum/externallib.php',
116 'description' => 'Add a new discussion into an existing forum.',
117 'type' => 'write',
0ca559a1
JL
118 'capabilities' => 'mod/forum:startdiscussion',
119 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
7ab43ac8 120 ),
04cd8ae3
JL
121
122 'mod_forum_can_add_discussion' => array(
123 'classname' => 'mod_forum_external',
124 'methodname' => 'can_add_discussion',
125 'classpath' => 'mod/forum/externallib.php',
126 'description' => 'Check if the current user can add discussions in the given forum (and optionally for the given group).',
0ca559a1
JL
127 'type' => 'read',
128 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
04cd8ae3 129 ),
4daa0d08
JL
130
131 'mod_forum_get_forum_access_information' => array(
132 'classname' => 'mod_forum_external',
133 'methodname' => 'get_forum_access_information',
134 'description' => 'Return capabilities information for a given forum.',
135 'type' => 'read',
136 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
137 ),
2646e9d6
RW
138
139 'mod_forum_set_subscription_state' => array(
140 'classname' => 'mod_forum_external',
141 'methodname' => 'set_subscription_state',
142 'classpath' => 'mod/forum/externallib.php',
143 'description' => 'Set the subscription state',
144 'type' => 'write',
145 'ajax' => true,
146 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
147 ),
2893812e
P
148
149 'mod_forum_set_lock_state' => array(
150 'classname' => 'mod_forum_external',
151 'methodname' => 'set_lock_state',
152 'classpath' => 'mod/forum/externallib.php',
153 'description' => 'Set the lock state for the discussion',
154 'type' => 'write',
155 'ajax' => true,
bdb4a87d 156 'capabilities' => 'moodle/course:manageactivities',
2893812e
P
157 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
158 ),
99bda8a7
P
159
160 'mod_forum_toggle_favourite_state' => array(
161 'classname' => 'mod_forum_external',
162 'methodname' => 'toggle_favourite_state',
163 'classpath' => 'mod/forum/externallib.php',
164 'description' => 'Toggle the favourite state',
165 'type' => 'write',
166 'ajax' => true,
167 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
168 ),
25a97f99 169 'mod_forum_set_pin_state' => array(
170 'classname' => 'mod_forum_external',
171 'methodname' => 'set_pin_state',
172 'classpath' => 'mod/forum/externallib.php',
173 'description' => 'Set the pin state',
174 'type' => 'write',
175 'ajax' => true,
176 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
177 ),
56444a60
JL
178 'mod_forum_delete_post' => array(
179 'classname' => 'mod_forum_external',
180 'methodname' => 'delete_post',
181 'classpath' => 'mod/forum/externallib.php',
182 'description' => 'Deletes a post or a discussion completely when the post is the discussion topic.',
183 'type' => 'write',
184 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
185 ),
2b9fe87d 186);