Calendar Php

/**
* calendar class :
* @package
* @access public
**/
class calendar{
/**
* Constructor
* @access protected
*/
function calendar(){
}
/**
* calendar::html_month_calendar()
*
* @param integer $m The month value, could be returned with $m = date("m");
* @return
**/
function html_month_calendar($m = "",$y = ""){
if (trim($m) == "") {
$m = date($m);
}
if (trim($y)=="") {
$y = date("Y");
}
$curr_month = date("m");
$d = date("d");
if ($m==1) {
$m_1 = 12;
$y_1 = $y-1;
} else {
$m_1 = $m-1;
$y_1 = $y;
}
$to = mktime(0,0,0,$m_1,0,$y_1);
$days_in_month = strftime ("%d",$to);
$from = mktime(0,0,0,$m,1,$y);
$from_a = getdate($from);
$to_a = getdate($to);
$calendar = "\n








\n";
$Days = 0;
for($i = 1; $i <= 6; $i++){
$calendar .= "\n";
for($j = 0; $j <= 6 ; $j++){
if ($d == ($Days+1) and $curr_month==$m) {
$b1 = "";$b2 = "";
} else $b1 = "";$b2 = "";
if ($from_a["wday"]==$j and $Days==0) {
$Days++;
$calendar .= "";
} elseif($Days==0) {
$calendar .= "";
} else {
$Days++;
if ($Days<=$days_in_month) {
$calendar .= "";
} else {
$calendar .= "";
}
}
} // for
$calendar .= "\n";
} // for
$calendar .= "
Dim Lun Mar Mer Jeu Ven Sam
$b1 $Days $b2$b1 $Days $b2
\n";
return $calendar;
}
/**
*
* @access public
* @return void
**/
function html_year_calendar($y = ""){
if (trim($y)=="") {
$y = date("Y");
}
$year_calendar = "\n\n";
for($i = 1; $i <= 12; $i++){
$year_calendar .= "";
if ($i == 3 or $i == 6 or $i == 9) {
$year_calendar .= "\n\n";
}
} // for
$year_calendar .= "
Mois $i
".$this->html_month_calendar($i,$y )."
";
return $year_calendar;
}
}
$cal = new calendar;
//echo $cal->html_month_calendar();
echo $cal->html_year_calendar();
?>