MDL-66077 course: Add WS to get list of users in a cmid

Part of MDL-66074
This commit is contained in:
Mathew May 2019-10-05 11:33:05 +08:00
parent af9ca2a658
commit 06e50afd5e
6 changed files with 158 additions and 3 deletions

View file

@ -1,2 +1,2 @@
define ("core_course/repository",["jquery","core/ajax"],function(a,b){return{getEnrolledCoursesByTimelineClassification:function getEnrolledCoursesByTimelineClassification(a,c,d,e){var f={classification:a};if("undefined"!=typeof c){f.limit=c}if("undefined"!=typeof d){f.offset=d}if("undefined"!=typeof e){f.sort=e}return b.call([{methodname:"core_course_get_enrolled_courses_by_timeline_classification",args:f}])[0]},getLastAccessedCourses:function getLastAccessedCourses(a,c,d,e){var f={};if("undefined"!=typeof a){f.userid=a}if("undefined"!=typeof c){f.limit=c}if("undefined"!=typeof d){f.offset=d}if("undefined"!=typeof e){f.sort=e}return b.call([{methodname:"core_course_get_recent_courses",args:f}])[0]}}});
define ("core_course/repository",["jquery","core/ajax"],function(a,b){return{getEnrolledCoursesByTimelineClassification:function getEnrolledCoursesByTimelineClassification(a,c,d,e){var f={classification:a};if("undefined"!=typeof c){f.limit=c}if("undefined"!=typeof d){f.offset=d}if("undefined"!=typeof e){f.sort=e}return b.call([{methodname:"core_course_get_enrolled_courses_by_timeline_classification",args:f}])[0]},getLastAccessedCourses:function getLastAccessedCourses(a,c,d,e){var f={};if("undefined"!=typeof a){f.userid=a}if("undefined"!=typeof c){f.limit=c}if("undefined"!=typeof d){f.offset=d}if("undefined"!=typeof e){f.sort=e}return b.call([{methodname:"core_course_get_recent_courses",args:f}])[0]},getUsersFromCourseModuleID:function getEnrolledUsersFromCourseModuleID(a){return b.call([{methodname:"core_course_get_enrolled_users_by_cmid",args:{cmid:a}}])[0]}}});
//# sourceMappingURL=repository.min.js.map

File diff suppressed because one or more lines are too long

View file

@ -94,8 +94,26 @@ define(['jquery', 'core/ajax'], function($, Ajax) {
return Ajax.call([request])[0];
};
/**
* Get the list of users enrolled in this cmid.
*
* @param {Number} cmid Course Module from which the users will be obtained
* @returns {Promise} Promise containing a list of users
*/
var getEnrolledUsersFromCourseModuleID = function(cmid) {
var request = {
methodname: 'core_course_get_enrolled_users_by_cmid',
args: {
cmid: cmid,
},
};
return Ajax.call([request])[0];
};
return {
getEnrolledCoursesByTimelineClassification: getEnrolledCoursesByTimelineClassification,
getLastAccessedCourses: getLastAccessedCourses
getLastAccessedCourses: getLastAccessedCourses,
getUsersFromCourseModuleID: getEnrolledUsersFromCourseModuleID,
};
});