var gantUI = function(){ var self = this; var temp2 = new Array(); var xmlhttp = false; var content = new Array(); var startDate = new String(); this.retrieve = function(page){ try{ xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); }catch(e){ try{ xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); }catch(e){ xmlhttp = false; } } if(!xmlhttp && XMLHttpRequest != undefined){ xmlhttp = new XMLHttpRequest(); } var file = 'retrieveData.php'; xmlhttp.open('GET', file, true); xmlhttp.onreadystatechange = function() { tempContent = xmlhttp.responseText; } file = 'today.php'; xmlhttp.open('GET', file, true); xmlhttp.onreadystatechange = function(){ startDate = xmlhttp.responseText.substr(0,10); } tempContent = tempContent.split('
'); for(i = 0; i < tempContent.length; i++){ content.push(tempContent[i].split(',')); } for(i = 0; i < content.length; i++){ x = self.horizontal(); var temp3 = self.gantBar(content[i]); for(p = 0; p < temp3.length; p++){ x.appendChild(temp3[p]); temp2.push(x); } page.appendChild(temp2[i]); test = document.createElement('div'); } } this.horizontal = function(){ var horizontal = document.createElement('div'); horizontal.setAttribute('class','horizontal'); horizontal.style.display = 'block'; return horizontal; } this.gantBar = function(content){ var name = content[4] + ' ' + content[5]; var estimatedEnd = String(content[2]); estimatedEnd = estimatedEnd.substr(0,10); document.write(content[3]); var endDate = String(content[3]); endDate = endDate.substr(0,10); var locStart = String(content[1]); locStart = locStart.substr(0,10); var width = 10;//p_width; var height = 5; var color = "#444444"; var gants = new Array(); // var text = document.createTextNode(p_text); if(locStart < startDate){ startDate = String(locStart); } gants.push(document.createElement('div')); gants[0].setAttribute('class','person'); gants[0].style.width = width; gants[0].style.height = height; gants[0].style.display = 'inline'; gantsCreated = 1; for(i = startDate.substr(0,10); i < endDate.substr(0,10); i++){ if(locStart.substr(0,10) >= i && i <= endDate.substr(0,10)){ gants.push(document.createElement('div')); gants[gantsCreated].setAttribute('class','usedGant'); gants[gantsCreated].height = height; gants[gantsCreated].style.display = 'inline'; } else if(i < locStart.substr(0,10)){ gants.push(document.createElement('div')); gants[gantsCreated].setAttribute('class',' notUsedGant'); gants[gantsCreated].height = height; gants[gantsCreated].style.display = 'inline'; } else if(i > endDate.substr(0,10)){ gants.push(document.createElement('div')); gants[gantsCreated].setAttribute('class','notUsedGant'); gants[gantsCreated].height = height; gants[gantsCreated].style.display = 'inline'; } gantsCreated++; } return gants; } this.getHorizontals = function(){ return temp2; } }