{"version":3,"sources":["https:\/\/dpielts.lk\/course\/amd\/src\/repository.js"],"names":["getEnrolledCoursesByTimelineClassification","classification","limit","offset","sort","args","Ajax","call","methodname","getLastAccessedCourses","userid","getEnrolledUsersFromCourseModuleID","cmid","groupID","groupid","toggleManualCompletion","completed","getUsersFromCourseModuleID"],"mappings":"sJAuBA,uD,GAYMA,CAAAA,CAA0C,CAAG,SAACC,CAAD,CAAiBC,CAAjB,CAAwBC,CAAxB,CAAgCC,CAAhC,CAAyC,CACxF,GAAMC,CAAAA,CAAI,CAAG,CACTJ,cAAc,CAAEA,CADP,CAAb,CAIA,GAAqB,WAAjB,QAAOC,CAAAA,CAAX,CAAkC,CAC9BG,CAAI,CAACH,KAAL,CAAaA,CAChB,CAED,GAAsB,WAAlB,QAAOC,CAAAA,CAAX,CAAmC,CAC\/BE,CAAI,CAACF,MAAL,CAAcA,CACjB,CAED,GAAoB,WAAhB,QAAOC,CAAAA,CAAX,CAAiC,CAC7BC,CAAI,CAACD,IAAL,CAAYA,CACf,CAOD,MAAOE,WAAKC,IAAL,CAAU,CALD,CACZC,UAAU,CAAE,6DADA,CAEZH,IAAI,CAAEA,CAFM,CAKC,CAAV,EAAqB,CAArB,CACV,C,CAYKI,CAAsB,CAAG,SAACC,CAAD,CAASR,CAAT,CAAgBC,CAAhB,CAAwBC,CAAxB,CAAiC,CAC5D,GAAMC,CAAAA,CAAI,CAAG,EAAb,CAEA,GAAsB,WAAlB,QAAOK,CAAAA,CAAX,CAAmC,CAC\/BL,CAAI,CAACK,MAAL,CAAcA,CACjB,CAED,GAAqB,WAAjB,QAAOR,CAAAA,CAAX,CAAkC,CAC9BG,CAAI,CAACH,KAAL,CAAaA,CAChB,CAED,GAAsB,WAAlB,QAAOC,CAAAA,CAAX,CAAmC,CAC\/BE,CAAI,CAACF,MAAL,CAAcA,CACjB,CAED,GAAoB,WAAhB,QAAOC,CAAAA,CAAX,CAAiC,CAC7BC,CAAI,CAACD,IAAL,CAAYA,CACf,CAOD,MAAOE,WAAKC,IAAL,CAAU,CALD,CACZC,UAAU,CAAE,gCADA,CAEZH,IAAI,CAAEA,CAFM,CAKC,CAAV,EAAqB,CAArB,CACV,C,CASKM,CAAkC,CAAG,SAACC,CAAD,CAAOC,CAAP,CAAmB,CAS1D,MAAOP,WAAKC,IAAL,CAAU,CARH,CACVC,UAAU,CAAE,wCADF,CAEVH,IAAI,CAAE,CACFO,IAAI,CAAEA,CADJ,CAEFE,OAAO,CAAED,CAFP,CAFI,CAQG,CAAV,EAAqB,CAArB,CACV,C,CASKE,CAAsB,CAAG,SAACH,CAAD,CAAOI,CAAP,CAAqB,CAQhD,MAAOV,WAAKC,IAAL,CAAU,CAPD,CACZC,UAAU,CAAE,4DADA,CAEZH,IAAI,CAAE,CACFO,IAAI,CAAJA,CADE,CAEFI,SAAS,CAATA,CAFE,CAFM,CAOC,CAAV,EAAqB,CAArB,CACV,C,WAEc,CACXhB,0CAA0C,CAA1CA,CADW,CAEXS,sBAAsB,CAAtBA,CAFW,CAGXQ,0BAA0B,CAAEN,CAHjB,CAIXI,sBAAsB,CAAtBA,CAJW,C","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 .\n\n\/**\n * A javascript module to handle course ajax actions.\n *\n * @module core_course\/repository\n * @copyright 2018 Ryan Wyllie \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 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 * @returns {Promise} Promise containing a list of users\n *\/\nconst getEnrolledUsersFromCourseModuleID = (cmid, groupID) => {\n var request = {\n methodname: 'core_course_get_enrolled_users_by_cmid',\n args: {\n cmid: cmid,\n groupid: groupID,\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 toggleManualCompletion,\n};\n"],"file":"repository.min.js"}