uploading get_group (by id) function

MDL-12886
This commit is contained in:
pigui 2009-02-03 12:40:44 +00:00
parent 19e12e4bd8
commit 8011f73f90
2 changed files with 87 additions and 0 deletions

View file

@ -10,6 +10,8 @@
require_once(dirname(dirname(__FILE__)) . '/lib/moodleexternal.php');
require_once(dirname(dirname(__FILE__)) . '/group/lib.php');
require_once(dirname(dirname(__FILE__)) . '/lib/grouplib.php');
/**
* Group external api class
@ -29,6 +31,11 @@ final class group_external extends moodle_external {
'optionalparams' => array( ),
'return' => array('groupid' => PARAM_INT));
$this->descriptions['tmp_get_group'] = array( 'params' => array('groupid'=> PARAM_INT),
'optionalparams' => array( ),
'return' => array('group' => array('id' => PARAM_RAW, 'courseid' => PARAM_RAW,
'name' => PARAM_RAW, 'enrolmentkey' => PARAM_RAW)));
$this->descriptions['tmp_add_groupmember'] = array( 'params' => array('groupid'=> PARAM_INT, 'userid'=> PARAM_INT),
'optionalparams' => array( ),
'return' => array('result' => PARAM_BOOL));
@ -69,6 +76,21 @@ final class group_external extends moodle_external {
throw new moodle_exception('wscouldnotaddgroupmember');
}
}
static function tmp_get_group($params){
// @TODO: any capability to check?
$group = groups_get_group($params['groupid']);
$ret = new StdClass();
$ret->id = $group->id;
$ret->courseid = $group->courseid;
$ret->name = $group->name;
$ret->enrolmentkey = $group->enrolmentkey;
return $ret;
}
}
?>