weekly release 2.3dev
[moodle.git] / group / externallib.php
CommitLineData
9a0df45a 1<?php
9a0df45a 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 * External groups API
19 *
4d8e2417 20 * @package core_group
551f4420 21 * @copyright 2009 Moodle Pty Ltd (http://moodle.com)
9a0df45a 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25require_once("$CFG->libdir/externallib.php");
26
5d1017e1
JM
27/**
28 * Group functions
4d8e2417
AG
29 *
30 * @package core_group
31 * @copyright 2009 Moodle Pty Ltd (http://moodle.com)
32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
5d1017e1
JM
33 */
34class core_group_external extends external_api {
9a0df45a 35
0c96468c 36 /**
37 * Returns description of method parameters
f5072177 38 * @return external_function_parameters
0c96468c 39 */
40 public static function create_groups_parameters() {
f5072177 41 return new external_function_parameters(
42 array(
43 'groups' => new external_multiple_structure(
44 new external_single_structure(
45 array(
46 'courseid' => new external_value(PARAM_INT, 'id of course'),
47 'name' => new external_value(PARAM_TEXT, 'multilang compatible name, course unique'),
48 'description' => new external_value(PARAM_RAW, 'group description text'),
49 'enrolmentkey' => new external_value(PARAM_RAW, 'group enrol secret phrase'),
50 )
d4c6ef70 51 ), 'List of group object. A group has a courseid, a name, a description and an enrolment key.'
f5072177 52 )
53 )
54 );
0c96468c 55 }
56
57 /**
9a0df45a 58 * Create groups
b4c1a34e 59 * @param array $groups array of group description arrays (with keys groupname and courseid)
f5072177 60 * @return array of newly created groups
9a0df45a 61 */
b4c1a34e 62 public static function create_groups($groups) {
f5072177 63 global $CFG, $DB;
9a0df45a 64 require_once("$CFG->dirroot/group/lib.php");
65
c9c5cc81 66 $params = self::validate_parameters(self::create_groups_parameters(), array('groups'=>$groups));
0c96468c 67
d5a8d9aa
PS
68 $transaction = $DB->start_delegated_transaction();
69
70 $groups = array();
71
72 foreach ($params['groups'] as $group) {
73 $group = (object)$group;
74
75 if (trim($group->name) == '') {
76 throw new invalid_parameter_exception('Invalid group name');
77 }
78 if ($DB->get_record('groups', array('courseid'=>$group->courseid, 'name'=>$group->name))) {
79 throw new invalid_parameter_exception('Group with the same name already exists in the course');
ab9a01f2 80 }
d5a8d9aa
PS
81
82 // now security checks
83 $context = get_context_instance(CONTEXT_COURSE, $group->courseid);
41e962ff 84 try {
85 self::validate_context($context);
86 } catch (Exception $e) {
87 $exceptionparam = new stdClass();
88 $exceptionparam->message = $e->getMessage();
89 $exceptionparam->courseid = $group->courseid;
90 throw new moodle_exception(
91 get_string('errorcoursecontextnotvalid' , 'webservice', $exceptionparam));
92 }
d5a8d9aa
PS
93 require_capability('moodle/course:managegroups', $context);
94
95 // finally create the group
96 $group->id = groups_create_group($group, false);
97 $groups[] = (array)$group;
9a0df45a 98 }
d5a8d9aa
PS
99
100 $transaction->allow_commit();
9a0df45a 101
2e13b916 102 return $groups;
9a0df45a 103 }
104
4d8e2417 105 /**
0c96468c 106 * Returns description of method result value
4d8e2417 107 * @return external_multiple_structure
0c96468c 108 */
109 public static function create_groups_returns() {
f5072177 110 return new external_multiple_structure(
111 new external_single_structure(
112 array(
113 'id' => new external_value(PARAM_INT, 'group record id'),
114 'courseid' => new external_value(PARAM_INT, 'id of course'),
115 'name' => new external_value(PARAM_TEXT, 'multilang compatible name, course unique'),
116 'description' => new external_value(PARAM_RAW, 'group description text'),
117 'enrolmentkey' => new external_value(PARAM_RAW, 'group enrol secret phrase'),
118 )
d4c6ef70 119 ), 'List of group object. A group has an id, a courseid, a name, a description and an enrolment key.'
f5072177 120 );
0c96468c 121 }
122
f5072177 123 /**
124 * Returns description of method parameters
125 * @return external_function_parameters
126 */
0c96468c 127 public static function get_groups_parameters() {
8c772ad7 128 return new external_function_parameters(
129 array(
d4c6ef70 130 'groupids' => new external_multiple_structure(new external_value(PARAM_INT, 'Group ID')
131 ,'List of group id. A group id is an integer.'),
8c772ad7 132 )
133 );
0c96468c 134 }
135
9a0df45a 136 /**
246f6da2 137 * Get groups definition specified by ids
b4c1a34e 138 * @param array $groupids arrays of group ids
9a0df45a 139 * @return array of group objects (id, courseid, name, enrolmentkey)
140 */
b4c1a34e 141 public static function get_groups($groupids) {
c9c5cc81 142 $params = self::validate_parameters(self::get_groups_parameters(), array('groupids'=>$groupids));
0c96468c 143
246f6da2 144 $groups = array();
0c96468c 145 foreach ($params['groupids'] as $groupid) {
ab9a01f2 146 // validate params
ab9a01f2 147 $group = groups_get_group($groupid, 'id, courseid, name, description, enrolmentkey', MUST_EXIST);
148
9a0df45a 149 // now security checks
150 $context = get_context_instance(CONTEXT_COURSE, $group->courseid);
41e962ff 151 try {
152 self::validate_context($context);
153 } catch (Exception $e) {
154 $exceptionparam = new stdClass();
155 $exceptionparam->message = $e->getMessage();
156 $exceptionparam->courseid = $group->courseid;
157 throw new moodle_exception(
158 get_string('errorcoursecontextnotvalid' , 'webservice', $exceptionparam));
159 }
9a0df45a 160 require_capability('moodle/course:managegroups', $context);
161
2e13b916 162 $groups[] = (array)$group;
9a0df45a 163 }
164
165 return $groups;
166 }
167
4d8e2417 168 /**
f5072177 169 * Returns description of method result value
4d8e2417 170 * @return external_multiple_structure
f5072177 171 */
0c96468c 172 public static function get_groups_returns() {
246f6da2 173 return new external_multiple_structure(
174 new external_single_structure(
175 array(
176 'id' => new external_value(PARAM_INT, 'group record id'),
177 'courseid' => new external_value(PARAM_INT, 'id of course'),
178 'name' => new external_value(PARAM_TEXT, 'multilang compatible name, course unique'),
179 'description' => new external_value(PARAM_RAW, 'group description text'),
180 'enrolmentkey' => new external_value(PARAM_RAW, 'group enrol secret phrase'),
181 )
182 )
183 );
184 }
185
186 /**
187 * Returns description of method parameters
188 * @return external_function_parameters
189 */
190 public static function get_course_groups_parameters() {
191 return new external_function_parameters(
192 array(
193 'courseid' => new external_value(PARAM_INT, 'id of course'),
194 )
195 );
196 }
197
198 /**
199 * Get all groups in the specified course
200 * @param int $courseid id of course
201 * @return array of group objects (id, courseid, name, enrolmentkey)
202 */
203 public static function get_course_groups($courseid) {
204 $params = self::validate_parameters(self::get_course_groups_parameters(), array('courseid'=>$courseid));
205
206 // now security checks
207 $context = get_context_instance(CONTEXT_COURSE, $params['courseid']);
41e962ff 208 try {
209 self::validate_context($context);
210 } catch (Exception $e) {
211 $exceptionparam = new stdClass();
212 $exceptionparam->message = $e->getMessage();
213 $exceptionparam->courseid = $params['courseid'];
214 throw new moodle_exception(
215 get_string('errorcoursecontextnotvalid' , 'webservice', $exceptionparam));
216 }
246f6da2 217 require_capability('moodle/course:managegroups', $context);
218
219 $gs = groups_get_all_groups($params['courseid'], 0, 0, 'g.id, g.courseid, g.name, g.description, g.enrolmentkey');
220
221 $groups = array();
222 foreach ($gs as $group) {
223 $groups[] = (array)$group;
224 }
225
226 return $groups;
227 }
228
4d8e2417 229 /**
246f6da2 230 * Returns description of method result value
4d8e2417 231 * @return external_multiple_structure
246f6da2 232 */
233 public static function get_course_groups_returns() {
8c772ad7 234 return new external_multiple_structure(
235 new external_single_structure(
236 array(
f5072177 237 'id' => new external_value(PARAM_INT, 'group record id'),
238 'courseid' => new external_value(PARAM_INT, 'id of course'),
04d212ce 239 'name' => new external_value(PARAM_TEXT, 'multilang compatible name, course unique'),
f5072177 240 'description' => new external_value(PARAM_RAW, 'group description text'),
241 'enrolmentkey' => new external_value(PARAM_RAW, 'group enrol secret phrase'),
8c772ad7 242 )
243 )
244 );
0c96468c 245 }
246
0f4e72de
PS
247 /**
248 * Returns description of method parameters
249 * @return external_function_parameters
250 */
0c96468c 251 public static function delete_groups_parameters() {
0f4e72de
PS
252 return new external_function_parameters(
253 array(
254 'groupids' => new external_multiple_structure(new external_value(PARAM_INT, 'Group ID')),
255 )
256 );
0c96468c 257 }
258
9a0df45a 259 /**
260 * Delete groups
b4c1a34e 261 * @param array $groupids array of group ids
9a0df45a 262 * @return void
263 */
b4c1a34e 264 public static function delete_groups($groupids) {
2cb1ee78 265 global $CFG, $DB;
9a0df45a 266 require_once("$CFG->dirroot/group/lib.php");
267
c9c5cc81 268 $params = self::validate_parameters(self::delete_groups_parameters(), array('groupids'=>$groupids));
0c96468c 269
d5a8d9aa
PS
270 $transaction = $DB->start_delegated_transaction();
271
d5a8d9aa
PS
272 foreach ($params['groupids'] as $groupid) {
273 // validate params
274 $groupid = validate_param($groupid, PARAM_INTEGER);
275 if (!$group = groups_get_group($groupid, 'id, courseid', IGNORE_MISSING)) {
276 // silently ignore attempts to delete nonexisting groups
277 continue;
0f4e72de 278 }
d5a8d9aa
PS
279
280 // now security checks
281 $context = get_context_instance(CONTEXT_COURSE, $group->courseid);
41e962ff 282 try {
283 self::validate_context($context);
284 } catch (Exception $e) {
285 $exceptionparam = new stdClass();
286 $exceptionparam->message = $e->getMessage();
287 $exceptionparam->courseid = $group->courseid;
288 throw new moodle_exception(
289 get_string('errorcoursecontextnotvalid' , 'webservice', $exceptionparam));
290 }
d5a8d9aa
PS
291 require_capability('moodle/course:managegroups', $context);
292
293 groups_delete_group($group);
9a0df45a 294 }
d5a8d9aa
PS
295
296 $transaction->allow_commit();
9a0df45a 297 }
298
4d8e2417 299 /**
0f4e72de
PS
300 * Returns description of method result value
301 * @return external_description
302 */
0c96468c 303 public static function delete_groups_returns() {
0f4e72de 304 return null;
0c96468c 305 }
306
307
0f4e72de
PS
308 /**
309 * Returns description of method parameters
310 * @return external_function_parameters
311 */
5d1017e1 312 public static function get_group_members_parameters() {
0f4e72de
PS
313 return new external_function_parameters(
314 array(
315 'groupids' => new external_multiple_structure(new external_value(PARAM_INT, 'Group ID')),
316 )
317 );
0c96468c 318 }
9a0df45a 319
320 /**
321 * Return all members for a group
b4c1a34e 322 * @param array $groupids array of group ids
9a0df45a 323 * @return array with group id keys containing arrays of user ids
324 */
5d1017e1 325 public static function get_group_members($groupids) {
0f4e72de 326 $members = array();
9a0df45a 327
5d1017e1 328 $params = self::validate_parameters(self::get_group_members_parameters(), array('groupids'=>$groupids));
0c96468c 329
330 foreach ($params['groupids'] as $groupid) {
ab9a01f2 331 // validate params
9a0df45a 332 $group = groups_get_group($groupid, 'id, courseid, name, enrolmentkey', MUST_EXIST);
333 // now security checks
334 $context = get_context_instance(CONTEXT_COURSE, $group->courseid);
41e962ff 335 try {
336 self::validate_context($context);
337 } catch (Exception $e) {
338 $exceptionparam = new stdClass();
339 $exceptionparam->message = $e->getMessage();
340 $exceptionparam->courseid = $group->courseid;
341 throw new moodle_exception(
342 get_string('errorcoursecontextnotvalid' , 'webservice', $exceptionparam));
343 }
9a0df45a 344 require_capability('moodle/course:managegroups', $context);
345
346 $groupmembers = groups_get_members($group->id, 'u.id', 'lastname ASC, firstname ASC');
347
0f4e72de 348 $members[] = array('groupid'=>$groupid, 'userids'=>array_keys($groupmembers));
9a0df45a 349 }
350
0f4e72de 351 return $members;
9a0df45a 352 }
353
4d8e2417 354 /**
0f4e72de
PS
355 * Returns description of method result value
356 * @return external_description
357 */
5d1017e1 358 public static function get_group_members_returns() {
0f4e72de
PS
359 return new external_multiple_structure(
360 new external_single_structure(
361 array(
362 'groupid' => new external_value(PARAM_INT, 'group record id'),
363 'userids' => new external_multiple_structure(new external_value(PARAM_INT, 'user id')),
364 )
365 )
366 );
0c96468c 367 }
368
369
0f4e72de
PS
370 /**
371 * Returns description of method parameters
372 * @return external_function_parameters
373 */
5d1017e1 374 public static function add_group_members_parameters() {
4efa2483
PS
375 return new external_function_parameters(
376 array(
377 'members'=> new external_multiple_structure(
378 new external_single_structure(
379 array(
380 'groupid' => new external_value(PARAM_INT, 'group record id'),
381 'userid' => new external_value(PARAM_INT, 'user id'),
382 )
383 )
0f4e72de
PS
384 )
385 )
386 );
0c96468c 387 }
9a0df45a 388
389 /**
390 * Add group members
b4c1a34e 391 * @param array $members of arrays with keys userid, groupid
9a0df45a 392 */
5d1017e1 393 public static function add_group_members($members) {
2cb1ee78 394 global $CFG, $DB;
9a0df45a 395 require_once("$CFG->dirroot/group/lib.php");
396
5d1017e1 397 $params = self::validate_parameters(self::add_group_members_parameters(), array('members'=>$members));
9a0df45a 398
d5a8d9aa 399 $transaction = $DB->start_delegated_transaction();
d5a8d9aa
PS
400 foreach ($params['members'] as $member) {
401 // validate params
402 $groupid = $member['groupid'];
403 $userid = $member['userid'];
0c96468c 404
d5a8d9aa
PS
405 $group = groups_get_group($groupid, 'id, courseid', MUST_EXIST);
406 $user = $DB->get_record('user', array('id'=>$userid, 'deleted'=>0, 'mnethostid'=>$CFG->mnet_localhost_id), '*', MUST_EXIST);
9a0df45a 407
d5a8d9aa
PS
408 // now security checks
409 $context = get_context_instance(CONTEXT_COURSE, $group->courseid);
41e962ff 410 try {
411 self::validate_context($context);
412 } catch (Exception $e) {
413 $exceptionparam = new stdClass();
414 $exceptionparam->message = $e->getMessage();
415 $exceptionparam->courseid = $group->courseid;
416 throw new moodle_exception(
417 get_string('errorcoursecontextnotvalid' , 'webservice', $exceptionparam));
418 }
d5a8d9aa 419 require_capability('moodle/course:managegroups', $context);
9a0df45a 420
d5a8d9aa 421 // now make sure user is enrolled in course - this is mandatory requirement,
4f0c2d00
PS
422 // unfortunately this is slow
423 if (!is_enrolled($context, $userid)) {
424 throw new invalid_parameter_exception('Only enrolled users may be members of groups');
425 }
4efa2483 426
d5a8d9aa 427 groups_add_member($group, $user);
9a0df45a 428 }
d5a8d9aa
PS
429
430 $transaction->allow_commit();
9a0df45a 431 }
432
4d8e2417 433 /**
0f4e72de 434 * Returns description of method result value
5d1017e1 435 * @return null
0f4e72de 436 */
5d1017e1 437 public static function add_group_members_returns() {
0f4e72de 438 return null;
0c96468c 439 }
440
441
0f4e72de
PS
442 /**
443 * Returns description of method parameters
444 * @return external_function_parameters
445 */
5d1017e1 446 public static function delete_group_members_parameters() {
4efa2483
PS
447 return new external_function_parameters(
448 array(
449 'members'=> new external_multiple_structure(
450 new external_single_structure(
451 array(
452 'groupid' => new external_value(PARAM_INT, 'group record id'),
453 'userid' => new external_value(PARAM_INT, 'user id'),
454 )
455 )
0f4e72de
PS
456 )
457 )
458 );
0c96468c 459 }
9a0df45a 460
461 /**
462 * Delete group members
b4c1a34e 463 * @param array $members of arrays with keys userid, groupid
9a0df45a 464 */
5d1017e1 465 public static function delete_group_members($members) {
2cb1ee78 466 global $CFG, $DB;
9a0df45a 467 require_once("$CFG->dirroot/group/lib.php");
468
5d1017e1 469 $params = self::validate_parameters(self::delete_group_members_parameters(), array('members'=>$members));
9a0df45a 470
d5a8d9aa
PS
471 $transaction = $DB->start_delegated_transaction();
472
0c96468c 473 foreach ($params['members'] as $member) {
d5a8d9aa
PS
474 // validate params
475 $groupid = $member['groupid'];
476 $userid = $member['userid'];
0c96468c 477
d5a8d9aa
PS
478 $group = groups_get_group($groupid, 'id, courseid', MUST_EXIST);
479 $user = $DB->get_record('user', array('id'=>$userid, 'deleted'=>0, 'mnethostid'=>$CFG->mnet_localhost_id), '*', MUST_EXIST);
9a0df45a 480
d5a8d9aa
PS
481 // now security checks
482 $context = get_context_instance(CONTEXT_COURSE, $group->courseid);
41e962ff 483 try {
484 self::validate_context($context);
485 } catch (Exception $e) {
486 $exceptionparam = new stdClass();
487 $exceptionparam->message = $e->getMessage();
488 $exceptionparam->courseid = $group->courseid;
489 throw new moodle_exception(
490 get_string('errorcoursecontextnotvalid' , 'webservice', $exceptionparam));
491 }
d5a8d9aa 492 require_capability('moodle/course:managegroups', $context);
9a0df45a 493
d5a8d9aa 494 groups_remove_member($group, $user);
9a0df45a 495 }
d5a8d9aa
PS
496
497 $transaction->allow_commit();
9a0df45a 498 }
499
4d8e2417 500 /**
0f4e72de 501 * Returns description of method result value
5d1017e1 502 * @return null
0f4e72de 503 */
5d1017e1 504 public static function delete_group_members_returns() {
0f4e72de 505 return null;
0c96468c 506 }
507
4ca6cfbf 508}
5d1017e1
JM
509
510/**
511 * Deprecated group functions
e757f518 512 * @deprecated since Moodle 2.2 please do not call this class any more.
4d8e2417 513 * @see core_group_external()
5d1017e1
JM
514 */
515class moodle_group_external extends external_api {
516
517 /**
518 * Returns description of method parameters
4d8e2417
AG
519 * @deprecated since Moodle 2.2 please do not call this function any more.
520 * @see core_group_external::create_groups_parameters()
5d1017e1
JM
521 * @return external_function_parameters
522 */
523 public static function create_groups_parameters() {
524 return core_group_external::create_groups_parameters();
525 }
526
527 /**
528 * Create groups
4d8e2417
AG
529 * @deprecated since Moodle 2.2 please do not call this function any more.
530 * @see core_group_external::create_groups()
5d1017e1
JM
531 * @param array $groups array of group description arrays (with keys groupname and courseid)
532 * @return array of newly created groups
533 */
534 public static function create_groups($groups) {
535 return core_group_external::create_groups($groups);
536 }
537
e757f518
EL
538 /**
539 * Returns description of method result value
540 * @deprecated since Moodle 2.2 please do not call this function any more.
541 * @see core_group_external::create_groups_returns()
542 * @return external_description
543 */
5d1017e1
JM
544 public static function create_groups_returns() {
545 return core_group_external::create_groups_returns();
546 }
547
548 /**
549 * Returns description of method parameters
4d8e2417
AG
550 * @deprecated since Moodle 2.2 please do not call this function any more.
551 * @see core_group_external::get_groups_parameters()
5d1017e1
JM
552 * @return external_function_parameters
553 */
554 public static function get_groups_parameters() {
555 return core_group_external::get_groups_parameters();
556 }
557
558 /**
559 * Get groups definition specified by ids
4d8e2417
AG
560 * @deprecated since Moodle 2.2 please do not call this function any more.
561 * @see core_group_external::get_groups()
5d1017e1
JM
562 * @param array $groupids arrays of group ids
563 * @return array of group objects (id, courseid, name, enrolmentkey)
564 */
565 public static function get_groups($groupids) {
566 return core_group_external::get_groups($groupids);
567 }
568
e757f518
EL
569 /**
570 * Returns description of method result value
571 * @deprecated since Moodle 2.2 please do not call this function any more.
572 * @see core_group_external::get_groups_returns()
573 * @return external_description
574 */
5d1017e1
JM
575 public static function get_groups_returns() {
576 return core_group_external::get_groups_returns();
577 }
578
e757f518
EL
579 /**
580 * Returns description of method parameters
581 * @deprecated since Moodle 2.2 please do not call this function any more.
582 * @see core_group_external::get_course_groups_parameters()
583 * @return external_function_parameters
584 */
5d1017e1
JM
585 public static function get_course_groups_parameters() {
586 return core_group_external::get_course_groups_parameters();
587 }
588
e757f518
EL
589 /**
590 * Get all groups in the specified course
591 * @deprecated since Moodle 2.2 please do not call this function any more.
592 * @see core_group_external::get_course_groups()
593 * @param int $courseid id of course
594 * @return array of group objects (id, courseid, name, enrolmentkey)
595 */
5d1017e1
JM
596 public static function get_course_groups($courseid) {
597 return core_group_external::get_course_groups($courseid);
598 }
599
e757f518
EL
600 /**
601 * Returns description of method result value
602 * @deprecated since Moodle 2.2 please do not call this function any more.
603 * @see core_group_external::get_course_groups_returns()
604 * @return external_description
605 */
5d1017e1
JM
606 public static function get_course_groups_returns() {
607 return core_group_external::get_course_groups_returns();
608 }
609
610 /**
611 * Returns description of method parameters
4d8e2417
AG
612 * @deprecated since Moodle 2.2 please do not call this function any more.
613 * @see core_group_external::delete_group_members_parameters()
5d1017e1
JM
614 * @return external_function_parameters
615 */
616 public static function delete_groups_parameters() {
617 return core_group_external::delete_group_members_parameters();
618 }
619
620 /**
621 * Delete groups
4d8e2417
AG
622 * @deprecated since Moodle 2.2 please do not call this function any more.
623 * @see core_group_external::delete_groups()
5d1017e1
JM
624 * @param array $groupids array of group ids
625 * @return void
626 */
627 public static function delete_groups($groupids) {
628 return core_group_external::delete_groups($groupids);
629 }
630
e757f518
EL
631 /**
632 * Returns description of method result value
633 * @deprecated since Moodle 2.2 please do not call this function any more.
634 * @see core_group_external::delete_group_members_returns()
635 * @return external_description
636 */
5d1017e1
JM
637 public static function delete_groups_returns() {
638 return core_group_external::delete_group_members_returns();
639 }
640
641
642 /**
643 * Returns description of method parameters
4d8e2417
AG
644 * @deprecated since Moodle 2.2 please do not call this function any more.
645 * @see core_group_external::get_group_members_parameters()
5d1017e1
JM
646 * @return external_function_parameters
647 */
648 public static function get_groupmembers_parameters() {
649 return core_group_external::get_group_members_parameters();
650 }
651
652 /**
653 * Return all members for a group
4d8e2417
AG
654 * @deprecated since Moodle 2.2 please do not call this function any more.
655 * @see core_group_external::get_group_members()
5d1017e1
JM
656 * @param array $groupids array of group ids
657 * @return array with group id keys containing arrays of user ids
658 */
659 public static function get_groupmembers($groupids) {
660 return core_group_external::get_group_members($groupids);
661 }
662
e757f518
EL
663 /**
664 * Returns description of method result value
665 * @deprecated since Moodle 2.2 please do not call this function any more.
666 * @see core_group_external::get_group_members_returns()
667 * @return external_description
668 */
5d1017e1
JM
669 public static function get_groupmembers_returns() {
670 return core_group_external::get_group_members_returns();
671 }
672
673
674 /**
675 * Returns description of method parameters
4d8e2417
AG
676 * @deprecated since Moodle 2.2 please do not call this function any more.
677 * @see core_group_external::add_group_members_parameters()
5d1017e1
JM
678 * @return external_function_parameters
679 */
680 public static function add_groupmembers_parameters() {
681 return core_group_external::add_group_members_parameters();
682 }
683
684 /**
685 * Add group members
4d8e2417
AG
686 * @deprecated since Moodle 2.2 please do not call this function any more.
687 * @see core_group_external::add_group_members()
5d1017e1
JM
688 * @param array $members of arrays with keys userid, groupid
689 * @return void
690 */
691 public static function add_groupmembers($members) {
692 return core_group_external::add_group_members($members);
693 }
694
e757f518
EL
695 /**
696 * Returns description of method result value
697 * @deprecated since Moodle 2.2 please do not call this function any more.
698 * @see core_group_external::add_group_members_returns()
699 * @return external_description
700 */
5d1017e1
JM
701 public static function add_groupmembers_returns() {
702 return core_group_external::add_group_members_returns();
703 }
704
705
706 /**
707 * Returns description of method parameters
4d8e2417
AG
708 * @deprecated since Moodle 2.2 please do not call this function any more.
709 * @see core_group_external::delete_group_members_parameters()
5d1017e1
JM
710 * @return external_function_parameters
711 */
712 public static function delete_groupmembers_parameters() {
713 return core_group_external::delete_group_members_parameters();
714 }
715
716 /**
717 * Delete group members
4d8e2417
AG
718 * @deprecated since Moodle 2.2 please do not call this function any more.
719 * @see core_group_external::delete_group_members()
5d1017e1
JM
720 * @param array $members of arrays with keys userid, groupid
721 * @return void
722 */
723 public static function delete_groupmembers($members) {
724 return core_group_external::delete_group_members($members);
725 }
726
e757f518
EL
727 /**
728 * Returns description of method result value
729 * @deprecated since Moodle 2.2 please do not call this function any more.
730 * @see core_group_external::delete_group_members_returns()
731 * @return external_description
732 */
5d1017e1
JM
733 public static function delete_groupmembers_returns() {
734 return core_group_external::delete_group_members_returns();
735 }
736
e757f518 737}