Nous sommes le ".strftime("%A %d %B %Y", time())."
\n"; echo "\t".($annee + 1)."\n"; echo "\t".($annee - 1)."\n"; echo "\t

".$annee."

\n"; // Functions de gestion des tags xml $AnneeCourante = 0; $aConges = array(); $aRV = array(); $sRubrique = ""; // Periodes de conges + RV function elementDebut($parser, $name, $attributes) { Global $AnneeCourante, $aConges, $aRV, $sRubrique, $CURZONE; if ($name == "conges") { $sRubrique = "conges"; $AnneeCourante = $attributes["annee"]; $lib = $attributes["lib"]; if (!isset($aConges[$AnneeCourante])) $aConges[$AnneeCourante] = array("Lib"=>$lib, "Valeurs"=>array()); } else if (($name == "conge") && ($sRubrique == "conges")) { $aDeb = explode("/", $attributes["deb"]); $tmDeb = mktime(0, 0, 0, $aDeb[1], $aDeb[0], $AnneeCourante); $aFin = explode("/", $attributes["fin"]); $tmFin = mktime(0, 0, 0, $aFin[1], $aFin[0], $AnneeCourante); $zone = ""; foreach(preg_split('//', $attributes["zones"], -1, PREG_SPLIT_NO_EMPTY) as $char) { if (strchr($CURZONE, $char) !== false) $zone .= $char; } $aConges[$AnneeCourante]["Valeurs"][] = array("D"=>$tmDeb, "F"=>$tmFin, "Z"=>$zone, "L"=>$attributes["lib"]); } else if ($name == "personnel") { $sRubrique = "personnel"; } else if (($name == "rendezVous") && ($sRubrique == "personnel")) { $aDH = explode(" ", $attributes["date"]); $sH = "--:--"; if ((!isset($attributes["touteLaJournee"]) || ($attributes["touteLaJournee"] == 0)) && (count($aDH) == 2)) $sH = $aDH[1]; $aD = explode("/", $aDH[0]); $tmRV = mktime(0, 0, 0, $aD[1], $aD[0], $aD[2]); if (!isset($aRV[$tmRV])) $aRV[$tmRV] = array(); $aRV[$tmRV][] = array("L" => $attributes["lib"], "H" => $sH); } } function elementFin($parser, $name) { if ($name == "conges") { $sRubrique = ""; } else if ($name == "personnel") { $sRubrique = ""; } } $xmlContent = implode("", file("Calendrier.xml")); $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, true); xml_set_element_handler($parser, "elementDebut", "elementFin"); xml_parse($parser, $xmlContent, true); xml_parser_free($parser); // Jours feries $uneJournee = 24*60*60; $tmED = easter_date($annee); $easterDate = mktime(0, 0, 0, date("m", $tmED), date("d", $tmED), $annee); $aFeries = array( array("TS"=>mktime(0, 0, 0, 1, 1, $annee), "Lib"=>"Jour de l an"), array("TS"=>$easterDate + $uneJournee, "Lib"=>"Pâques"), array("TS"=>mktime(0, 0, 0, 5, 1, $annee), "Lib"=>"Fête du travail"), array("TS"=>mktime(0, 0, 0, 5, 8, $annee), "Lib"=>"Armistice 1945"), array("TS"=>mktime(0, 0, 0, date("m", $tmED), date("d", $tmED) + 39, $annee), "Lib"=>"Ascension"), array("TS"=>mktime(0, 0, 0, date("m", $tmED), date("d", $tmED) + 50, $annee), "Lib"=>"Pentecôte"), array("TS"=>mktime(0, 0, 0, 7, 14, $annee), "Lib"=>"Fête nationnale"), array("TS"=>mktime(0, 0, 0, 8, 15, $annee), "Lib"=>"Assomption"), array("TS"=>mktime(0, 0, 0, 11, 1, $annee), "Lib"=>"Toussaint"), array("TS"=>mktime(0, 0, 0, 11, 11, $annee), "Lib"=>"Armistice 1918"), array("TS"=>mktime(0, 0, 0, 12, 25, $annee), "Lib"=>"Noël") ); for ($i = 0; $i < 12; $i++) { $mois = $i + 1; $tmCur = mktime(0, 0, 0, $mois, 1, $annee); // Nombre de jours dans le mois $nbJours = date("t", $tmCur); echo "\t\n"; echo "\t\t\n"; echo "\t\t\t\n"; echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\t\n"; echo "\t\t\t\n"; echo "\t\t\t\n"; echo "\t\t\t\n"; echo "\t\t\t\n"; echo "\t\t\t\n"; echo "\t\t\t\n"; echo "\t\t\t\n"; echo "\t\t\n"; $numSemaine = 0; $nCptLigne = 0; for ($j = 0; $j < $nbJours; $j++) { $jour = $j + 1; $tmCur = mktime(0, 0, 0, $mois, $jour, $annee); $tmToday = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $bConge = false; $sCongeTitle = ""; $sCongeZone = "Z"; if (isset($aConges[$annee])) { foreach ($aConges[$annee]["Valeurs"] as $periode) { if (($tmCur >= $periode["D"]) && ($tmCur <= $periode["F"])) { $bConge = true; $sCongeTitle = $periode["L"]; $sCongeZone .= $periode["Z"]; } } } $bRV = false; $sTitleRV = ""; if (isset($aRV[$tmCur])) { $bRV = true; foreach ($aRV[$tmCur] as $aRVCur) { $sTitleRV .= (empty($sTitleRV)?"":", ").((empty($aRVCur["H"])?"":"[".$aRVCur["H"]."] ").$aRVCur["L"]); } } $bFerie = false; $sTitleF = ""; foreach ($aFeries as $jFerie) { if ($tmCur == $jFerie["TS"]) { $bFerie = true; $sTitleF .= (empty($sTitleF)?"":", ").$jFerie["Lib"]; } } $jourSem = strftime("%w", $tmCur); $jourSem = ($jourSem + 6)%7; if ($jour != 1) { if ($jourSem == 0) { $numSemaine = strftime("%W", $tmCur); echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\t\n"; $nCptLigne++; } } else { $numSemaine = strftime("%W", $tmCur); echo "\t\t\n"; echo "\t\t\t\n"; $nCptLigne++; for ($k = 0; $k < $jourSem; $k++) echo "\t\t\t\n"; } $classe = "jourMois "; $title = ""; $titleP = ""; if ($bConge) { $classe .= "conge ".$sCongeZone." "; $title .= $sCongeTitle." (Zone".((strlen($sCongeZone) > 2)?"s":"")." ".substr($sCongeZone, 1).")"; } if ($bRV) { $classe .= "RV "; $title .= (empty($title)?"":", ").$sTitleRV; $titleP .= (empty($titleP)?"":", ").$sTitleRV; } if ($bFerie) { $classe .= "ferie "; $title .= (empty($title)?"":", ").$sTitleF; } if ($tmCur == $tmToday) { $classe .= "today "; $idToday = "J_".$numSemaine."_".$jourSem."_".ucfirst(strftime("%A-%d-%B-%Y", $tmCur)); } if (($jourSem == 6) || ($jourSem == 5)) $classe .= "vikande "; echo "\t\t\t\n"; if ($jour == $nbJours) for ($k = $jourSem; $k < 6; $k++) echo "\t\t\t\n"; } echo "\t\t\n"; for ($k = $nCptLigne; $k < 6; $k++) { echo "\t\t\n"; echo "\t\t\t\n"; echo "\t\t\n"; } echo "\t
".ucfirst(strftime("%B", $tmCur))."
 Lun.Mar.Mer.Jeu.Ven.Sam.Dim.
".$numSemaine."
".$numSemaine." "; echo strftime("%d", $tmCur); echo " 
 
\n"; } if (isset($idToday)) { $sDateToday = strftime("%d/%m/%Y", $tmToday); echo << SEL_TODAY; } else echo << SEL_ANNEE; ?>