// distruggere FP se esiste
//$this->resultPunto("if (dojo.widget.byId('WIDAID11FPCALENDAR')) dojo.widget.byId('WIDAID11FPCALENDAR').destroy();");
//$this->resultPunto("if (dojo.widget.byId('WIDAID11CPCALENDARINT')) dojo.widget.byId('WIDAID11CPCALENDARINT').destroy();");
// creare FP
//$this->resultPunto("var AID11DIVCALENDAR = document.createElement('div');");
//$this->resultPunto("AID11DIVCALENDAR.id='IDAID11DIVCONFIG';");
//$this->resultPunto("AID11DIVCALENDAR.setAttribute('id','IDAID11DIVCALENDAR');");
//$this->resultPunto("AID11DIVCALENDAR.style['width']='640px';");
//$this->resultPunto("AID11DIVCALENDAR.style['height']='650px';");
//$this->resultPunto("AID11DIVCALENDAR.style['left']='355px';");
//$this->resultPunto("AID11DIVCALENDAR.style['top']='10px';");
//$this->resultPunto("AID11DIVCALENDAR.style['id']='IDAID11DIVCALENDAR';");
//$this->resultPunto("document.getElementById('DIVAID11BIDKERNEL').appendChild(AID11DIVCALENDAR);");
$this->resultPunto("var AID11DIVCALENDAR = $('IDAID11DIVCALENDAR');var AID11FPCALENDAR = dojo.widget.createWidget('ContentPane',{id:'IDAID11FPCALENDAR', widgetId:'WIDAID11FPCALENDAR'},AID11DIVCALENDAR);");
$this->resultPunto("AID11FPCALENDAR.setContent(\\\"<div dojoType='ContentPane' id='IDAID11CPCALENDARINT' widgetId='WIDAID11CPCALENDARINT'></div>\\\");");
$this->resultPunto("dojo.widget.byId('WIDAID11CPCALENDARINT').setContent(\\\"<table valign='top' align='center' width='100%' height='100%' style='border:0px solid #b4bed2;background-color:#b4bed2;border-color:#b4bed2;' CELLSPACING='0' CELLPADDING='0' border='0'><tr height='15'><td><table valign='top' align='center' width='100%' height='100%' style='border:0px;background-color:#b4bed2;' CELLSPACING='0' CELLPADDING='0' border='0'><tr valign='top' background='../framework/furoros/share/APP/AID11/GUI_FT/IMAGES/ft-head.gif'><td><button widgetId='CALENDAR_LABEL_PREVPREV' dojoType='Button' onclick=\\\\\\\"furoros.Runmodule('11','EVENT_CALENDAR_BUTTON_PREVPREV','APP','')\\\\\\\"><img  border='0' src='../framework/furoros/share/APP/AID11/GUI_CALENDAR/IMAGES/prevprev.gif'>&nbsp;<span id='CALENDAR_LABEL_PREVPREV'>leggo la data</span></button></td><td><button  widgetId='CALENDAR_LABEL_PREV' dojoType='Button' onclick=\\\\\\\"furoros.Runmodule('11','EVENT_CALENDAR_BUTTON_PREV','APP','')\\\\\\\"><img  border='0' src='../framework/furoros/share/APP/AID11/GUI_CALENDAR/IMAGES/prev.gif'>&nbsp;<span id='CALENDAR_LABEL_PREV'>leggo la data</span></button></td><td align='center' width='50%' colspan='2'>&nbsp;<span id='CALENDAR_LABEL_MONTH'>leggo il mese</span>&nbsp;<span id='CALENDAR_LABEL_YEAR'>leggo anno</span></td><td><button dojoType='Button'  widgetId='CALENDAR_LABEL_NEXT' onclick=\\\\\\\"furoros.Runmodule('11','EVENT_CALENDAR_BUTTON_NEXT','APP','')\\\\\\\"><img  border='0' src='../framework/furoros/share/APP/AID11/GUI_CALENDAR/IMAGES/next.gif'>&nbsp;<span id='CALENDAR_LABEL_NEXT'>leggo la data</span></button></td><td><button  widgetId='CALENDAR_LABEL_NEXTNEXT' dojoType='Button' onclick=\\\\\\\"furoros.Runmodule('11','EVENT_CALENDAR_BUTTON_NEXTNEXT','APP','')\\\\\\\"><img  border='0' src='../framework/furoros/share/APP/AID11/GUI_CALENDAR/IMAGES/nextnext.gif'>&nbsp;<span id='CALENDAR_LABEL_NEXTNEXT'>leggo la data</span></button></td></tr></table></td></tr><tr height='15'><td><table valign='top' align='center'  height='100%' style='border:0px;background-color:#b4bed2;' CELLSPACING='0' CELLPADDING='0' border='0'><tr valign='top' background='../framework/furoros/share/APP/AID11/GUI_FT/IMAGES/ft-head.gif'><td><button dojoType='Button' onclick=\\\\\\\"furoros.Runmodule('11','EVENT_CALENDAR_BUTTON_DAY','APP','')\\\\\\\"><img  border='0' src='../framework/furoros/share/APP/AID11/GUI_CALENDAR/IMAGES/calendar_view_day.gif'>&nbsp;GIORNO</button></td><td><button dojoType='Button' onclick=\\\\\\\"furoros.Runmodule('11','EVENT_CALENDAR_BUTTON_WEEK','APP','')\\\\\\\"><img  border='0' src='../framework/furoros/share/APP/AID11/GUI_CALENDAR/IMAGES/calendar_view_week.gif'>&nbsp;SETTIMANA</button></td><td><button dojoType='Button' onclick=\\\\\\\"furoros.Runmodule('11','EVENT_CALENDAR_BUTTON_MONTH','APP','')\\\\\\\"><img  border='0' src='../framework/furoros/share/APP/AID11/GUI_CALENDAR/IMAGES/calendar_view_month.gif'>&nbsp;MESE</button></td><td><button dojoType='Button' onclick=\\\\\\\"furoros.Runmodule('11','EVENT_CALENDAR_BUTTON_TODAY','APP','')\\\\\\\"><img  border='0' src='../framework/furoros/share/APP/AID11/GUI_CALENDAR/IMAGES/calendar_view_today.gif'>&nbsp;OGGI</button></td></tr></table></td></tr><tr valign='top' height='100%'><td align='left' valign='top'><div dojoType='ContentPane' widgetId='CALENDARMAIN' ></div></td></tr></table>\\\");");
$this->resultPunto("var tmpDate=new Date();");
$this->resultPunto("dojo.require('dojo.date.common');");
$this->resultPunto("dojo.require('dojo.date.format');");
$this->resultPunto("dojo.require('dojo.date.serialize');");

$this->resultPunto("dojo.widget.byId('CALENDARMAIN').setContent(\\\"<div class='boxgray'><table   valign='top' align='center' style='border:0px;background-color:#b4bed2;' CELLSPACING='0' CELLPADDING='0' border='0'><tr valign='top'><td rowspan='2'><span style='font-size:26px;'>\\\"+tmpDate.getDate()+\\\"</span></td><td>\\\"+dojo.date.format(tmpDate, {datePattern:'eeee', selector:'dateOnly', locale:''})+\\\"</td></tr><tr><td>\\\"+dojo.date.format(tmpDate, {datePattern:'MMMM yyyy', selector:'dateOnly', locale:''})+\\\"</td></tr></table></div>\\\");");
// prendere namespace per variabili del CALENDAR
$this->resultPunto("arrayData['AIP'][11]['CALENDAR']= new Array();");
$this->resultPunto("arrayData['AIP'][11]['CALENDAR']['MODE'] = 'day';");
$this->resultPunto("arrayData['AIP'][11]['CALENDAR']['DATAFIRST'] = new Date();");
$this->resultPunto("arrayData['AIP'][11]['CALENDAR']['DATATODAY'] = new Date();");
$this->resultPunto("arrayData['AIP'][11]['CALENDAR']['APP'] = new Array();");
// leggere gli appuntamenti
$mysql12 = new Mysql();
$mysql12 ->Database='AID11';
$mysql12 ->connect();
$this->resultPunto("arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'] = new Array();");
//$this->resultPunto("arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL']['ID'] = new Array();");
//$this->resultPunto("arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL']['TIME'] = new Array();");
$resMysql12 = $mysql12 -> query("SELECT ID,DATE_FORMAT(DATE,'%d-%m-%Y') AS DATE,CLIENT,SPEC,SPECSPEC,PERSONAL,ROOM,LEFT(TIME_BEGIN,5) AS TIME_BEGIN,LEFT(TIME_END,5) AS TIME_END,STATUS FROM OS_DATA_APP ORDER BY DATE,TIME_BEGIN");
while ($linea12 = mysql_fetch_array($resMysql12, MYSQL_ASSOC))
{	$this->resultPunto("dojo.debug('pers '+".$linea12['PERSONAL'].");");
	$this->resultPunto("if (!arrayData['AIP'][11]['CALENDAR']['APP'][".$linea12['PERSONAL']."]) arrayData['AIP'][11]['CALENDAR']['APP'][".$linea12['PERSONAL']."] = new Array();");
	$this->resultPunto("if (!arrayData['AIP'][11]['CALENDAR']['APP'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']) arrayData['AIP'][11]['CALENDAR']['APP'][".$linea12['PERSONAL']."]['".$linea12['DATE']."'] = new Array();");
	$this->resultPunto("if (!arrayData['AIP'][11]['CALENDAR']['APP'][".$linea12['PERSONAL']."]['".$linea12['DATE']."'][".$linea12['ID']."]) arrayData['AIP'][11]['CALENDAR']['APP'][".$linea12['PERSONAL']."]['".$linea12['DATE']."'][".$linea12['ID']."] = new Array();");
	$this->resultPunto("arrayData['AIP'][11]['CALENDAR']['APP'][".$linea12['PERSONAL']."]['".$linea12['DATE']."'][".$linea12['ID']."]['TIME_BEGIN'] = '".$linea12['TIME_BEGIN']."';");
	$this->resultPunto("arrayData['AIP'][11]['CALENDAR']['APP'][".$linea12['PERSONAL']."]['".$linea12['DATE']."'][".$linea12['ID']."]['TIME_END'] = '".$linea12['TIME_END']."';");
	$this->resultPunto("arrayData['AIP'][11]['CALENDAR']['APP'][".$linea12['PERSONAL']."]['".$linea12['DATE']."'][".$linea12['ID']."]['STATUS'] = '".$linea12['STATUS']."';");
	// visualizzazione
	$this->resultPunto("if (!arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."])arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."] = new Array();");
	$this->resultPunto("if (!arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."'])arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']= new Array();");
	$this->resultPunto("if (!arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['ID'])arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['ID']= new Array();");
	$this->resultPunto("if (!arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['TIME'])arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['TIME']= new Array();");
	$this->resultPunto("if (arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['ID'].length==0) {arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['ID'][0]=".$linea12['ID'].";arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['TIME'][0]='".$linea12['TIME_BEGIN']."';} else{var count=0;var put=0; for (var i in arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['ID']) {count++;if (arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['TIME'][i]>'".$linea12['TIME_BEGIN']."') {arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['ID'].splice(i,0,".$linea12['ID'].");arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['TIME'].splice(i,0,'".$linea12['TIME_BEGIN']."');put=1;break;}};if (put==0){arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['ID'][count]=".$linea12['ID'].";arrayData['AIP'][11]['CALENDAR']['APP']['VISUAL'][".$linea12['PERSONAL']."]['".$linea12['DATE']."']['TIME'][count]='".$linea12['TIME_BEGIN']."';}}");
}
mysql_free_result($mysql12->Query_ID);
				