scheduler.toPDF=function(url,mode,header,footer){
var dx = 0;
var dy = 0;
var colors = false;
if (mode == "fullcolor"){
colors = true;
mode = "color";
}
mode = mode||"color";
function x_norm(x) {
x = parseFloat(x);
if (isNaN(x)) return "auto";
return 100 * x / dx;
}
function y_norm(y) {
y = parseFloat(y);
if (isNaN(y)) return "auto";
return 100 * y / dy;
}
function xml_month_scale(xh){
var xml="";
for (var i = 0; i < xh.length; i++)
xml += "\n";
dx = xh[0].offsetWidth;
return xml;
}
function de_day(node,n){
var x = parseInt(node.style.left);
for (var dx=0; dx < scheduler._cols.length; dx++){
x-=scheduler._cols[dx];
if (x<0) return dx;
}
return n;
}
function de_week(node,n){
var y = parseInt(node.style.top);
for (var dy=0; dy < scheduler._colsS.heights.length; dy++)
if (scheduler._colsS.heights[dy]>y) return dy;
return n;
}
function xml_month(yh){
var xml="";
var r = yh.firstChild.rows;
for (var i = 0; i < r.length; i++) {
var days = [];
for (var j = 0; j < r[i].cells.length; j++){
/* var dd = r[i].cells[j];
var css = dd.className;
if (css!=" " && css!="dhx_now ")
days.push("");
else*/
days.push(r[i].cells[j].firstChild.innerHTML);
}
xml += "\n
";
dy = yh.firstChild.rows[0].cells[0].offsetHeight;
}
return xml;
}
function xml_top(profile) {
var xml = "";
xml += "";
if (scheduler._mode == "agenda"){
var xh = scheduler._els.dhx_cal_header[0].childNodes[0].childNodes;
xml+=""+xh[0].innerHTML+""+xh[1].innerHTML+""
} else if (scheduler._mode == "year"){
var xh = scheduler._els.dhx_cal_data[0].childNodes;
for (var i=0; i < xh.length; i++) {
xml+="";
xml+=xml_month_scale(xh[i].childNodes[1].childNodes);
xml+=xml_month(xh[i].childNodes[2]);
xml+="";
};
} else {
xml += "";
var xh = scheduler._els.dhx_cal_header[0].childNodes;
xml+=xml_month_scale(xh);
xml += "";
var yh = scheduler._els.dhx_cal_data[0];
if (yh.firstChild.tagName == "TABLE") {
xml += xml_month(yh);
} else {
yh = yh.childNodes[yh.childNodes.length - 1];
while (yh.className.indexOf("dhx_scale_holder") == -1)
yh = yh.previousSibling;
yh = yh.childNodes;
xml += "";
for (var i = 0; i < yh.length; i++)
xml += "\n
";
xml += "";
dy = yh[0].offsetHeight;
}
}
xml += "";
return xml;
}
function get_style(node, style){
return (window.getComputedStyle?(window.getComputedStyle(node, null)[style]):(node.currentStyle?node.currentStyle[style]:null))||"";
}
function xml_body() {
var xml = "";
var evs = scheduler._rendered;
if (scheduler._mode == "agenda"){
for (var i=0; i < evs.length; i++)
xml+=""+evs[i].childNodes[0].innerHTML+""+evs[i].childNodes[2].innerHTML+"";
} else if (scheduler._mode == "year"){
var evs = scheduler.get_visible_events();
for (var i=0; i < evs.length; i++) {
var d = evs[i].start_date;
if (d.valueOf()";
scheduler._mark_year_date(d);
d = scheduler.date.add(d,1,"day");
if (d.valueOf()>=scheduler._max_date.valueOf())
break;
}
}
} else {
for (var i = 0; i < evs.length; i++) {
var zx = x_norm(evs[i].style.left);
var zy = y_norm(evs[i].style.top);
var zdx = x_norm(evs[i].style.width);
var zdy = y_norm(evs[i].style.height);
var e_type = evs[i].className.split(" ")[0].replace("dhx_cal_", "");
var dets = scheduler.getEvent(evs[i].getAttribute("event_id"))
var day = dets._sday;
var week = dets._sweek;
if (scheduler._mode != "month" && scheduler._mode != "week") {
if (parseInt(evs[i].style.left) <= 26) {
zx = 2;
zdx += x_norm(evs[i].style.left)-1;
}
if (evs[i].parentNode == scheduler._els.dhx_cal_data[0]) continue;
zx += x_norm(evs[i].parentNode.style.left);
zx -= x_norm(51);
} else {
zdy = parseInt(evs[i].offsetHeight);
zy = parseInt(evs[i].style.top) - 22;
if(scheduler._mode == "month" ){
day = de_day(evs[i],day);
week = de_week(evs[i],week);
}
}
xml += "\n";
if (e_type == "event") {
xml += "";
var text_color = colors?get_style(evs[i].childNodes[2],"color"):"";
var bg_color = colors?get_style(evs[i].childNodes[2],"backgroundColor"):"";
xml += "";
} else {
var text_color = colors?get_style(evs[i],"color"):"";
var bg_color = colors?get_style(evs[i],"backgroundColor"):"";
xml += "";
}
xml += "";
}
}
return xml;
}
function xml_end(){
var xml = "";
return xml;
}
var uid = (new Date()).valueOf();
var d=document.createElement("div");
d.style.display="none";
document.body.appendChild(d);
d.innerHTML = '
';
document.getElementById(uid).firstChild.value = xml_top(mode).replace("\u2013", "-") + xml_body() + xml_end();
document.getElementById(uid).submit();
d.parentNode.removeChild(d);grid = null;
}