my_calendar(array($_GET['data']));
?>
function my_calendar($fill=array()) {
$month_names=array("январе","феврале","марте","апреле","мае","июне", "июле","августе","сентябре","октябре","ноябре","декабре");
$month_names2=array("yanvarya","fevralya","marta","aprelya","maya","iunya","iyulya","avgusta","sentyabrya","oktyabrya","noyabrya","decabrya");
if (isset($_GET['y'])) $y=$_GET['y'];
if (isset($_GET['m'])) $m=$_GET['m'];
if (isset($_GET['data']) AND strstr($_GET['data'],"-")) list($y,$m)=explode("-",$_GET['data']);
if (!isset($y) OR $y < 1970 OR $y > 2037) $y=date("Y");
if (!isset($m) OR $m < 1 OR $m > 12) $m=date("m");
$month_stamp=mktime(0,0,0,$m,1,$y);
$day_count=date("t",$month_stamp);
$weekday=date("w",$month_stamp);
if ($weekday==0) $weekday=7;
$start=-($weekday-2);
$last=($day_count+$weekday-1) % 7;
if ($last==0) $end=$day_count; else $end=$day_count+7-$last;
$today=date("Y-m-d");
$prev=date('?\m=m&\y=Y',mktime (0,0,0,$m-1,1,$y));
$next=date('?\m=m&\y=Y',mktime (0,0,0,$m+1,1,$y));
$i=0;
$t=explode("-",$_GET['data']);
if (count($t)==3) $current=$t[0]."-".sprintf("%02d",$t[1])."-".sprintf("%02d",$t[2]); else $current=$t[0]."-".sprintf("%02d",$t[1]);
?>
В echo $month_names[$m-1]," ",$y ?>
Пн | Вт | Ср | Чт | Пт | Сб | Вс |
|
for($d=$start;$d<=$end;$d++) {
if (!($i++ % 7)) echo " \n";
echo ' ';
if ($d < 1 OR $d > $day_count) {
echo " ";
} else {
$now="$y-".sprintf("%02d",$m)."-".sprintf("%02d",$d); //echo $now;
if (date("Y-m-d")==$now) echo ''.$d.'';
elseif ($current==$now) echo ''.$d.'';
else {
echo ''.$d.'';
}
}
echo " | \n";
if (!($i % 7)) echo "
\n";
}
?>
} ?>