<% '******************************************************************** ' Name: Calendar.asp ' ' Purpose: Main calendar page that shows events in a calendar format ' '******************************************************************** dim dbConn, rs, nDex, nMonth, nYear, dtDate ' Get the current date dtDate = Now() ' Set the Month and Year nMonth = Request.QueryString("nMonth") nYear = Request.QueryString("nYear") if nMonth = "" then nMonth = Month(dtDate) if nYear = "" then nYear = Year(dtDate) ' Set the date to the first of the current month dtDate = DateSerial(nYear, nMonth, 1) set conn=server.createobject("adodb.connection") conn.open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\") & "\data\NothingToIt.mdb;UID=;PWD=;" SQL = "SELECT [class_datetime_tbl].[class_datetime_id] as vcHyperlink, [class_datetime_tbl].[class_datetime] as nDay, [class_tbl].[class_name] as vcEvent FROM class_tbl INNER JOIN class_datetime_tbl ON [class_tbl].[class_id] =[class_datetime_tbl].[class_id] Where year([class_datetime_tbl].[class_datetime]) = "&nYear&" and month([class_datetime_tbl].[class_datetime]) = "&nMonth&" ORDER BY day([class_datetime_tbl].[class_datetime]);"'&nMonth&"' and year([class_datetime_tbl].[class_datetime])= '"&nYear&"';" 'SQL = "SELECT idschedule, dtdate AS nday, vcEvent, vcHyperlink from schedule WHERE month(dtdate) = '"&nMonth&"' and year(dtdate) = '"&nYear&"'" Set rs = server.createobject("ADODB.recordset") rs.open SQL, Conn 'dbConn.Execute ("GetSchedule " & nMonth & ", " & nYear) DoHeader(MonthName(Month(dtDate)) & "  " & nYear) %>
 
<- Previous Month     <%=MonthName(nMonth)%> Next Month - >
<%DoHeader(MonthName(Month(dtDate)) & "  " & nYear) %> <% ' Add blank cells until the proper day for nDex = 1 to Weekday(dtDate) - 1 Response.Write "" next do Response.Write "" if WeekDay(dtDate) = 7 then Response.Write "" & vbCrLf & "" end if dtDate = DateAdd("d", 1, dtDate) loop until (Month(dtDate) <> CInt(nMonth)) ' Add blank cells to fill out the rest of the month if needed if Weekday(dtDate) <> 1 then for nDex = Weekday(dtDate) to 7 Response.Write "" next end if %>
  Sunday     Monday    Tuesday   Wednesday  Thursday    Friday    Saturday 
 " & ""&Day(dtDate)&"" & "
" if not rs.EOF then do 'response.write CInt(day(rs("nDay"))) & "=" & Cint(day(dtDate)) & "
" if CInt(day(rs("nDay"))) <> CInt(Day(dtDate)) then exit do Response.Write "•"& rs("vcEvent") & "@" &trimseconds(timevalue(rs("nday"))) Response.Write "
" rs.MoveNext if rs.EOF then exit do loop end if Response.Write "
 
<- Previous Month Next Month - >
<% DoFooter("Home") %>