commit 5ea6d54ca4b3ad5f71128088cf761478d85e1137
Author: Romuald <devnull@localhost>
Date:   Sun Apr 12 03:03:54 2009 +0200

    Version PHP de genCal.sh

diff --git a/index.php b/index.php
new file mode 100644
index 0000000..1cffdb2
--- /dev/null
+++ b/index.php
@@ -0,0 +1,122 @@
+<?php
+	setlocale(LC_ALL, 'fr_FR');
+	$lstJours = array("dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi");
+	$lstMois = array(1 => "janvier", "f&eacute;vrier", "mars", "avril", "mai", "juin", "juillet", "ao&ucirc;t", "septembre", "octobre", "novembre", "d&eacute;cembre");
+	$lstFeries = array(
+		"jourDeLAn" => array(1, 1, "jour de l'an"),
+		"rameaux" => array(0, 0, "les Rameaux"),
+		"paques" => array(0, 0, "P&acirc;ques"),
+		"lundiDePaques" => array(0, 0, "lundi de P&acirc;ques"),
+		"feteDuTravail" => array(1, 5, "f&ecirc;te du travail"),
+		"victoire1945" => array(8, 5, "victoire 1945"),
+		"ascension" => array(15, 8, "l'Ascension"),
+		"pentecote" => array(0, 0, "la Pentec&ocirc;te"),
+		"lundiDePentecote" => array(0, 0, "lundi de Pentec&ocirc;te"),
+		"feteNationale" => array(14, 7, "f&ecirc;te Nationale"),
+		"assomption" => array(15, 8, "l'Assomption"),
+		"toussaint" => array(1, 11, "la Toussaint"),
+		"armistice1918" => array(11, 11, "armistice 1918"),
+		"noel" => array(25, 12, "No&euml;l")
+	);
+
+	function getPaquesDay($year) {
+		$b = $year-1900;
+		$c = $year % 19;
+		$d = (7*$c+1)/19;
+		$e = (11*$c+4-$d) % 29;
+		$f = $b/4;
+		$g = ($b+$f+31-$e) % 7;
+		$h = 25-$e-$g;
+		if ($h > 0) {
+			$jour = $h;
+			$mois = 4;
+		} else {
+			$jour = $h+31;
+			$mois = 3;
+		}
+		return array($jour, $mois);
+	}
+
+	$year = date("Y");
+	if (isset($_GET['year'])) $year = $_GET['year'];
+	if (isset($_GET['annee'])) $year = $_GET['annee'];
+
+	list($jourPaques, $moisPaques) = getPaquesDay($year);
+	$datePaques = strtotime("$year-$moisPaques-$jourPaques");
+	$lstFeries['paques'][0] = $jourPaques;
+	$lstFeries['paques'][1] = $moisPaques;
+	$ts = strtotime("-7 days", $datePaques);
+	$lstFeries['rameaux'][0] = date("j", $ts);
+	$lstFeries['rameaux'][1] = date("n", $ts);
+	$ts = strtotime("1 day", $datePaques);
+	$lstFeries['lundiDePaques'][0] = date("j", $ts);
+	$lstFeries['lundiDePaques'][1] = date("n", $ts);
+	$ts = strtotime("39 days", $datePaques);
+	$lstFeries['ascension'][0] = date("j", $ts);
+	$lstFeries['ascension'][1] = date("n", $ts);
+	$ts = strtotime("49 days", $datePaques);
+	$lstFeries['pentecote'][0] = date("j", $ts);
+	$lstFeries['pentecote'][1] = date("n", $ts);
+	$ts = strtotime("50 days", $datePaques);
+	$lstFeries['lundiDePentecote'][0] = date("j", $ts);
+	$lstFeries['lundiDePentecote'][1] = date("n", $ts);
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
+	<head>
+		<meta http-equiv="Content-Type" content="text/HTML; charset=iso-8859-1"  />
+		<meta http-equiv="Content-style-type" content="text/css" />
+		<meta http-equiv="Content-language" content="fr" />
+		<title>Calendrier <?=$year?></title>
+		<link rel="stylesheet" type="text/css" href="calendrier.css" media="screen" title="Normal" />
+		<link rel="stylesheet" type="text/css" href="calendrier.css" media="print" title="Normal" />
+
+	</head>
+
+	<body>
+<?php
+	for ($s = 1; $s <= 2; $s++) {
+		print "\t\t<table>\n";
+		for ($j = 0; $j <= 31; $j++) {
+			if ($j == 0) {
+				echo "\t\t\t<tr id=\"semestre$s\">\n";
+			} else {
+				echo "\t\t\t<tr class=\"jour$j\">\n";
+			}
+			for ($m = 6*$s-5; $m <= 6*$s; $m++) {
+				if ($j == 0) {
+					echo "\t\t\t\t<th id=\"mois$m\">".$lstMois[$m]."</th>\n";
+					$lastDay = 29;
+					while (checkdate($m, $lastDay, $year)) $lastDay++;
+					$last[$m] = $lastDay-1;
+				} else {
+					$ts = strtotime("$year-$m-$j");
+					$weekDay = $lstJours[date("w", $ts)];
+					$abrvDay = strftime("%a", $ts);
+					if ($j <= $last[$m]) {
+						$classFerie = "";
+						foreach ($lstFeries as $id => $f) {
+							if ($j == $f[0] && $m == $f[1]) {
+								$classFerie = " class=\"ferie\" class=\"$id\" title=\"".$f[2]."\"";
+								break;
+							}
+						}
+						echo "\t\t\t\t<td$classFerie class=\"$weekDay\"><span class=\"nom-jour\">$abrvDay</span><span class=\"num-jour\">$j</span></td>\n";
+					} else {
+						if ($last[$m] == 30) {
+							echo "\t\t\t\t<td></td>\n";
+						} else {
+							if ($j == $last[$m]+1) echo "\t\t\t\t<td rowspan=\"".(31-$last[$m])."\"></td>\n";
+						}
+					}
+				}
+			}
+			echo "\t\t\t</tr>\n";
+		}
+		print "\t\t</table>\n";
+		print "\t\t<br />\n";
+	}
+?>
+	</body>
+</html>
