%Option Explicit%>
<%
If Request.Form("AddEvent") = "Ajoutez" Then
Response.Redirect("add_event.asp")
End If
If Request.Form("EditEvent") = "Edit Event" Then
Response.Redirect("edit_event.asp")
End If
If Request.Form("Logout") = "Logout" Then
Response.Redirect("logout.asp")
End If
Dim DB_CONNECTIONSTRING
Dim objRecordset
DB_CONNECTIONSTRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("users.mdb") & ";"
Set objRecordset = Server.CreateObject("ADODB.Recordset")
objRecordset.Open "calendar", DB_CONNECTIONSTRING, adOpenStatic, adLockPessimistic, adCmdTable
%>
<%
Function GetDaysInMonth(iMonth, iYear)
Dim dTemp
dTemp = DateAdd("d", -1, DateSerial(iYear, iMonth + 1, 1))
GetDaysInMonth = Day(dTemp)
End Function
Function GetWeekdayMonthStartsOn(iMonth, iYear)
GetWeekdayMonthStartsOn = WeekDay(CDate(iMonth & "/1/" & iYear))
End Function
Function SubtractOneMonth(dDate)
Dim iDay, iMonth, iYear
iDay = Day(dDate)
iMonth = Month(dDate)
iYear = Year(dDate)
If iMonth = 1 Then
iMonth = 12
iYear = iYear - 1
Else
iMonth = iMonth - 1
End If
If iDay > GetDaysInMonth(iMonth, iYear) Then iDay = GetDaysInMonth(iMonth, iYear)
SubtractOneMonth = CDate(iMonth & "-" & iDay & "-" & iYear)
End Function
Function AddOneMonth(dDate)
Dim iDay, iMonth, iYear
iDay = Day(dDate)
iMonth = Month(dDate)
iYear = Year(dDate)
If iMonth = 12 Then
iMonth = 1
iYear = iYear + 1
Else
iMonth = iMonth + 1
End If
If iDay > GetDaysInMonth(iMonth, iYear) Then iDay = GetDaysInMonth(iMonth, iYear)
AddOneMonth = CDate(iMonth & "-" & iDay & "-" & iYear)
End Function
Dim dDate ' Date we're displaying calendar for
Dim iDIM ' Days In Month
Dim iDOW ' Day Of Week that month starts on
Dim iCurrent ' Variable we use to hold current day of month as we write table
Dim iPosition ' Variable we use to hold current position in table
If IsDate(Request.QueryString("date")) Then
dDate = CDate(Request.QueryString("date"))
Else
If IsDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year")) Then
dDate = CDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year"))
Else
dDate = Date()
If Request.QueryString.Count <> 0 Then
Response.Write "La date que vous avez choisie n'était pas une date valable. Le calendrier a été mis à la date d'aujourd'hui.
"
End If
End If
End If
iDIM = GetDaysInMonth(Month(dDate), Year(dDate))
iDOW = GetWeekdayMonthStartsOn(Month(dDate), Year(dDate))
Function DateToHTTPDate(Byval OleDATE)
Const GMTdiff = #01:00:00#
OleDATE = OleDATE + GMTdiff
DateToHTTPDate = WeekDayName(OleDATE) & _
", " & Right("0" & Day(OleDATE),2) & " " & MonthName(OleDATE) & _
" " & Year(OleDATE) & " " & Right("0" & Hour(OleDATE),2) & _
":" & Right("0" & Minute(OleDATE),2) & ":" & Right("0" & Second(OleDATE),2) & " GMT"
End Function
Function WeekDayName(dDate)
Dim Out
Select Case Weekday(dDate,1)
Case 1:Out="Sun"
Case 2:Out="Mon"
Case 3:Out="Tue"
Case 4:Out="Wed"
Case 5:Out="Thu"
Case 6:Out="Fri"
Case 7:Out="Sat"
End Select
WeekDayName = Out
End Function
Function MonthName(iMonth)
Dim Out
Select Case Month(dDate)
Case 1:Out="Janvier"
Case 2:Out="Février"
Case 3:Out="Mars"
Case 4:Out="Avril"
Case 5:Out="Mai"
Case 6:Out="Juin"
Case 7:Out="Juillet"
Case 8:Out="Août"
Case 9:Out="Septembre"
Case 10:Out="Octobre"
Case 11:Out="Novembre"
Case 12:Out="Décembre"
End Select
MonthName = Out
End Function
%>
Calendrier des activités - Forme intéractive