WikiXtof

Comment 16

Accueil :: SuperMenu :: Contact :: Connexion :: Vous êtes 216.73.217.24
Ceci est un commentaire sur CarnetWeb, posté par APoitiers-106-1-29-83.w81-249.abo.wanadoo.fr à 2004-05-27 21:13:57

Notice: Undefined offset: 2 in /var/www/vhosts/xtof.ouvaton.org/httpdocs/formatters/wakka.php on line 268

Notice: Undefined offset: 2 in /var/www/vhosts/xtof.ouvaton.org/httpdocs/formatters/wakka.php on line 268

Notice: Undefined offset: 2 in /var/www/vhosts/xtof.ouvaton.org/httpdocs/formatters/wakka.php on line 268

Notice: Undefined offset: 4 in /var/www/vhosts/xtof.ouvaton.org/httpdocs/formatters/wakka.php on line 268

Notice: Undefined offset: 4 in /var/www/vhosts/xtof.ouvaton.org/httpdocs/formatters/wakka.php on line 268

Notice: Undefined offset: 4 in /var/www/vhosts/xtof.ouvaton.org/httpdocs/formatters/wakka.php on line 268

Notice: Undefined offset: 4 in /var/www/vhosts/xtof.ouvaton.org/httpdocs/formatters/wakka.php on line 268
mets ça dans fichier calendrier.php dans dossier action et hop !
<?php
/*
Copyright (c) WikiEspoir? 2004.
All rights reserved : licence GPL (voir fichier WikiEspoir?/docs/licence)
SYNTAXE

calendrier choix=dujour/variablesemaine/mois/year
$nom = $this->GetParameter?("nom");
if (empty($nom))
/*pm */
$nomtag = $this->getPageTag() ;

$cemois = $this->GetParameter?("mois");
$cetan = $this->GetParameter?("an");

$cal = new calendrier ;
$cal->setStartDay(1) ;

if (empty($cemois) and !empty($cetan)) {
echo $cal-> getYearView($cetan,$nomtag);
}
else {
if (empty($cemois)) $cemois = date("m");
if (empty($cetan)) $cetan = date("Y");
echo $cal->getMonthView($cemois, $cetan,$nomtag );
}

/*
$year = date("Y");
$now = date("Y/m/d");
$month = date("m"); m et non n !!
$day = date("d"); d et non

$data=explode(" ",$dt);
$year=$data[0];
$month=$data[1];
$day=$data[2];
$now=date("Y/m/d", mktime(0,0,0,$month,$day,$year));

/
*/
class calendrier
{
var $startDay = 0;
var $startMonth = 1;
var $dayNames = array("D", "L", "M", "M", "J", "V", "S");
var $monthNames = array("Janvier", "Février", "Mars", "Avril", "Mai", "Juin","Juillet", "Août", "Septembre", "Octobre", "Novembre", "Decembre");
var $daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

function Calendar() { }

function getDayNames() { return $this->dayNames; }
function setDayNames($names) { $this->dayNames = $names; }

function getMonthNames() { return $this->monthNames; }
function setMonthNames($names) { $this->monthNames = $names;}

function getStartDay() {return $this->startDay; }
function setStartDay($day) { $this->startDay = $day;}

function getStartMonth() { return $this->startMonth; }
function setStartMonth($month) { $this->startMonth = $month; }
//
function getCalendarLink($month, $year, $nomtag ){
if($month<10)$month="0".$month;
$tag = "wakka.php?wiki=".$nomtag ."An".$year."Mois".$month;
return $tag ;
}
function getDateLink($day, $month, $year,$nomtag ) {
if($day<10) $day="0".$day;
$tag = "wakka.php?wiki=". $nomtag ."An".$year."Mois".$month."Jour".$day ;
return $tag ;
}
//
function getCurrentMonthView($nomtag) {
$d = getdate(time());
return $this->getMonthView($d["mon"], $d["year"],$nomtag);
}
function getCurrentYearView($nomtag) {
$d = getdate(time());
return $this->getYearView($d["year"],$nomtag);
}
function getMonthView($month, $year,$nomtag) { return $this->getMonthHTML($month, $year,$nomtag ); }
function getYearView($year,$nomtag ) { return $this->getYearHTML($year,$nomtag ); }

function getDaysInMonth($month, $year) {
if ($month < 1 || $month > 12) {
return 0;
}
$d = $this->daysInMonth[$month - 1];
if ($month
2) {
if ($year%4
0) {
if ($year%100
0) {
if ($year%400
0) {
$d = 29;
}
}
else {
$d = 29;
}
}
}
return $d;
}
function getMonthHTML($m, $y,$nomtag , $showYear = 1) {
$s = ; $a = $this->adjustDate($m, $y); $month = $a[0]; $year = $a[1]; $daysInMonth = $this->getDaysInMonth($month, $year); $date = getdate(mktime(12, 0, 0, $month, 1, $year)); $first = $date["wday"]; $monthName = $this->monthNames[$month - 1]; $prev = $this->adjustDate($month - 1, $year); $next = $this->adjustDate($month + 1, $year); if ($showYear == 1) { $prevMonth = $this->getCalendarLink($prev[0], $prev[1], $nomtag); $nextMonth = $this->getCalendarLink($next[0], $next[1], $nomtag); } else { $prevMonth = ;
$nextMonth = ; } $header = $monthName . (($showYear > 0) ? " " . $year : );

$s .= "<table class=\"calendrier\">\n";
$s .= "<tr>\n";
$s .= "<td align=\"center\" valign=\"top\">" . (($prevMonth
) ? " " : "<<") . "\n"; $s .= "$header\n"; $s .= "" . (($nextMonth == ) ? " " : "<a href=\"$nextMonth\">>></a>") . "</td>\n"; $s .= "</tr>\n";

$s .= "<tr>\n";
$s .= "<td align=\"center\" valign=\"top\" class=\"calendrierHeader\">" . $this->dayNames[($this->startDay)%7] . "</td>\n";
$s .= "<td align=\"center\" valign=\"top\" class=\"calendrierHeader\">" . $this->dayNames[($this->startDay+1)%7] . "</td>\n";
$s .= "<td align=\"center\" valign=\"top\" class=\"calendrierHeader\">" . $this->dayNames[($this->startDay+2)%7] . "</td>\n";
$s .= "<td align=\"center\" valign=\"top\" class=\"calendrierHeader\">" . $this->dayNames[($this->startDay+3)%7] . "</td>\n";
$s .= "<td align=\"center\" valign=\"top\" class=\"calendrierHeader\">" . $this->dayNames[($this->startDay+4)%7] . "</td>\n";
$s .= "<td align=\"center\" valign=\"top\" class=\"calendrierHeader\">" . $this->dayNames[($this->startDay+5)%7] . "</td>\n";
$s .= "<td align=\"center\" valign=\"top\" class=\"calendrierHeader\">" . $this->dayNames[($this->startDay+6)%7] . "</td>\n";
$s .= "</tr>\n";

$d = $this->startDay + 1 - $first;
while ($d > 1) {
$d -= 7;
}

$today = getdate(time());

while ($d <= $daysInMonth) {
$s .= "<tr>\n";

for ($i = 0; $i < 7; $i++) {
$class = ($year $today["year"] && $month
$today["mon"] && $d
$today["mday"]) ? "calendrierToday" : "calendar";
$s .= "<td class=\"$class\" align=\"right\" valign=\"top\">";
if ($d > 0 && $d <= $daysInMonth) {
$link = $this->getDateLink($d, $month, $year,$nomtag);
$s .= (($link
) ? $d : "$d"); } else { $s .= " "; } $s .= "\n"; $d++; } $s .= "\n"; } $s .= "\n"; return $s; } function getYearHTML($year, $nomtag ) { $s = ; $prev = $this->getCalendarLink(0, $year - 1,$nomtag);
$next = $this->getCalendarLink(0, $year + 1,$nomtag);

$s .= "<table class=\"calendrier\" border=\"0\">\n";
$s .= "<tr>";
$s .= "<td align=\"center\" valign=\"top\" align=\"left\">" . (($prev
) ? " " : "<<") . "\n"; $s .= "" . (($this->startMonth > 1) ? $year . " - " . ($year + 1) : $year) ."\n"; $s .= "" . (($next == ) ? " " : "<a href=\"$next\">>></a>") . "</td>\n";
$s .= "</tr>\n";
$s .= "<tr>";
$s .= "<td class=\"calendrier\" valign=\"top\">" . $this->getMonthHTML(0 + $this->startMonth, $year, $nomtag, 0) ."</td>\n";
$s .= "<td class=\"calendrier\" valign=\"top\">" . $this->getMonthHTML(1 + $this->startMonth, $year,$nomtag, 0) ."</td>\n";
$s .= "<td class=\"calendrier\" valign=\"top\">" . $this->getMonthHTML(2 + $this->startMonth, $year,$nomtag, 0) ."</td>\n";
$s .= "</tr>\n";
$s .= "<tr>\n";
$s .= "<td class=\"calendrier\" valign=\"top\">" . $this->getMonthHTML(3 + $this->startMonth, $year,$nomtag, 0) ."</td>\n";
$s .= "<td class=\"calendrier\" valign=\"top\">" . $this->getMonthHTML(4 + $this->startMonth, $year, $nomtag,0) ."</td>\n";
$s .= "<td class=\"calendrier\" valign=\"top\">" . $this->getMonthHTML(5 + $this->startMonth, $year,$nomtag, 0) ."</td>\n";
$s .= "</tr>\n";
$s .= "<tr>\n";
$s .= "<td class=\"calendrier\" valign=\"top\">" . $this->getMonthHTML(6 + $this->startMonth, $year,$nomtag, 0) ."</td>\n";
$s .= "<td class=\"calendrier\" valign=\"top\">" . $this->getMonthHTML(7 + $this->startMonth, $year,$nomtag, 0) ."</td>\n";
$s .= "<td class=\"calendrier\" valign=\"top\">" . $this->getMonthHTML(8 + $this->startMonth, $year, $nomtag,0) ."</td>\n";
$s .= "</tr>\n";
$s .= "<tr>\n";
$s .= "<td class=\"calendrier\" valign=\"top\">" . $this->getMonthHTML(9 + $this->startMonth, $year, $nomtag,0) ."</td>\n";
$s .= "<td class=\"calendrier\" valign=\"top\">" . $this->getMonthHTML(10 + $this->startMonth, $year,$nomtag, 0) ."</td>\n";
$s .= "<td class=\"calendrier\" valign=\"top\">" . $this->getMonthHTML(11 + $this->startMonth, $year,$nomtag, 0) ."</td>\n";
$s .= "</tr>\n";
$s .= "</table>\n";

return $s;
}

function adjustDate($month, $year) {
$a = array();
$a[0] = $month;
$a[1] = $year;
while ($a[0] > 12) {
$a[0] -= 12;
$a[1]++;
}
while ($a[0] <= 0) {
$a[0] += 12;
$a[1]--;
}
return $a;
}
}

?>
FidelioEspoir?
Ajouter un commentaire à cette page:


Notice: Undefined index: menu_page in /var/www/vhosts/xtof.ouvaton.org/httpdocs/actions/footer.php on line 103