AutorÃa | Ultima modificación | Ver Log |
{"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 calendar ajax actions.\n *\n * @module core_calendar/repository\n * @copyright 2017 Simey Lameze <lameze@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or lat
er\n */\nimport Ajax from 'core/ajax';\n\n/**\n * Delete a calendar event.\n *\n * @method deleteEvent\n * @param {number} eventId The event id.\n * @param {boolean} deleteSeries Whether to delete all events in the series\n * @return {promise} Resolved with requested calendar event\n */\nexport const deleteEvent = (eventId, deleteSeries = false) => {\n const request = {\n methodname: 'core_calendar_delete_calendar_events',\n args: {\n events: [{\n eventid: eventId,\n repeat: deleteSeries,\n }]\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get a calendar event by id.\n *\n * @method getEventById\n * @param {number} eventId The event id.\n * @return {promise} Resolved with requested calendar event\n */\nexport const getEventById = (eventId) => {\n\n const request = {\n methodname: 'core_calendar_get_calendar_event_by_id',\n args: {\n eventid: eventId\n }\n };\n\n return Ajax.
call([request])[0];\n};\n\n/**\n * Submit the form data for the event form.\n *\n * @method submitCreateUpdateForm\n * @param {string} formData The URL encoded values from the form\n * @return {promise} Resolved with the new or edited event\n */\nexport const submitCreateUpdateForm = (formData) => {\n const request = {\n methodname: 'core_calendar_submit_create_update_form',\n args: {\n formdata: formData\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get calendar data for the month view.\n *\n * @method getCalendarMonthData\n * @param {number} year Year\n * @param {number} month Month\n * @param {number} courseId The course id.\n * @param {number} categoryId The category id.\n * @param {boolean} includeNavigation Whether to include navigation.\n * @param {boolean} mini Whether the month is in mini view.\n * @param {number} day Day (optional)\n * @param {string} view The calendar view mode.\n * @return {promise} Resolved with the month view data.\n */\nex
port const getCalendarMonthData = (year, month, courseId, categoryId, includeNavigation, mini, day = 1, view = 'month') => {\n const request = {\n methodname: 'core_calendar_get_calendar_monthly_view',\n args: {\n year,\n month,\n courseid: courseId,\n categoryid: categoryId,\n includenavigation: includeNavigation,\n mini,\n day,\n view,\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get calendar data for the day view.\n *\n * @method getCalendarDayData\n * @param {number} year Year\n * @param {number} month Month\n * @param {number} day Day\n * @param {number} courseId The course id.\n * @param {number} categoryId The id of the category whose events are shown\n * @return {promise} Resolved with the day view data.\n */\nexport const getCalendarDayData = (year, month, day, courseId, categoryId) => {\n const request = {\n methodname: 'core_calendar_get_calendar_day_view',
\n args: {\n year,\n month,\n day,\n courseid: courseId,\n categoryid: categoryId,\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Change the start day for the given event id. The day timestamp\n * only has to be any time during the target day because only the\n * date information is extracted, the time of the day is ignored.\n *\n * @param {int} eventId The id of the event to update\n * @param {int} dayTimestamp A timestamp for some time during the target day\n * @return {promise}\n */\nexport const updateEventStartDay = (eventId, dayTimestamp) => {\n const request = {\n methodname: 'core_calendar_update_event_start_day',\n args: {\n eventid: eventId,\n daytimestamp: dayTimestamp\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get calendar upcoming data.\n *\n * @method getCalendarUpcomingData\n * @param {number} courseId The course id.\n * @param {number} ca
tegoryId The category id.\n * @return {promise} Resolved with the month view data.\n */\nexport const getCalendarUpcomingData = (courseId, categoryId) => {\n const request = {\n methodname: 'core_calendar_get_calendar_upcoming_view',\n args: {\n courseid: courseId,\n categoryid: categoryId,\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get the groups by course id.\n *\n * @param {Number} courseId The course id to fetch the groups from.\n * @return {promise} Resolved with the course groups.\n */\nexport const getCourseGroupsData = (courseId) => {\n const request = {\n methodname: 'core_group_get_course_groups',\n args: {\n courseid: courseId\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Delete calendar subscription by id.\n *\n * @param {Number} subscriptionId The subscription id\n * @return {promise}\n */\nexport const deleteSubscription = (subscriptionId) => {\n const request = {\n
methodname: 'core_calendar_delete_subscription',\n args: {\n subscriptionid: subscriptionId\n }\n };\n\n return Ajax.call([request])[0];\n};\n"],"names":["eventId","deleteSeries","request","methodname","args","events","eventid","repeat","Ajax","call","formData","formdata","year","month","courseId","categoryId","includeNavigation","mini","day","view","courseid","categoryid","includenavigation","dayTimestamp","daytimestamp","subscriptionId","subscriptionid"],"mappings":";;;;;;;yYAgC2B,SAACA,aAASC,2EAC3BC,QAAU,CACZC,WAAY,uCACZC,KAAM,CACFC,OAAQ,CAAC,CACLC,QAASN,QACTO,OAAQN,wBAKbO,cAAKC,KAAK,CAACP,UAAU,0BAUHF,gBAEnBE,QAAU,CACZC,WAAY,yCACZC,KAAM,CACFE,QAASN,iBAIVQ,cAAKC,KAAK,CAACP,UAAU,oCAUOQ,iBAC7BR,QAAU,CACZC,WAAY,0CACZC,KAAM,CACFO,SAAUD,kBAIXF,cAAKC,KAAK,CAACP,UAAU,kCAiBI,SAACU,KAAMC,MAAOC,SAAUC,WAAYC,kBAAmBC,UAAMC,2DAAM,EAAGC,4DAAO,cACvGjB,QAAU,CACZC,WAAY,0CACZC,KAAM,CACFQ,KAAAA,KACAC,MAAAA,MACAO,SAAUN,SACVO,WAAYN,WACZO,kBAAmBN,kBACnBC,KAAAA,KACAC,IAAAA,IACAC,KAAAA,cAIDX,cAAK
C,KAAK,CAACP,UAAU,gCAcE,CAACU,KAAMC,MAAOK,IAAKJ,SAAUC,oBACrDb,QAAU,CACZC,WAAY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