PHP Classes

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    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 64%Total: 2,879 All time: 1,306 This week: 113Up
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.

Picture of Marosdee Uma
Name: Marosdee Uma <contact>
Classes: 1 package by
Country: Thailand Thailand
Age: 37
All time rank: 11172 in Thailand Thailand
Week rank: 312 Up1 in Thailand Thailand Up

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

Example

<?php

require_once("../class.calendar.php");

$eventDay = array(
                                   
'10-1-2009' => '???????',
                                   
'13-4-2009' => '????????',
                                   
'14-4-2009' => '????????',
                                   
'15-4-2009' => '????????',
                                   
'11-5-2009' => '??????????',
                                   
'12-8-2009' => '??????',
                                   
'5-12-2009' => '??????'
                                   
);

$day = array('?','?','?','?','??','?','?');
$class = array('colDay1', 'colDay2', 'colDay3', 'colDay4', 'colDay5', 'colDay6', 'colDay7');
$monthTitle = array('??????','??????????','??????','??????','???????','????????','???????','???????','???????','??????','?????????','???????');

// instance class ???????????
$cal = new calendar();

// ?????? Get ??????????
$cal->setWeek($_GET['w']);

//?????? Get ????????
$cal->setMonth($_GET['m']);

//?????? Get ?????
$cal->setYear($_GET['y']);

//????????????? ??????? true ??? ???? false ???????
$cal->setShowColor(true);

//??????????????????????????????
$cal->setTableWidth(900);

//??????? class ???????????????????????????
$cal->setTodayClass('today');

//??????? class ???????????????????????
$cal->setBlankClass('colBlank');

//???????????????????? 12 ???????????????????
$cal->setMonthTitle($monthTitle);

//?????????? ?.? true ??? ???? false ???????? ??.
$cal->setThaiYear(true);

//????????????????????? ??????? ??? ?????
$cal->setDayOfWeekTitle($day);

//??????? css class ??????? column ????????
$cal->setColumnClass($class);

//????????????????????????????????????????
$cal->setEventDay($eventDay);

//?????????????????????????????????????????????
//$cal->setMonthTitleFormat('{month} - {year}');


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="author" content="Marosdee" />
<style type="text/css">
p, div, span
{
    font-size: 12px;
    font-family: tahoma;
}
a:link, body a:link
{
    color: #414141;
    text-decoration: none;
    font: 12px Tahoma;
}
a:visited, body a:visited
{
    color: #414141;
    text-decoration: none;
    font: 12px Tahoma;
}
a:hover, a:active, body a:hover
{
    color: #414141;
    text-decoration: underline;
    font: 12px Tahoma;
}

.link1:link
{
    color: #33CCCC;
    text-decoration: none;
    font: 12px Tahoma;
}
.link1:visited
{
    color: #33CCCC;
    text-decoration: none;
    font: 12px Tahoma;
}
.link1:hover, .link1:active
{
    color: #FF6600;
    text-decoration: underline;
    font: 12px Tahoma;
}

.calendarWeek, div.calendarWeek
{
    border: 1px solid #FF9900;
}
.calendarWeek table
{
    margin: 5px; padding: 5px;
}
.calendarWeek td, .calendarWeek th
{
    margin: 2px;
    border: 1px solid #339966;
    text-align: center;
}
.colDay1, .colDay2, .colDay3, .colDay4, .colDay5, .colDay6, .colDay7, .colBlank
{
    width: 100px;
    height: 100px;
}
.today
{
    background-color: #FFCC99 !important;
    border: 1px solid #FF0000 !important;
}
.popup
{
    position: absolute;
    width: 150px;
    display: none;
    background-color: #FFFFFF;
    border: 1px solid black;
    padding: 5px;
}
</style>
<script type="text/javascript">
    function show(txt,id)
    {
        document.getElementById(id).innerHTML = txt;
        document.getElementById(id).style.display = "block";
    }
    function hide(id)
    {
        document.getElementById(id).style.display = "none";
    }
</script>
    <title><?php echo $cal->getPageTitle('m'); ?></title>
</head>

<body>
<?php require_once("navbar.php"); ?>
<?php

echo '<div align="center" class="calendarWeek">';
echo
'<h1>????????????????</h1>';
echo
$cal->calendarMonth();
echo
'</div>';

?>
</body>
</html>


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_month_big.gif
  • calendar_month_mini.jpg
  • calendar_week_mini.gif
  • calendar_year_4_column.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,879
This week:0
All time:1,306
This week:113Up
User Ratings User Comments (1)
 All time
Utility:84%StarStarStarStarStar
Consistency:84%StarStarStarStarStar
Documentation:68%StarStarStarStar
Examples:71%StarStarStarStar
Tests:-
Videos:-
Overall:64%StarStarStarStar
Rank:684
 
somethink happen week.
14 years ago (andi kumala sakti)
80%StarStarStarStarStar