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

Function export_api

codebase/sources/dhtmlxscheduler.js:21470–21657  ·  view source on GitHub ↗
(scheduler2)

Source from the content-addressed store, hash-verified

21468 });
21469 }
21470 function export_api(scheduler2) {
21471 (function() {
21472 function defaults(obj, std) {
21473 for (var key in std)
21474 if (!obj[key])
21475 obj[key] = std[key];
21476 return obj;
21477 }
21478 function getElementSizes(element, scheduler3) {
21479 var sizes = {};
21480 element = scheduler3._els[element];
21481 if (element && element[0]) {
21482 sizes.x = element[0].scrollWidth;
21483 sizes.y = element[0].scrollHeight;
21484 } else {
21485 sizes.x = 0;
21486 sizes.y = 0;
21487 }
21488 return sizes;
21489 }
21490 if (!window.dhtmlxAjax) {
21491 window.dhtmlxAjax = { post: function(url2, data, callback) {
21492 return window.dhx4.ajax.post(url2, data, callback);
21493 }, get: function(url2, callback) {
21494 return window.ajax.get(url2, callback);
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) {

Callers

nothing calls this directly

Calls 1

add_export_methodsFunction · 0.70

Tested by

no test coverage detected