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

Function add_export_methods

codebase/sources/dhtmlxscheduler.js:21497–21654  ·  view source on GitHub ↗
(scheduler3)

Source from the content-addressed store, hash-verified

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