Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
{"version":3,"file":"repository.min.js","sources":["../src/repository.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * A javascript module to handle course ajax actions.\n *\n * @module     core_course/repository\n * @copyright  2018 Ryan Wyllie <ryan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\n\n/**\n * Get the list of courses that the logged in user is enrolled in for a given\n * timeline classification.\n *\n * @param {string} classification past, inprogress, or future\n * @param {int} limit Only return this many results\n * @param {int} offset Skip this many results from the start of the result set\n * @param {string} sort Column to sort by and direction, e.g. 'shortname asc'\n * @return {object} jQuery promise resolved with courses.\n */\nconst getEnrolledCoursesByTimelineClassification = (classification, limit, offset, sort) => {\n    const args = {\n        classification: classification\n    };\n\n    if (typeof limit !== 'undefined') {\n        args.limit = limit;\n    }\n\n    if (typeof offset !== 'undefined') {\n        args.offset = offset;\n    }\n\n    if (typeof sort !== 'undefined') {\n        args.sort = sort;\n    }\n\n    const request = {\n        methodname: 'core_course_get_enrolled_courses_by_timeline_classification',\n        args: args\n    };\n\n    return Ajax.call([request])[0];\n};\n\n/**\n * Get a list of courses that the logged in user is enrolled in, where they have at least one action event,\n * for a given timeline classification.\n *\n * @param {string} classification past, inprogress, or future\n * @param {int} limit The maximum number of courses to return\n * @param {int} offset Skip this many results from the start of the result set\n * @param {string} sort Column to sort by and direction, e.g. 'shortname asc'\n * @param {string} searchValue Optional text search value\n * @param {int} eventsFrom Optional start timestamp (inclusive) that the course should have event(s) in\n * @param {int} eventsTo Optional end timestamp (inclusive) that the course should have event(s) in\n * @return {object} jQuery promise resolved with courses.\n */\n const getEnrolledCoursesWithEventsByTimelineClassification = (classification, limit = 0, offset = 0, sort = null,\n        searchValue = null, eventsFrom = null, eventsTo = null) => {\n\n    const args = {\n        classification: classification,\n        limit: limit,\n        offset: offset,\n        sort: sort,\n        eventsfrom: eventsFrom,\n        eventsto: eventsTo,\n        searchvalue: searchValue,\n    };\n\n    const request = {\n        methodname: 'core_course_get_enrolled_courses_with_action_events_by_timeline_classification',\n        args: args\n    };\n\n    return Ajax.call([request])[0];\n};\n\n/**\n * Get the list of courses that the user has most recently accessed.\n *\n * @method getLastAccessedCourses\n * @param {int} userid User from which the courses will be obtained\n * @param {int} limit Only return this many results\n * @param {int} offset Skip this many results from the start of the result set\n * @param {string} sort Column to sort by and direction, e.g. 'shortname asc'\n * @return {promise} Resolved with an array of courses\n */\nconst getLastAccessedCourses = (userid, limit, offset, sort) => {\n    const args = {};\n\n    if (typeof userid !== 'undefined') {\n        args.userid = userid;\n    }\n\n    if (typeof limit !== 'undefined') {\n        args.limit = limit;\n    }\n\n    if (typeof offset !== 'undefined') {\n        args.offset = offset;\n    }\n\n    if (typeof sort !== 'undefined') {\n        args.sort = sort;\n    }\n\n    const request = {\n        methodname: 'core_course_get_recent_courses',\n        args: args\n    };\n\n    return Ajax.call([request])[0];\n};\n\n/**\n * Get the list of users enrolled in this cmid.\n *\n * @param {Number} cmid Course Module from which the users will be obtained\n * @param {Number} groupID Group ID from which the users will be obtained\n * @param {Boolean} onlyActive Whether to fetch only the active enrolled users or all enrolled users in the course.\n * @returns {Promise} Promise containing a list of users\n */\nconst getEnrolledUsersFromCourseModuleID = (cmid, groupID, onlyActive = false) => {\n    var request = {\n        methodname: 'core_course_get_enrolled_users_by_cmid',\n        args: {\n            cmid: cmid,\n            groupid: groupID,\n            onlyactive: onlyActive,\n        },\n    };\n\n    return Ajax.call([request])[0];\n};\n\n/**\n * Get the list of gradable users enrolled in this course.\n *\n * @param {Number} courseid Course ID from which the users will be obtained\n * @param {Number} groupID Group ID from which the users will be obtained\n * @param {Boolean} onlyActive Whether to fetch only the active enrolled users or all enrolled users in the course.\n * @returns {Promise} Promise containing a list of users\n */\nconst getGradabaleUsersFromCourseID = (courseid, groupID, onlyActive = false) => {\n    const request = {\n        methodname: 'core_grades_get_gradable_users',\n        args: {\n            courseid: courseid,\n            groupid: groupID,\n            onlyactive: onlyActive,\n        },\n    };\n\n    return Ajax.call([request])[0];\n};\n\n/**\n * Toggle the completion state of an activity with manual completion.\n *\n * @param {Number} cmid The course module ID.\n * @param {Boolean} completed Whether to set as complete or not.\n * @returns {object} jQuery promise\n */\nconst toggleManualCompletion = (cmid, completed) => {\n    const request = {\n        methodname: 'core_completion_update_activity_completion_status_manually',\n        args: {\n            cmid,\n            completed,\n        }\n    };\n    return Ajax.call([request])[0];\n};\n\nexport default {\n    getEnrolledCoursesByTimelineClassification,\n    getLastAccessedCourses,\n    getUsersFromCourseModuleID: getEnrolledUsersFromCourseModuleID,\n    getGradableUsersFromCourseID: getGradabaleUsersFromCourseID,\n    toggleManualCompletion,\n    getEnrolledCoursesWithEventsByTimelineClassification,\n};\n"],"names":["getEnrolledCoursesByTimelineClassification","classification","limit","offset","sort","args","request","methodname","Ajax","call","getLastAccessedCourses","userid","getUsersFromCourseModuleID","cmid","groupID","onlyActive","groupid","onlyactive","getGradableUsersFromCourseID","courseid","toggleManualCompletion","completed","getEnrolledCoursesWithEventsByTimelineClassification","searchValue","eventsFrom","eventsTo","eventsfrom","eventsto","searchvalue"],"mappings":";;;;;;;sJA+Le,CACXA,2CA7J+C,CAACC,eAAgBC,MAAOC,OAAQC,cACzEC,KAAO,CACTJ,eAAgBA,qBAGC,IAAVC,QACPG,KAAKH,MAAQA,YAGK,IAAXC,SACPE,KAAKF,OAASA,aAGE,IAATC,OACP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