MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / add_export_methods

Function add_export_methods

codebase/sources/dhtmlxscheduler.es.js:21493–21650  ·  view source on GitHub ↗
(scheduler3)

Source from the content-addressed store, hash-verified

21491 } };
21492 }
21493 function add_export_methods(scheduler3) {
21494 scheduler3.exportToPDF = function(config) {
21495 config = defaults(config || {}, { name: "calendar.pdf", format: "A4", orientation: "landscape", dpi: 96, zoom: 1, rtl: scheduler3.config.rtl });
21496 config.html = this._export_html(config);
21497 config.mode = this.getState().mode;
21498 this._send_to_export(config, "pdf");
21499 };
21500 scheduler3.exportToPNG = function(config) {
21501 config = defaults(config || {}, { name: "calendar.png", format: "A4", orientation: "landscape", dpi: 96, zoom: 1, rtl: scheduler3.config.rtl });
21502 config.html = this._export_html(config);
21503 config.mode = this.getState().mode;
21504 this._send_to_export(config, "png");
21505 };
21506 scheduler3.exportToICal = function(config) {
21507 config = defaults(config || {}, { name: "calendar.ical", data: this._serialize_plain(null, config) });
21508 this._send_to_export(config, "ical");
21509 };
21510 scheduler3.exportToExcel = function(config) {
21511 config = defaults(config || {}, { name: "calendar.xlsx", title: "Events", data: this._serialize_plain(this.templates.xml_format, config), columns: this._serialize_columns() });
21512 this._send_to_export(config, "excel");
21513 };
21514 scheduler3._ajax_to_export = function(data, type, callback) {
21515 delete data.callback;
21516 var url2 = data.server || "https://export.dhtmlx.com/scheduler";
21517 window.dhtmlxAjax.post(url2, "type=" + type + "&store=1&data=" + encodeURIComponent(JSON.stringify(data)), function(loader) {
21518 var fail = loader.xmlDoc.status > 400;
21519 var info = null;
21520 if (!fail) {
21521 try {
21522 info = JSON.parse(loader.xmlDoc.responseText);
21523 } catch (e) {
21524 }
21525 }
21526 callback(info);
21527 });
21528 };
21529 scheduler3._plain_export_copy = function(source, format) {
21530 var target = {};
21531 for (var key in source)
21532 target[key] = source[key];
21533 target.start_date = format(target.start_date);
21534 target.end_date = format(target.end_date);
21535 target.$text = this.templates.event_text(source.start_date, source.end_date, source);
21536 return target;
21537 };
21538 scheduler3._serialize_plain = function(format, config) {
21539 format = format || scheduler3.date.date_to_str("%Y%m%dT%H%i%s", true);
21540 var events;
21541 if (config && config.start && config.end)
21542 events = scheduler3.getEvents(config.start, config.end);
21543 else
21544 events = scheduler3.getEvents();
21545 var data = [];
21546 for (var i = 0; i < events.length; i++)
21547 data[i] = this._plain_export_copy(events[i], format);
21548 return data;
21549 };
21550 scheduler3._serialize_columns = function() {

Callers 1

export_apiFunction · 0.70

Calls 12

defaultsFunction · 0.70
callbackFunction · 0.70
getElementSizesFunction · 0.70
getInitialSizesFunction · 0.70
setExportSizesFunction · 0.70
setInitialSizesFunction · 0.70
getStateMethod · 0.65
parseMethod · 0.65
event_textMethod · 0.65
date_to_strMethod · 0.65
getEventsMethod · 0.65
setCurrentViewMethod · 0.65

Tested by

no test coverage detected