Statistiques
| Branche: | Révision :

root / index.php @ master

Historique | Voir | Annoter | Télécharger (3,56 ko)

1
<?php
2
        setlocale(LC_TIME, "fr_FR");
3
        $lstFeries = array(
4
                "jourDeLAn" => array(1, 1, "jour de l'an"),
5
                "rameaux" => array(0, 0, "les Rameaux"),
6
                "paques" => array(0, 0, "P&acirc;ques"),
7
                "lundiDePaques" => array(0, 0, "lundi de P&acirc;ques"),
8
                "feteDuTravail" => array(1, 5, "f&ecirc;te du travail"),
9
                "victoire1945" => array(8, 5, "victoire 1945"),
10
                "ascension" => array(15, 8, "l'Ascension"),
11
                "pentecote" => array(0, 0, "la Pentec&ocirc;te"),
12
                "lundiDePentecote" => array(0, 0, "lundi de Pentec&ocirc;te"),
13
                "feteNationale" => array(14, 7, "f&ecirc;te Nationale"),
14
                "assomption" => array(15, 8, "l'Assomption"),
15
                "toussaint" => array(1, 11, "la Toussaint"),
16
                "armistice1918" => array(11, 11, "armistice 1918"),
17
                "noel" => array(25, 12, "No&euml;l")
18
        );
19
20
        $year = date("Y");
21
        if (isset($_GET['year'])) $year = $_GET['year'];
22
        if (isset($_GET['annee'])) $year = $_GET['annee'];
23
24
        $datePaques = easter_date($year);
25
        $lstFeries['paques'][0] = date('j', $datePaques);
26
        $lstFeries['paques'][1] = date('n', $datePaques);
27
        $ts = strtotime("-7 days", $datePaques);
28
        $lstFeries['rameaux'][0] = date("j", $ts);
29
        $lstFeries['rameaux'][1] = date("n", $ts);
30
        $ts = strtotime("1 day", $datePaques);
31
        $lstFeries['lundiDePaques'][0] = date("j", $ts);
32
        $lstFeries['lundiDePaques'][1] = date("n", $ts);
33
        $ts = strtotime("39 days", $datePaques);
34
        $lstFeries['ascension'][0] = date("j", $ts);
35
        $lstFeries['ascension'][1] = date("n", $ts);
36
        $ts = strtotime("49 days", $datePaques);
37
        $lstFeries['pentecote'][0] = date("j", $ts);
38
        $lstFeries['pentecote'][1] = date("n", $ts);
39
        $ts = strtotime("50 days", $datePaques);
40
        $lstFeries['lundiDePentecote'][0] = date("j", $ts);
41
        $lstFeries['lundiDePentecote'][1] = date("n", $ts);
42
?>
43
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
44
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
45
        <head>
46
                <meta http-equiv="Content-Type" content="text/HTML; charset=iso-8859-1"  />
47
                <meta http-equiv="Content-style-type" content="text/css" />
48
                <meta http-equiv="Content-language" content="fr" />
49
                <title>Calendrier <?=$year?></title>
50
                <link rel="stylesheet" type="text/css" href="calendrier.css" media="screen" title="Normal" />
51
                <link rel="stylesheet" type="text/css" href="calendrier.css" media="print" title="Normal" />
52
53
        </head>
54
55
        <body>
56
<?php
57
        for ($s = 1; $s <= 2; $s++) {
58
                print "\t\t<table>\n";
59
                for ($j = 0; $j <= 31; $j++) {
60
                        if ($j == 0) {
61
                                echo "\t\t\t<tr id=\"semestre$s\">\n";
62
                        } else {
63
                                echo "\t\t\t<tr class=\"jour$j\">\n";
64
                        }
65
                        for ($m = 6*$s-5; $m <= 6*$s; $m++) {
66
                                if ($j == 0) {
67
                                        $ts = strtotime("$year-$m-1");
68
                                        echo "\t\t\t\t<th id=\"mois$m\">".strftime("%B", $ts)."</th>\n";
69
                                        $lastDay = 29;
70
                                        while (checkdate($m, $lastDay, $year)) $lastDay++;
71
                                        $last[$m] = $lastDay-1;
72
                                } else {
73
                                        $ts = strtotime("$year-$m-$j");
74
                                        $weekDay = strftime("%A", $ts);
75
                                        $abrvDay = strftime("%a", $ts);
76
                                        if ($j <= $last[$m]) {
77
                                                $classFerie = "";
78
                                                foreach ($lstFeries as $id => $f) {
79
                                                        if ($j == $f[0] && $m == $f[1]) {
80
                                                                $classFerie = " class=\"ferie\" class=\"$id\" title=\"".$f[2]."\"";
81
                                                                break;
82
                                                        }
83
                                                }
84
                                                echo "\t\t\t\t<td$classFerie class=\"$weekDay\"><span class=\"nom-jour\">$abrvDay</span><span class=\"num-jour\">$j</span></td>\n";
85
                                        } else {
86
                                                if ($last[$m] == 30) {
87
                                                        echo "\t\t\t\t<td></td>\n";
88
                                                } else {
89
                                                        if ($j == $last[$m]+1) echo "\t\t\t\t<td rowspan=\"".(31-$last[$m])."\"></td>\n";
90
                                                }
91
                                        }
92
                                }
93
                        }
94
                        echo "\t\t\t</tr>\n";
95
                }
96
                print "\t\t</table>\n";
97
                print "\t\t<br />\n";
98
        }
99
?>
100
        </body>
101
</html>