
Rastafa
|
J'ai retrouver un code uqe j'ai fait il y a quelque temps. Il y a quelque modification à faire, mais il marche.
<!--- Initialisations ---> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <CFSET jourLettre=ListToArray("Dimanche,Lundi,Mardi,Mercredi,Jeudi,Vendredi,Samedi")> <CFSET moisLettre=ListToArray("Janvier,Février,Mars,Avril,Mai,Juin,Juillet,Août,Septembre,Octobre,Novembre,Décembre")>
<!--- Validation des informations recus et fait la mise à jour de la date à traiter---> <CFIF ParameterExists(traitDate) IS "No"> <CFSET traitDate=#Now()#> <CFELSE> <CFIF NOT IsDate(traitDate)> <CFSET traitDate=#Now()#> <CFELSE> <CFSET tableauDate=#ListToArray(traitDate,"-")#> <CFSET traitDate=CreateDate(tableauDate[1], tableauDate[2], tableauDate[3])> </CFIF> <CFIF ((ParameterExists(modifMois) IS NOT "No") AND (len(modifMois) GT 1) AND(#IsNumeric(right(modifMois,len(modifMois)-1))#))> <CFIF left(modifMois,1) IS "-"> <CFSET traitDate=#DateAdd("m", -right(modifMois,len(modifMois)-1), traitDate)#> <CFELSE> <CFIF left(modifMois,1) IS "~"> <CFSET traitDate=#DateAdd("m", right(modifMois,len(modifMois)-1), traitDate)#> </CFIF> </CFIF> <CFELSE> <CFIF ((ParameterExists(modifAnnee) IS NOT "No") AND (len(modifAnnee) GT 1) AND (#IsNumeric(right(modifAnnee,len(modifAnnee)-1))#))> <CFIF left(modifAnnee,1) IS "-"> <CFSET traitDate=#DateAdd("yyyy", -right(modifAnnee,len(modifAnnee)-1), traitDate)#> <CFELSE> <CFIF left(modifAnnee,1) IS "~"> <CFSET traitDate=#DateAdd("yyyy", right(modifAnnee,len(modifAnnee)-1), traitDate)#> </CFIF> </CFIF> </CFIF> </CFIF> </CFIF> <CFSET traitAnnee = #Year(traitDate)#> <CFSET traitMois = #Month(traitDate)#> <CFSET traitMoisNbJour = #DaysInMonth(traitDate)#>
<!--- Aller chercher les jours spécial dans la DB---> <html> <head> <TITLE>Calendrier</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style> .date { font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-style: normal; font-weight: bold; color: #000000;text-decoration : none;} .erreur { font-family: Arial, Helvetica, sans-serif; font-size: 7pt; font-style: normal; font-weight: bold; color: #FF0000; text-decoration : none;} .grise { font-family: Arial, Helvetica, sans-serif; font-size: 7pt; font-style: normal; font-weight: bold; color: #AAAAAA; text-decoration : none;} .titre { font-family: Arial, Helvetica, sans-serif; font-size: 12pt; font-style: normal; font-weight: bold; color: #000000; text-decoration : none;}
</style> <style type="text/css"> <!--
a:hover { font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-style: normal; font-weight: bold; color: #FF0000; text-decoration : none; } a { font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-style: normal; font-weight: bold; color: #000000; text-decoration : none; }
--> </style> </head> <body bgcolor="#9FAFE0" text="#000000"> <BR> <div align="center" class="titre">Calendrier<BR><BR></div> <div align="center"> <table width="210" border="0" cellspacing="1" cellpadding="8"bgcolor="#FFFFFF"> <tr> <td> <div align="center"> <table width="210" border="0" cellspacing="1" cellpadding="1"> <!--- Ligne pour le mois ---> <tr> <td width="28" bgcolor="#E0E7E0"> <div align="center"><a href="index.cfm?modifMois=-1&traitdate=<CFOUTPUT>#LSDateFormat(traitDate,"yyyy-mm-dd")#</CFOUTPUT>"><</a></div> </td> <td width="154" bgcolor="#E0E7E0" > <div class="date" align="center"><CFOUTPUT>#moisLettre[traitMois]#</CFOUTPUT></div> </td> <td width="28" bgcolor="#E0E7E0" > <div align="center"><a href="index.cfm?modifMois=~1&traitdate=<CFOUTPUT>#LSDateFormat(traitDate,"yyyy-mm-dd")#</CFOUTPUT>">></a></div> </td> </tr> <!--- Ligne pour l'Année---> <tr class="date"> <td width="28" bgcolor="#E0E7E0" > <div align="center"><a href="index.cfm?modifAnnee=-1&traitdate=<CFOUTPUT>#LSDateFormat(traitDate,"yyyy-mm-dd")#</CFOUTPUT>"><</a></div> </td> <td width="154" bgcolor="#E0E7E0" > <div class="date" align="center"><CFOUTPUT>#traitAnnee#</CFOUTPUT></div> </td> <td width="28" bgcolor="#E0E7E0" > <div align="center"><a href="index.cfm?modifAnnee=~1&traitdate=<CFOUTPUT>#LSDateFormat(traitDate,"yyyy-mm-dd")#</CFOUTPUT>">></a></div> </td> </tr> </table> <!--- Ligne pour les jours de la semaines---> <table width="210" border="0" cellspacing="1" cellpadding="0"> <tr bgcolor="C0CFCF" > <td width="30"><div class="date" align="center">Di</div></td> <td width="30"><div class="date" align="center">Lu</div></td> <td width="30"><div class="date" align="center">Ma</div></td> <td width="30"><div class="date" align="center">Me</div></td> <td width="30"><div class="date" align="center">Je</div></td> <td width="30"><div class="date" align="center">Ve</div></td> <td width="30"><div class="date" align="center">Sa</div></td> </tr> <!--- DEBUT AFFICHAGE DES CELLULES DES JOURS DU MOIS ---> <tr bgcolor="#E0E7E0"> <!--- affichage des cellules vides en debut de tableau ---> <CFSET cptcel=#Evaluate((7 + DayOfWeek(CreateDate(traitAnnee,traitMois,1)) - 1) mod 7)#> <CFLOOP index="i" from="1" to="#cptcel#"> <td width="30" class="date"> </td> </CFLOOP>
<!--- flag sert a specifier qu'il s'agit de la premiere ligne ---> <CFSET flag="False">
<!--- debut de boucle de 1 au nombre de jour dans le mois ---> <CFLOOP index="i" from="1" to="#traitMoisNbJour#"> <!---commencer une nouvelle ligne lorsque l'on arrive a la 7 eme cellule (=rupture)---> <CFSET cptcel=#Evaluate(cptcel + 1)#> <CFIF (#Evaluate(cptcel MOD 7)# IS 1) AND (#flag# IS "True")> </tr><tr bgcolor="E0E7E0"> </CFIF> <CFSET flag="True"> <td width="30" class="date" bgcolor=""> <div align="center"><CFOUTPUT>#i#</CFOUTPUT></div> </td> </CFLOOP> <!--- completer la fin du tableau par des cellules vides ---> <CFLOOP index="i" from="1" to="#Evaluate((7-(cptcel mod 7)) mod 7)#"> <td width="30" class="date"> </td> </CFLOOP> </tr> </table> </div> </td> </tr> </table> <BR> <hr> </div> </body> </html>
|