001.
<table width=
"490"
border=
"0"
align=
"center"
cellpadding=
"0"
cellspacing=
"0"
>
002.
<tr>
003.
<td>
004.
<table width=
"490"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
005.
<tr>
006.
<td width=
"20%"
height=
"35"
align=
"center"
>
007.
008.
<font color=
"#0000FF"
size=
"4"
>
009.
010.
เช็คห้องว่าง</font>
011.
<table width=
"100%"
border=
"0"
align=
"center"
cellpadding=
"0"
cellspacing=
"0"
class
=
"calendar"
>
012.
<tr>
013.
<td>
014.
<table width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
015.
<tr bgcolor=
"#004080"
class
=
"title"
>
016.
<td width=
"11%"
align=
"center"
bgcolor=
"#9C9A31"
class
=
"title"
><a href=
"<?php echo "
$PHP_SELF
?Y=
$cal_prev_year
&m=
$cal_prev_month
&d=
$cal_day
" ?><? echo"
&home_code=
$home_code
" ?>"
>BACK</a></td>
017.
<td width=
"78%"
height=
"30"
align=
"center"
bgcolor=
"#9C9A31"
><font face=
"Tahoma"
color=
"#FFFFFF"
size=
"3"
><?php
echo
$_month_name
[
$cal_month
].
" - "
.(
$cal_year
+543);?></font></td>
018.
<td width=
"11%"
align=
"center"
bgcolor=
"#999933"
class
=
"title"
><a href=
"<?php echo "
$PHP_SELF
?Y=
".$cal_next_year."
&m=
".$cal_next_month."
&d=
".$cal_day;?><? echo"
&home_code=
$home_code
" ?>"
>NEXT</a></td>
019.
</tr>
020.
</table>
021.
<!-- ตารางแสดงปฏิทิน -->
022.
<table width=
"490"
border=
"0"
align=
"center"
cellpadding=
"0"
cellspacing=
"2"
bgcolor=
"#99CC33"
class
=
"overview"
>
023.
<tr>
024.
<td width=
"70"
height=
"25"
align=
"center"
class
=
"dayname"
><strong>จันทร์</strong></td>
025.
<td width=
"70"
align=
"center"
class
=
"dayname"
><strong>อังคาร</strong></td>
026.
<td width=
"70"
align=
"center"
class
=
"dayname"
><strong>พุธ</strong></td>
027.
<td width=
"70"
align=
"center"
class
=
"dayname"
><strong>พฤหัสบดี</strong></td>
028.
<td width=
"70"
align=
"center"
class
=
"dayname"
><strong>ศุกร์</strong></td>
029.
<td width=
"70"
align=
"center"
class
=
"dayname"
><strong>เสาร์</strong></td>
030.
<td width=
"70"
align=
"center"
class
=
"dayname"
><strong>อาทิตย์</strong></td>
031.
</tr>
032.
<?php
033.
require_once
(
'Connections/connresort.php'
);
034.
mysql_select_db(
$database_connresort
,
$connresort
);
035.
$query_rsCal
=
"select start,end ,order_status from mycalendar where home_code='$home_code' "
;
036.
$rsCal
= mysql_query(
$query_rsCal
,
$connresort
)
or
die
(mysql_error());
037.
$row_rsCal
= mysql_fetch_assoc(
$rsCal
);
038.
039.
040.
041.
$st
=
array
();
$ed
=
array
();
042.
$i
=0;
043.
do
{
044.
$st
[
$i
]=
$row_rsCal
[
'start'
];
045.
$ed
[
$i
]=
$row_rsCal
[
'end'
];
046.
$i
++;}
while
(
$row_rsCal
= mysql_fetch_assoc(
$rsCal
));
047.
048.
for
(
$i
=0;
$i
<
count
(
$st
);
$i
++)
049.
{
050.
$ed
[
$i
]=
substr
(
$ed
[
$i
],0,4).
substr
(
$ed
[
$i
],5,2).
substr
(
$ed
[
$i
],8,2);
051.
$st
[
$i
]=
substr
(
$st
[
$i
],0,4).
substr
(
$st
[
$i
],5,2).
substr
(
$st
[
$i
],8,2);
052.
}
053.
054.
if
( (
$cal_year
==
$cur_year
) && (
$cal_month
==
$cur_month
) )
055.
{
056.
$today_day
=
$cur_day
;
057.
}
else
$today_day
= 0;
058.
059.
$days_last_month
= num_days(
$cal_prev_year
,
$cal_prev_month
);
060.
$days_this_month
= num_days(
$cal_year
,
$cal_month
);
061.
$first_day_pos
=
date
(
"w"
,
mktime
( 0,0,0,
$cal_month
,1,
$cal_year
) );
062.
063.
if
(
$first_day_pos
== 0 )
$first_day_pos
= 7;
064.
$day_num
=
$days_last_month
- (
$first_day_pos
-2);
065.
$class
=
"last_month"
;
066.
$p
=
array
();
067.
068.
for
(
$y
=1;
$y
<=5;
$y
++ )
069.
{
070.
echo
"<tr>"
;
071.
for
(
$x
=1;
$x
<=7;
$x
++ )
072.
{
073.
if
( (
$y
==1) && (
$x
==
$first_day_pos
) )
074.
{
075.
$day_num
= 1;
$class
=
""
;
076.
}
077.
if
( (
$y
>1) && (
$day_num
>
$days_this_month
) )
078.
{
079.
$day_num
= 1;
$class
=
"next_month"
;
080.
}
081.
if
( (
$class
==
""
) && (
$day_num
==
$today_day
) )
082.
{
083.
$id
=
"today"
;
084.
}
else
$id
=
""
;
085.
if
(
$class
==
""
){
086.
if
(
$cal_month
<=9)
087.
$mm
=
"0"
.
$cal_month
;
088.
else
$mm
=
$cal_month
;
089.
090.
if
(
$day_num
<=9)
091.
$dd
=
"0"
.
$day_num
;
092.
else
$dd
=
$day_num
;
093.
$times
=
$cal_year
.
"-"
.
$mm
.
"-"
.
$dd
;
094.
}
095.
$cur_day
=
$cal_year
.
$mm
.
$dd
;
096.
for
(
$i
=0;
$i
<
count
(
$st
);
$i
++){
097.
if
((
$cur_day
>=
$st
[
$i
])&&(
$cur_day
<=
$ed
[
$i
])){
098.
$p
[
$day_num
]=1;
099.
}
100.
}
101.
if
(
$p
[
$day_num
]==1&&
$class
==
""
){
102.
?>
103.
<td height=
"50"
align=
"center"
class
=<?
echo
" $class"
; ?> id=<?
echo
" $id"
; ?>><font color=#FFFFFF size=3><B><?
echo
"$day_num"
; ?></B></font></td>
104.
<? }
else
{
echo
"<td height=50 class='"
.
$class
.
"' id='"
.
$id
.
"' bgcolor=#FFFFFF><div align='center'>"
.
$day_num
.
"</div></td>"
;
105.
}
106.
$day_num
++;
107.
}
108.
echo
"</tr>"
;
109.
}
110.
111.
112.
?><!--สิ้นสุดปฏิทินเหตุการณ์ -->
113.
</table>
114.
</td>
115.
</tr>
116.
</table>
117.
</td></tr></table></td>
118.
</tr>
119.
</table>