/**
* Function
**/
$eventDay = array(
'10-1-2009' => '????',
'13-4-2009' => '??????',
'14-4-2009' => '??????',
'15-4-2009' => '??????',
'11-5-2009' => '????????',
'12-8-2009' => '????',
'5-12-2009' => '?????'
);
/*-------------------------------------------*/
// Fetch event day from database into $activityDay
/*-------------------------------------------*/
$SQL = mysql_query("SELECT * FROM calendar");
while ( $ROW = mysql_fetch_array($SQL) )
{
list($d, $m, $y) = explode('-', $ROW['calendarDate']);
//Reformat date, remove 0 example 01-05-2009 to 1-5-2009
$calendarDate = ($d * 1) . '-' . ($m * 1) . '-' . ($y * 1);
if ( !isset($eventDay[$calendarDate]) )
$eventDay[$calendarDate] = '<div>' . $ROW['calendarTitle'] . '<br />' . $ROW['calendarTime'] . '</div>';
else
$eventDay[$calendarDate] = $eventDay[$calendarDate] . '<br /><div>' . $ROW['calendarTitle'] . '<br />' . $ROW['calendarTime'] . '</div>';
}
############### HOW TO USE ################
$cal = new calendar();
//????????????????? GET[w]
//get calendar week number from GET[w]
$cal->setWeek($_GET['w']);
//??????????????? GET[m]
//get calendar month number from GET[m]
$cal->setMonth($_GET['m']);
//???????????? GET[y]
//get calendar year number from GET[y]
$cal->setYear($_GET['y']);
//?????????? ?????? true ??? ??? false ?????
//show color or not in column 'TRUE OR FALSE'
$cal->setShowColor(true);
//??????? ?.? true ??? ??? false ????? ??
//show year with thai year will +543 'TRUE OR FALSE' example '2009' will dislplay '2552'
$cal->setThaiYear(false);
//????? class ????????????ç???????
//set css class for today
$cal->setTodayClass('today');
//????? class ??????????????????
//set css class for blank column
$cal->setBlankClass('colBlank');
//???????????????????????»?
//set column per row in calendar year
$cal->setYearColumnPerRow(2);
//????????????????????
//set new color $color = array 1-7
$color = array('#D4D4FF','#D4FFD4','#D4FFFF','#E1E1E1','#FFD4FF','#FFD4D4','#FFFFD4');
$cal->setColor($color);
//?????????????? 12 ??????????????
//set new month title array 1 - 12
$monthTitle = array('january','February','March','April','May','June','July','August','September','October','November','December');
$cal->setMonthTitle($monthTitle);
//?????????????????????
//set calendar table width
$cal->setTableWidth(200);
//??????????????? ????? ?? ?????
//set day title
$day = array('S','M','T','W','TH','F','SA');
$cal->setDayOfWeekTitle($day);
//????? css class ????? column ??????
// set css class array 1-7
$class = array('col','col','col','col','col','col','col');
$cal->setColumnClass($class);
//???????????´???????????????????
// added event day from $eventDay
$cal->setEventDay($eventDay);
//??????????????????????????????????
//set calendar week title format
// {week} will replace with 1-6
// {month} will replace with month title
// {year} will replace with year 1790 or 2009
$cal->setWeekTitleFormat('{week}-{month}-{year}');
//????????????????????????????????
//set calendar monthtitle format
// {month} will replace with month title
// {year} will replace with year 1790 or 2009
$cal->setMonthTitleFormat('{month} - {year}');
//??????????????????»??????????
//set calendar yeartitle format
// {year} will replace with year 1790 or 2009
$cal->setYearTitleFormat('?????? {year}');
//??????????????????????????
//set display day of back month 'TRUE OR FALSE'
$cal->setShowBackDay(true);
//???????????????????????
//set display day of next month 'TRUE OR FALSE'
$cal->setShowNextDay(true);
############### ????????? ################
//????? title ???????
//display page title
// param
// w :: for calendar week
// m :: for calendar month
// y :: for calendar year
echo $cal->getPageTitle('w');
//display calendar week
echo $cal->calendarWeek();
//display calendar month
echo $cal->calendarMonth();
//display calendar year
echo $cal->calendarYear();
/** change log **
*
* 1.0 first release
* 1.1
* - added calendar year
* 1.2
* - can set today class
* - added normalDayFormat function
* - added activityDayFormat function
*
* 1.3
* - change the name of function activityDay to eventDay
* - change the name of function activityDayFormat to eventDayFormat
* - change the name of var activityDay to eventDay
* - can set use thai year or not
* - can set blank column class
*
* 1.4
* - can go or back in year calendar
* - added class in calendar header, title, today row
*
* 1.4.1
* - fixed today not display in IE browser
*
* 1.5
* - remove back and next navigation in month calendar when display in year calendar
* - display back day of back month in calendar and can set display or not
* - display next day of next month in calendar and can set display or not
*
**/
|