return Ajax.call([request])[0];
};
+ /**
+ * Get the list of courses that the user has most recently accessed.
+ *
+ * @method getLastAccessedCourses
+ * @param {int} userid User from which the courses will be obtained
+ * @param {int} limit Only return this many results
+ * @param {int} offset Skip this many results from the start of the result set
+ * @param {string} sort Column to sort by and direction, e.g. 'shortname asc'
+ * @return {promise} Resolved with an array of courses
+ */
+ var getLastAccessedCourses = function(userid, limit, offset, sort) {
+ var args = {};
+
+ if (typeof userid !== 'undefined') {
+ args.limit = limit;
+ }
+
+ if (typeof limit !== 'undefined') {
+ args.limit = limit;
+ }
+
+ if (typeof offset !== 'undefined') {
+ args.offset = offset;
+ }
+
+ if (typeof sort !== 'undefined') {
+ args.sort = sort;
+ }
+
+ var request = {
+ methodname: 'core_course_get_recent_courses',
+ args: args
+ };
+
+ return Ajax.call([request])[0];
+ };
+
return {
- getEnrolledCoursesByTimelineClassification: getEnrolledCoursesByTimelineClassification
+ getEnrolledCoursesByTimelineClassification: getEnrolledCoursesByTimelineClassification,
+ getLastAccessedCourses: getLastAccessedCourses
};
});