|
|
|
|
<%
'load the passed date or set it to days date
if request("this_date")="" then
this_date=date()
else
this_date=cdate(request("this_date"))
end if
if request("new_year")<>"" then this_date=cdate(request("new_month")&"/01/"&request("new_year"))
if request("view")=1 then
rows=1 'row span
xto=1 'y loop to
else
rows=5 'row span
xto=5 'y loop to
end if
'open the connection to the database
set cal_connection = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
set rs2 = Server.CreateObject("ADODB.Recordset")
cal_connection.Open "DBQ=" & Server.Mappath("./db/ACT.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
%>
<%
select case datepart("m",this_date)
case 1
pmonth="January"
case 2
pmonth="February"
case 3
pmonth="March"
case 4
pmonth="April"
case 5
pmonth="May"
case 6
pmonth="June"
case 7
pmonth="July"
case 8
pmonth="August"
case 9
pmonth="September"
case 10
pmonth="October"
case 11
pmonth="November"
case 12
pmonth="December"
end select
%>
Calendar of Classes click here for more <%=pmonth%> <%=datepart("yyyy",this_date)%>
| SUN |
MON |
TUE |
WED |
THUR |
FRI |
SAT |
<%
'print out the calendar body
'today is today
this_month=datepart("m",this_date)
week_day=datepart("w",this_date)
today=datepart("d",this_date)
first_day_month=datepart("w", dateadd("d",-today+1,this_date))
'sets the starting date to print
if xto<>1 then
z= -1*(first_day_month+today-1)
else
z= -7
end if
x=0
'x is the number of rows
do while x < xto
if x<>0 then response.write " "
'this is the calendar cells
y=0
'y is the number of cols
do while y < 7
z=z+1
color="#ffffff"
print_day=datepart("d", dateadd("d",z,this_date))
print_month=datepart("m", dateadd("d",z,this_date))
print_year=datepart("yyyy", dateadd("d",z,this_date))
print_date=cdate(print_month&"/"&print_day&"/"&print_year)
'changes background color
if datepart("w", print_date) = 1 then color="#CC9966"
if datepart("w", print_date) = 7 then color="#CC9966"
if datepart("m", dateadd("d",z,this_date)) <> this_month then color="#CC9933"
if print_date=date() then color="#Cb9663"
%>
|
<%=print_day%>
<%
'prints out day items
q = "Select * from schedule where ((schedule.sDate)=#"&cdate(print_date)&"#) order by sTime;"
'response.write q
rs.open q,cal_connection
do while not rs.eof
if not rs.eof then
q2 = "Select * from courses where pkey="&rs("Class")
'response.write q2
rs2.open q2,cal_connection
title=rs2("id")
rs2.close
end if
%>
&title=<%=title%>','','height=350,width=350,left=0,top=0,scrollbars=yes');">
<%=title%> (<%=rs("sTime")%>)
<%
rs.movenext
loop
rs.close
%>
|
<%
y=y+1
loop
'prints last cell
if xto<>1 then
%>
<%
else
%><%
end if
x=x+1
loop
cal_connection.close
%>
|
|