<? // WR-Calendar v 1.0 // 21.11.05 ã. // Miha-ingener@yandex.ru#error_reporting (E_ALL);
$hcolor="#884422"; // Öâåò ñåãîäíÿøíåé äàòû
$bcolor="#cccccc"; // Öâåò áîðäþðà òàáëèöû
$shapka="0"; // Ïå÷àòàòü html-øàïêó? 1/0
$months=array("ßíâàðü","Ôåâðàëü","Ìàðò","Àïðåëü","Ìàé","Èþíü","Èþëü","Àâãóñò","Ñåíòÿáðü","Îêòÿáðü","Íîÿáðü","Äåêàáðü");
$value[1]="Ïí|Âò|Ñð|×ò|Ïò|Ñá|Âñ|";
$qi=2; $value[2]="";
$daysamount=date('t',time())+1;
$weeks=floor($daysamount/7);
$firstday=date('w',mktime(0,0,0,date('n'),0,date('y')));
// ïîëó÷àåì äàííûå
for($i=0;$i<$firstday;$i++) {$value[$qi].="|";}
for($q=1;$q<$daysamount;$q++) {$value[$qi].="$q|"; if(intval (($i+$q)/7)==($i+$q)/7) {$qi++; $value[$qi]="";}}
// Ïå÷àòàåì ÊÀËÅÍÄÀÐÜ ÍÀ ÒÅÊÓÙÈÉ ÌÅÑßÖ
$vmax=count($value); $i=0; $ii=0; $add="";
print"<table align=center border=1 cellpadding=2 cellspacing=0 bordercolor=$bcolor><caption><font face='Verdana' size=-1>
<B>".$months[date('n')-1]."</caption></B></font><TR align=middle valign=middle>";
do {
if ($ii=="6") {$add="class=sun";} else {$add="";}
do {$i++;
$rdt=explode("|", $value[$i]);
if (!isset($rdt[$ii])) {$add=""; $rdt[$ii]=" ";} else {if ($rdt[$ii]=="") {$add=""; $rdt[$ii]=" ";}}
if ($i=="1") {$addbb="<B>";} else {$addbb="";}
if($rdt[$ii]==date('d')) {$addse="class=seg"; } else {$addse="";}
print"<td $addse $add width=23>$addbb $rdt[$ii]</td>\r\n";
} while ($i<$vmax);
if ($ii<"6") {print"</tr><TR align=middle valign=middle>\r\n";}
$i="0"; $ii++;
} while ($ii<"7");
print"</tr></table>";
?>