Calendar Php

class pcCalendar
{
var $gaWeekTitles;
function pcCalendar()
{
/* initialise the global variables */
$this->gaWeekTitles[] = "Sunday";
$this->gaWeekTitles[] = "Monday";
$this->gaWeekTitles[] = "Tuesday";
$this->gaWeekTitles[] = "Wednesday";
$this->gaWeekTitles[] = "Thursday";
$this->gaWeekTitles[] = "Friday";
$this->gaWeekTitles[] = "Saturday";
}
function intShowCalendar( $intYear = 0, $intMonth = 0 )
{
/* if month and/or year not set, change to current month and year */
$intMonth = ( $intMonth == 0 ) ? strftime( "%m" ) : $intMonth;
$intYear = ( $intYear == 0 ) ? strftime( "%Y" ) : $intYear;
/* determine total days in month */
$lintTotalDays = 0;
while ( checkdate( $intMonth, $lintTotalDays + 1, $intYear ) )
$lintTotalDays++;
/* build table */
$this->intStartTable();
$this->intStartRow();
for ( $i = 0; $i < 7; $i++ )
$this->intDisplayWeekTitle( $i );
$this->intFinishRow();
$this->intStartRow();
/* ensure that enough blanks are put in so that the first day of the month
lines up with the proper day of the week */
$lintOffset = date( "w", mktime( 0, 0, 0, $intMonth, 1, $intYear ) );
for ( $i = 0; $i < $lintOffset; $i++ )
$this->intDisplayDay( "?" );
/* start filling in the days of the month */
for ( $lintDay = 1; $lintDay <= $lintTotalDays; $lintDay++ )
{
$this->intDisplayDay( $lintDay );
/* terminate row if we're at on the last day of the week */
$lintOffset++;
if ( $lintOffset > 6 )
{
$lintOffset = 0;
$this->intFinishRow;
if ( $lintDay < $lintTotalDays )
$this->intStartRow();
}
}
/* fill in the remainder of the row with spaces */
if ( $lintOffset > 0 )
$lintOffset = 7 - $lintOffset;
for ( $i = 0; $i < $lintOffset; $i++ )
$this->intDisplayDay( "?" );
$this->intFinishRow();
$this->intFinishTable();
}
function intStartTable()
{
/* this function should be overridden with your own routines */
echo '';
}
function intFinishTable()
{
/* this function should be overridden with your own routines */
echo '
';
}
function intStartRow()
{
/* this function should be overridden with your own routines */
echo '';
}
function intFinishRow()
{
/* this function should be overridden with your own routines */
echo '';
}
function intDisplayWeekTitle( $intWeekDay )
{
/* this function should be overridden with your own routines */
echo '', $this->gaWeekTitles[
$intWeekDay ], '
';
}
function intDisplayDay( $intDay )
{
/* this function should be overridden with your own routines */
echo '', $intDay, '';
}
}
?>