<%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

Calendrier des activités - Forme intéractive
Si vous désirez faire des modifications ou supprimer une activité, appuyez sur le texte de l'activité.
Pour ajouter une activité au calendrier, appuyer sur le bouton "Ajoutez".

"Si vous désirez faire une recherche, appuyez ici "

<% Response.Write("
" & Chr(10)) Response.Write("" & "  ") Response.Write("
") %>
Choisissez un mois
<% If iDOW <> 1 Then Response.Write(vbTab & "" & vbCrLf) iPosition = 1 Do While iPosition < iDOW Response.Write(vbTab & vbTab & "" & vbCrLf) iPosition = iPosition + 1 Loop End If '-- Write days of month in proper day slots -- iCurrent = 1 iPosition = iDOW Do While iCurrent <= iDIM '-- open the table row -- If iPosition = 1 Then Response.Write(vbTab & "" & vbCrLf) End If '-- Write the date and subject -- Response.Write(vbTab & vbTab & "" & vbCrLf) '-- Close the table row -- If iPosition = 7 Then Response.Write vbTab & "" & vbCrLf iPosition = 0 End If '-- Increment variables -- iCurrent = iCurrent + 1 iPosition = iPosition + 1 Loop If iPosition <> 1 Then Do While iPosition <= 7 Response.Write(vbTab & vbTab & "" & vbCrLf) iPosition = iPosition + 1 Loop Response.Write vbTab & "" & vbCrLf End If %>
<%= MonthName (Month(dDate)) & " " & Year(dDate) %>
Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi
 
" & iCurrent & "") If Not objRecordset.BOF Then objRecordset.MoveFirst Do Until objRecordset.EOF If objRecordset.Fields("Year") = Year(dDate) Then If objRecordset.Fields("Month") = Month(dDate) Then If objRecordset.Fields("Day") = iCurrent Then Response.Write("
" & objRecordset.Fields("Subject") & "
") End If End If End If objRecordset.MoveNext Loop End If Response.Write("
 

<% objRecordset.Close Set objRecordset = Nothing %> <% Response.Write("

" & Chr(10)) Response.Write("" & "  ") Response.Write("
") %>