PHP Classes
elePHPant
Icontem

Calendar week, month and year with event day: Display calendars denoting event days

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (18)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2009-06-29 (8 years ago) RSS 2.0 feedStarStarStarStar 66%Total: 2,803 This week: 1All time: 1,304 This week: 702Up
Version License PHP version Categories
dycalendarevent 1.5GNU General Publi...5.0HTML, PHP 5, Time and Date
Description Author

This class can be used to display calendars denoting event days.

It can display calendars of given week, month and year using HTML tables.

The presentation of the calendars is configurable using CSS classes. The days of given events are denoted using special CSS classes.

The text for the month and week day names is also configurable.

Recommendations

Calendar of events
Calendar of events to put on a Web page

What is the best PHP calendar class?
I want a calendar on which I can mark and save the marked dates

Name: Marosdee Uma <contact>
Classes: 1 package by
Country: Thailand Thailand
Age: 31
All time rank: 10992 in Thailand Thailand
Week rank: 547 Up1 in Thailand Thailand Up

Details
/**
 * 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
 *
 **/
Screenshots  
  • calendar_year_4_column.gif
  • calendar_week_mini.gif
  • calendar_month_mini.jpg
  • calendar_month_big.gif
  Files folder image Files  
File Role Description
Files folder imagewithDataBase (9 files)
Files folder imagewithoutDataBase (7 files)
Plain text file class.calendar.php Class class.calendar
Plain text file readme.txt Doc. readme

  Files folder image Files  /  withDataBase  
File Role Description
  Plain text file addEvent.php Example addEvent
  Plain text file connectDB.php Aux. connectDB
  Plain text file month.php Example month
  Plain text file monthmini.php Example monthmini
  Plain text file navbar.php Example navbar.php
  Plain text file week.php Example week
  Plain text file weekmini.php Example weekmini
  Plain text file year2col.php Example year2col
  Plain text file year4col.php Example year4col

  Files folder image Files  /  withoutDataBase  
File Role Description
  Plain text file month.php Example month
  Plain text file monthmini.php Example monthmini
  Plain text file navbar.php Example navbar
  Plain text file week.php Example week.php
  Plain text file weekmini.php Example weekmini
  Plain text file year2col.php Example year2col.php
  Plain text file year4col.php Example year4col

 Version Control Unique User Downloads Download Rankings  
 0%
Total:2,803
This week:1
All time:1,304
This week:702Up
User Ratings User Comments (1)
 All time
Utility:87%StarStarStarStarStar
Consistency:87%StarStarStarStarStar
Documentation:70%StarStarStarStar
Examples:70%StarStarStarStar
Tests:-
Videos:-
Overall:66%StarStarStarStar
Rank:614
 
somethink happen week.
7 years ago (andi kumala sakti)
80%StarStarStarStarStar