{"version":3,"sources":["https:\/\/virtual.arte.unicen.edu.ar\/calendar\/amd\/src\/repository.js"],"names":["define","$","Ajax","getEventById","eventId","call","methodname","args","eventid","deleteEvent","deleteSeries","request","events","repeat","updateEventStartDay","dayTimestamp","daytimestamp","submitCreateUpdateForm","formdata","getCalendarMonthData","year","month","courseid","categoryid","includenavigation","mini","day","getCalendarDayData","categoryId","getCalendarUpcomingData","getCourseGroupsData"],"mappings":"AAwBAA,OAAM,4BAAC,CAAC,QAAD,CAAW,WAAX,CAAD,CAA0B,SAASC,CAAT,CAAYC,CAAZ,CAAkB,CAmL9C,MAAO,CACHC,YAAY,CAlJG,QAAfA,CAAAA,YAAe,CAASC,CAAT,CAAkB,CASjC,MAAOF,CAAAA,CAAI,CAACG,IAAL,CAAU,CAPH,CACVC,UAAU,CAAE,wCADF,CAEVC,IAAI,CAAE,CACFC,OAAO,CAAEJ,CADP,CAFI,CAOG,CAAV,EAAqB,CAArB,CACV,CAuIM,CAEHK,WAAW,CA3KG,QAAdA,CAAAA,WAAc,CAASL,CAAT,CAAkBM,CAAlB,CAAgC,CAC9C,GAA4B,WAAxB,QAAOA,CAAAA,CAAX,CAAyC,CACrCA,CAAY,GACf,CACD,GAAIC,CAAAA,CAAO,CAAG,CACVL,UAAU,CAAE,sCADF,CAEVC,IAAI,CAAE,CACFK,MAAM,CAAE,CAAC,CACLJ,OAAO,CAAEJ,CADJ,CAELS,MAAM,CAAEH,CAFH,CAAD,CADN,CAFI,CAAd,CAUA,MAAOR,CAAAA,CAAI,CAACG,IAAL,CAAU,CAACM,CAAD,CAAV,EAAqB,CAArB,CACV,CA0JM,CAGHG,mBAAmB,CApDG,QAAtBA,CAAAA,mBAAsB,CAASV,CAAT,CAAkBW,CAAlB,CAAgC,CAStD,MAAOb,CAAAA,CAAI,CAACG,IAAL,CAAU,CARH,CACVC,UAAU,CAAE,sCADF,CAEVC,IAAI,CAAE,CACFC,OAAO,CAAEJ,CADP,CAEFY,YAAY,CAAED,CAFZ,C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,CAOHC,uBAAuB,CApCG,QAA1BA,CAAAA,uBAA0B,CAASP,CAAT,CAAmBC,CAAnB,CAA+B,CASzD,MAAOrB,CAAAA,CAAI,CAACG,IAAL,CAAU,CARH,CACVC,UAAU,CAAE,0CADF,CAEVC,IAAI,CAAE,CACFe,QAAQ,CAAEA,CADR,CAEFC,UAAU,CAAEA,CAFV,CAFI,CAQG,CAAV,EAAqB,CAArB,CACV,CAmBM,CAQHO,mBAAmB,CAnBG,QAAtBA,CAAAA,mBAAsB,CAASR,CAAT,CAAmB,CAQzC,MAAOpB,CAAAA,CAAI,CAACG,IAAL,CAAU,CAPH,CACVC,UAAU,CAAE,8BADF,CAEVC,IAAI,CAAE,CACFe,QAAQ,CAAEA,CADR,CAFI,CAOG,CAAV,EAAqB,CAArB,CACV,CAEM,CAUV,CA7LK,CAAN","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 calendar ajax actions.\n *\n * @module core_calendar\/repository\n * @class repository\n * @package core_calendar\n * @copyright 2017 Simey Lameze \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\ndefine(['jquery', 'core\/ajax'], function($, Ajax) {\n\n \/**\n * Delete a calendar event.\n *\n * @method deleteEvent\n * @param {int} eventId The event id.\n * @param {bool} deleteSeries Whether to delete all events in the series\n * @return {promise} Resolved with requested calendar event\n *\/\n var deleteEvent = function(eventId, deleteSeries) {\n if (typeof deleteSeries === 'undefined') {\n deleteSeries = false;\n }\n var 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 {int} eventId The event id.\n * @return {promise} Resolved with requested calendar event\n *\/\n var getEventById = function(eventId) {\n\n var 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 *\/\n var submitCreateUpdateForm = function(formdata) {\n var 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 * @return {promise} Resolved with the month view data.\n *\/\n var getCalendarMonthData = function(year, month, courseid, categoryid, includenavigation, mini, day) {\n day = day || 1;\n var request = {\n methodname: 'core_calendar_get_calendar_monthly_view',\n args: {\n year: year,\n month: month,\n courseid: courseid,\n categoryid: categoryid,\n includenavigation: includenavigation,\n mini: mini,\n day: day\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 *\/\n var getCalendarDayData = function(year, month, day, courseid, categoryId) {\n var request = {\n methodname: 'core_calendar_get_calendar_day_view',\n args: {\n year: year,\n month: month,\n day: 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 *\/\n var updateEventStartDay = function(eventId, dayTimestamp) {\n var 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} categoryid The category id.\n * @return {promise} Resolved with the month view data.\n *\/\n var getCalendarUpcomingData = function(courseid, categoryid) {\n var 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 *\/\n var getCourseGroupsData = function(courseid) {\n var 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 return {\n getEventById: getEventById,\n deleteEvent: deleteEvent,\n updateEventStartDay: updateEventStartDay,\n submitCreateUpdateForm: submitCreateUpdateForm,\n getCalendarMonthData: getCalendarMonthData,\n getCalendarDayData: getCalendarDayData,\n getCalendarUpcomingData: getCalendarUpcomingData,\n getCourseGroupsData: getCourseGroupsData\n };\n});\n"],"file":"repository.min.js"}