Hacked By AnonymousFox

Current Path : C:/AppServ/www/th/lib/calendar/
Upload File :
Current File : C:/AppServ/www/th/lib/calendar/test.php

<?
include("../../webengine/lib/session.php"); 
include("../../webengine/lib/config.php");
include("../../webengine/lib/connect.php");
include("../../webengine/lib/function.php");
$Language="Thai";
$SystemModuleKey="Calendar";
include("../../webengine/mod_calendar/config.php");
include("config.php");
include("function.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
</head>

<body>
<script src="../../webengine/lib/picker.js"></script>	
<? 
	$myModule_Table=$myModule_Table1;
	if($myCalendarDate=="") { $myCalendarDate=getDateNow(); }
	$myCalendarDateArray = explode("-",$myCalendarDate);

	// Find Start Week Day ##############################################
	$today=getdate(mktime(0,0,0,$myCalendarDateArray[1],1,$myCalendarDateArray[0]));

	$NextMonthArray=getdate(mktime(0,0,0,$myCalendarDateArray[1]+1,1,$myCalendarDateArray[0]));
	$Day=$NextMonthArray[mday]; $Month=$NextMonthArray[mon]; $Year=$NextMonthArray[year];
	$NextMonth=sprintf("%04d-%02d-%02d",$Year,$Month,$Day);

	$PrevMonthArray=getdate(mktime(0,0,0,$myCalendarDateArray[1]-1,1,$myCalendarDateArray[0]));
	$Day=$PrevMonthArray[mday]; $Month=$PrevMonthArray[mon]; $Year=$PrevMonthArray[year];
	$PrevMonth=sprintf("%04d-%02d-%02d",$Year,$Month,$Day);

	$startWeekDay=$today[wday];
	$myCalendarDateYear=$today[year];
	$myCalendarDateMonth=$today[mon];
	$endDayOfMonth=getEndDayOfMonth($myCalendarDate);

	$myStartDateOfMonth = sprintf("%04d-%02d-%02d",$myCalendarDateArray[0],$myCalendarDateArray[1],1);
	$myEndDateOfMonth = sprintf("%04d-%02d-%02d",$myCalendarDateArray[0],$myCalendarDateArray[1],$endDayOfMonth);

	$myCalendarData[0]="";
	$myCalendarEventCounter[0]=0;

	// Load activity data #################################################
	$sql  = "SELECT * FROM ".$myModule_Table." WHERE ";
	$sql .= $myModule_Table."_Language='$Language' AND ";
	$sql .= $myModule_Table."_ModuleKey='$SystemModuleKey' AND ";
	$sql .= $myModule_Table."_Status!='Disable' AND ";
	$sql .= " ( ";
	$sql .= " ( ".$myModule_Table."_DateFrom>='$myStartDateOfMonth' AND ".$myModule_Table."_DateFrom<='$myEndDateOfMonth' ) OR ";
	$sql .= " ( ".$myModule_Table."_DateTo>='$myStartDateOfMonth' AND ".$myModule_Table."_DateTo<='$myEndDateOfMonth' ) OR ";
	$sql .= " ( ".$myModule_Table."_DateFrom<='$myStartDateOfMonth' AND ".$myModule_Table."_DateTo>='$myEndDateOfMonth' ) ";
	$sql .= " ) ORDER BY ".$myModule_Table."_TimeFrom ASC ";
	$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: ??????????????? <br>$sql<br>\n");
	$RecordCount=MYSQL_NUMROWS($Query);
	$index=1;
	if($RecordCount>0) {
		while($index<$RecordCount+1) {
			$Row=MYSQL_FETCH_ARRAY($Query);
			if(strcmp($Row[$myModule_Table."_DateFrom"],$myStartDateOfMonth)<1) { 
				$myCalendarDateStart=$myStartDateOfMonth;
			} else {
				$myCalendarDateStart=$Row[$myModule_Table."_DateFrom"];
			}
			$myStart=substr($myCalendarDateStart,8,2)*1;
			if($Row[$myModule_Table."_DateTo"]!="0000-00-00") {
				if(strcmp($myEndDateOfMonth,$Row[$myModule_Table."_DateTo"])<1) { 
					$myCalendarDateEnd=$myEndDateOfMonth;
				} else {
					$myCalendarDateEnd=$Row[$myModule_Table."_DateTo"];
				}
			} else {
				$myCalendarDateEnd="0000-00-00";
			}

			if($myCalendarDateEnd=="0000-00-00") {
					$myCalendarEventCounter[$myStart]++;

			} else {
				$myEnd=substr($myCalendarDateEnd,8,2)*1;
				for($i=$myStart;$i<=$myEnd;$i++) {
					$myCalendarEventCounter[$i]++;

				}
			}
			$index++;
		}
	} 

	//----------- Add Special Day -----------------------
	$mySpecialDayCounter[0]=0;
	$myCalendarDateArr = explode("-",$myCalendarDate);
	//print_r( $arrySpecialDayOfMonth[$myCalendarDateArr[1]]);
	$maxSpecialDayOfMonth = count($arrySpecialDayOfMonth[$myCalendarDateArr[1]]);
	for($i=0;$i<$maxSpecialDayOfMonth;$i++) {
		
			$arry = explode(";;",$arrySpecialDayOfMonth[$myCalendarDateArr[1]][$i]);
			$mCount = $arry[0];
			$specialDayName = $arry[1];
			
			$myCalendarEventCounter[$mCount]++;
			$mySpecialDayCounter[$mCount]++;

	}
	
	// Load calendar display #############################################
	$Checktoday=date('Y-m-d');
	$mCount=1;
	?>  
	<? 
	$myCalendarDateArr = explode("-",$myCalendarDate);
   if($myCalendarDateArr[1]<1){
  $thisMonth=substr($myCalendarDateArr[1],1,1);
  }else{
  $thisMonth=$myCalendarDateArr[1];
  }
  if($thisMonth==12){
  $NextMonth="01";
  $NextYear=$myCalendarDateArr[0]+1;
  $BackMonth=11;
  $BackYear=$myCalendarDateArr[0];
  }else if($thisMonth==1){
  $NextMonth=format($thisMonth+1,2);
  $NextYear=$myCalendarDateArr[0];
  $BackMonth=12;
  $BackYear=$myCalendarDateArr[0]-1;
  }else{
  $NextMonth=format($thisMonth+1,2);
  $NextYear=$myCalendarDateArr[0];
  $BackMonth=format($thisMonth-1,2);
  $BackYear=$myCalendarDateArr[0];
  }
  //$strActionPrevious= "document.myCalendarForm.myCalendarDate.value = '".$BackYear."-".$BackMonth."-".$myCalendarDateArr[2]."' ";
  //$strActionNext = "document.myCalendarForm.myCalendarDate.value = '".$NextYear."-".$NextMonth."-".$myCalendarDateArr[2]."' ";					
  ?>
<!-- START BLOCK : CALENDAR1 -->						
<script src="../../webengine/lib/picker.js"></script>
<span id="CalendarDetail"><br>
		<table width="15%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#e5e5de">
                    <tr>
                      <td width="5" height="5" align="left" valign="top"><img src="../../images/main/m-cal-l-t.gif" width="5" height="5" /></td>
                      <td><img src="../../images/main/spacer.gif" width="5" height="5" /></td>
                      <td width="5" align="right" valign="top"><img src="../../images/main/m-cal-r-t.gif" width="5" height="5" /></td>
                    </tr>
                    <tr>
                      <td width="5" height="5"><img src="../../images/main/spacer.gif" width="5" height="5" /></td>
                      <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
		  <tr>
		
			<form action="" method="get" name="myCalendarGoForm" id="myCalendarGoForm">
			<input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
			<input name="myCalendarDate" type="hidden" id="myCalendarDate" value="<?=$myCalendarDate?>">
			</form>
			<form action="../calendar/view.php" method="get" name="myCalendarForm" id="myCalendarForm">
			<input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
			<input name="action" type="hidden" id="action">
			<input name="myCalendarDate" type="hidden" id="myCalendarDate" value="<?=$myCalendarDate?>">
			<input name="myCalendarDate_Month" type="hidden" id="myCalendarDate_Month" value="<?=$myCalendarDateArr[1]?>">
			<input name="myCalendarDate_Year" type="hidden" id="myCalendarDate_Year" value="<?=$myCalendarDateArr[0]?>">
			<input name="cid" type="hidden" id="cid" value="0">
			<td height="35" >
<!-- START BLOCK : CALENDAR_DATA_HEADER -->						
			  <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#999999">
				<tr>
				  <td width="30" height="5" align="left" valign="top"><img src="../../images/images/arrow-c_01.gif" width="3" height="3"></td>
				  <td rowspan="3" align="center" id="NameMonth"><b><?=ShowMonthYear(sprintf("%04d-%02d-%02d",$myCalendarDateArr[0],$myCalendarDateArr[1],$myCalendarDateArr[2]))?></b></td>
				  <td width="30" align="right" valign="top"><img src="../../images/images/arrow-c_03.gif" width="3" height="3"></td>
				</tr>
				<tr>
				  <td height="5" align="center"><span style="cursor:pointer " onClick="<?=$strActionPrevious?>" style="color:#FFFFFF ">&lt;&lt;</span></td>
				  <td width="30" align="center"><span style="cursor:pointer " onClick="<?=$strActionNext?>" style="color:#FFFFFF ">&gt;&gt;</span></td>
				</tr>
				  <td height="5" align="left" valign="bottom"><img src="../../images/images/arrow-c_06.gif" width="3" height="3"></td>
				  <td width="30" align="right" valign="bottom"><img src="../../images/images/arrow-c_07.gif" width="3" height="3"></td>
				</tr>
			  </table>
<!-- END BLOCK : CALENDAR_DATA_HEADER -->
			<script language='JavaScript'> document.myCalendarForm.myCalendarDate_Month.value='<?=$myCalendarDateArr[1]?>'; </script>
			<script language='JavaScript'> document.myCalendarForm.myCalendarDate_Year.value='<?=$myCalendarDateArr[0]?>'; </script>
			</td>
			</form>
		  </tr>
		  <tr>
			<td height="120" valign="top" bgcolor="#E5E5DE" style="background-repeat:no-repeat; background-position:bottom">
			  <table  width="<?=$mod_calendar_config["calendar-width"]?>" height="<?=$mod_calendar_config["calendar-height"]?>"  border="0" align="center" cellpadding="0" cellspacing="1" >
										<tr bgcolor="#FFFFFF">
										  <td width="<?=$mod_calendar_config["cell-width"]?>" height="18" align="center" bgcolor="#E5E5DE"><img src="../../images/bullet/s.gif" width="23" height="25"></td>
										  <td width="<?=$mod_calendar_config["cell-width"]?>" height="-1" align="center" bgcolor="#E5E5DE"><img src="../../images/bullet/m-th.gif" width="24" height="25"></td>
										  <td width="<?=$mod_calendar_config["cell-width"]?>" height="-1" align="center" bgcolor="#E5E5DE"><img src="../../images/bullet/tu-th.gif" width="24" height="25"></td>
										  <td width="<?=$mod_calendar_config["cell-width"]?>" height="-1" align="center" bgcolor="#E5E5DE"><img src="../../images/bullet/w-th.gif" width="24" height="25"></td>
										  <td width="<?=$mod_calendar_config["cell-width"]?>" height="-1" align="center" bgcolor="#E5E5DE"><img src="../../images/bullet/th-th.gif" width="24" height="25"></td>
										  <td width="<?=$mod_calendar_config["cell-width"]?>" height="-1" align="center" bgcolor="#E5E5DE"><img src="../../images/bullet/f-th.gif" width="24" height="25"></td>
										  <td width="<?=$mod_calendar_config["cell-width"]?>" height="-1" align="center" bgcolor="#E5E5DE"><img src="../../images/bullet/st-th.gif" width="24" height="25"></td>
			    </tr>
									<!-- START BLOCK : CALENDAR_DATA -->
										  <tr bgcolor="#B4B4A7" >
<? 
#################################
$numrow=0;
if($startWeekDay>0) {  ?>										  
	<? for($i=0;$i<$startWeekDay;$i++) { ?>
				<td  width="<?=$mod_calendar_config["cell-width"]?>" height="<?=$mod_calendar_config["cell-height"]?>" <? if($i==0){?>background="../../images/normal-left-t.gif"<? }?> ><span>&nbsp;</span></td>
	<? } ?>
<?
if($myCalendarEventCounter[$mCount-1]==0 || $myCalendarEventCounter[$mCount-1]=="") {
										//----------  Set  Right-Top  Border - Normal Day
										$bg = "background=../../images/normal-right-t.gif"; 
								}else{
										//----------  Set  Right-Top  Border - Event Day
										$bg = "background=../../images/event-right-t.gif"; 
								}
?>									
<? for($i;$i<7;$i++) { ?>
				
					<? if($myCalendarEventCounter[$mCount]==0 || $myCalendarEventCounter[$mCount]=="") { ?>
								<? 
									if($Checktoday==$myCalendarDateArr[0]."-".$myCalendarDateArr[1]."-".formatNum($mCount)) { 
										$strOption = "bgcolor=\""._ColorToday_."\" title=\"".$mod_calendar_text["Today"]."\" ";
									} else { 
										$strOption = "bgcolor=\""._ColorNormalDay_."\" ";
									} 
								?>
								<td width="<?=$mod_calendar_config["cell-width"]?>" height="<?=$mod_calendar_config["cell-height"]?>" <?=$strOption?> <? if($i==6){ echo $bg; }?>  align="center"><span><?=$mCount?></span></td>
				<? } else { ?>
								<?
									/*
									$strOption = "onClick=\"document.myCalendarForm.myCalendarDate.value=' ".sprintf("%04d-%02d-%02d",$myCalendarDateYear,$myCalendarDateMonth,$mCount)."'
									document.getElementById('idInformationDataHeader').innerHTML = '<font color=#B3AB80><b>".ShowDateLongTh(sprintf("%04d-%02d-%02d",$myCalendarDateYear,$myCalendarDateMonth,$mCount)) ."</b></font>';
									ShowInformationWindow('divInformationWindow','".addslashes($myCalendarData[$mCount])."',10-200,10);
									\" onMouseOver=\"myMouseOver(this)\" onMouseOut=\"myMouseOut(this)\" ";
									*/

									$strOption = "onClick=\"document.myCalendarForm.myCalendarDate.value='".sprintf("%04d-%02d-%02d",$myCalendarDateYear,$myCalendarDateMonth,$mCount)."'
									vars='?myCalendarDate=".sprintf("%04d-%02d-%02d",$myCalendarDateYear,$myCalendarDateMonth,$mCount)."';
									vars+='&eventClientX='+event.clientX+'&eventClientY='+event.clientY;
									vars+='&bodyScrollLeft='+document.body.scrollLeft+'&documentElementScrollLeft='+document.documentElement.scrollLeft;
									vars+='&bodyScrollTop='+document.body.scrollTop+'&documentElementScrollTop='+document.documentElement.scrollTop;
									submitXMLHttp('../calendar/calendardetail.php'+vars,getXMLHttpData2);
									\" onMouseOver=\"myMouseOver(this)\" onMouseOut=\"myMouseOut(this)\" 
									";

									if($Checktoday==$myCalendarDateArr[0]."-".$myCalendarDateArr[1]."-".formatNum($mCount)) { 
											$strOption .= "bgcolor=\""._ColorToday_."\" title=\"".$mod_calendar_text["Today"]."\" ";
									} else if($mySpecialDayCounter[$mCount]==0 || $mySpecialDayCounter[$mCount]=="") { 
											$strOption .= "bgcolor=\""._ColorEventDay_."\" ";
									} else {
											$strOption .= "bgcolor=\""._ColorSpecialDay_."\" ";
									}
								?>
								<td width="<?=$mod_calendar_config["cell-width"]?>" height="<?=$mod_calendar_config["cell-height"]?>" <?=$strOption?> <? if($i==6){ echo $bg; }?> align="center"><span><?=$mCount?></span></td>
				<? } ?>
				<?
				$mCount++;
		} // for

} // end startWeekDay
?>										  
										  </tr>
<?
$colcount=0;
for($mCount;$mCount<=$endDayOfMonth;$mCount++) {
	if($colcount==0) {
		?>
                              <tr> 
                                <?
				if($mCount==1){ 
						if($myCalendarEventCounter[$mCount]==0 || $myCalendarEventCounter[$mCount]=="") {
								//----------  Set  Left-Top  Border - Normal Day
								$bg = "background=../../images/normal-left-t.gif"; 
						}else{
								//----------  Set  Left-Top  Border - Event Day
								$bg = "background=../../images/event-left-t.gif"; 
						}
			    }
	}
	$colcount++;
	?>
                                <?
	if($myCalendarEventCounter[$mCount]==0 || $myCalendarEventCounter[$mCount]=="") { ?>
	<? 
					if($Checktoday==$myCalendarDateArr[0]."-".$myCalendarDateArr[1]."-".formatNum($mCount)) { 
						$strOption = "bgcolor=\""._ColorToday_."\" title=\"".$mod_calendar_text["Today"]."\" ";
					} else { 
						$strOption = "bgcolor=\""._ColorNormalDay_."\" ";
					} 
				?>
                                <td width="<?=$mod_calendar_config["cell-width"]?>" height="<?=$mod_calendar_config["cell-height"]?>" <?=$strOption?> <? if($mCount==1){ echo $bg; }?> align="center"><?=$mCount?><? if($mCount==27 && $colcount==4){echo "+";}?></td>
                                <? } else { ?>
					<?
					$strOption = "onClick=\"document.myCalendarForm.myCalendarDate.value='".sprintf("%04d-%02d-%02d",$myCalendarDateYear,$myCalendarDateMonth,$mCount)."'
						document.myCalendarForm.myCalendarDate_Day.value='".$mCount."';
						vars='myCalendarDate=".sprintf("%04d-%02d-%02d",$myCalendarDateYear,$myCalendarDateMonth,$mCount)."';
						vars+='&action=ShowOneDay';
						submitXMLHttp2('../calendar/big-calendardetail.php',vars,getXMLHttpData2);
						\" onMouseOver=\"myMouseOver(this)\" onMouseOut=\"myMouseOut(this)\" 
						";

					if($Checktoday==$myCalendarDateArr[0]."-".$myCalendarDateArr[1]."-".formatNum($mCount)) { 
							$strOption .= "bgcolor=\""._ColorToday_."\" title=\"".$mod_calendar_text["Today"]."\" ";
					} else if($mySpecialDayCounter[$mCount]==0 || $mySpecialDayCounter[$mCount]=="") { 
							$strOption .= "bgcolor=\""._BigColorEventDay_."\" ";
					} else {
							$strOption .= "bgcolor=\""._ColorSpecialDay_."\" ";
					}
					?>
                                <td width="<?=$mod_calendar_config["cell-width"]?>" height="<?=$mod_calendar_config["cell-height"]?>" <?=$strOption?> <? if($mCount==1){ echo $bg; }?>  align="center"> <?=$mCount?></td>
                                <? } ?>
	<?
	if($colcount==7) {
	?>
                              </tr>
                              <?
		$colcount=0;
	}
}
if($colcount>0) {
	for($colcount;$colcount<7;$colcount++) {
		?>
		<td width="<?=$mod_calendar_config["cell-width"]?>" height="<?=$mod_calendar_config["cell-height"]?>" <? if($colcount == 6){ ?>background="../../images/normal-right-b.gif"<? }else{ ?>bgcolor=<?=_ColorNextMonthDay_?><? } ?>>&nbsp;</td>
		<?
	}
	?>
	</tr>
	<?
}
?>										  
									<!-- END BLOCK : CALENDAR_DATA -->	  
		    </table>		</td>
		  </tr>
</table></td>
                        </tr>
                      </table></td>
                      <td width="5"><img src="../../images/main/spacer.gif" width="5" height="5" /></td>
                    </tr>
                    <tr>
                      <td width="5" height="5" align="left" valign="bottom"><img src="../../images/main/m-cal-l-b.gif" width="5" height="5" /></td>
                      <td><img src="../../images/main/spacer.gif" width="5" height="5" /></td>
                      <td width="5" height="5" align="right" valign="bottom"><img src="../../images/main/m-cal-r-b.gif" width="5" height="5" /></td>
                    </tr>
</table>
				  
</span>
<script language="JavaScript" src="../../webengine/lib/XMLHttpObject.js"></script>
<script language="JavaScript" src="../calendar/cal-function.js"></script>
<!-- END BLOCK : CALENDAR1 -->						
</body>
</html>

Hacked By AnonymousFox1.0, Coded By AnonymousFox