PHP Calendar Class
Live Demo
View the Calendar Class in action:
- Full Calendar
Standard Full Calendar - Full Calendar w/Google
Full Calendar with locally defined events and events from Google Calendar - Mini-Calendar
Small Calendar perfect for sidebars. - Event List
Events shown in a list as opposed to calendar layout. - Mini Event List
Mini event list good for sidebars. - Play with the Color Scheme Generator
Test out the color scheme generator. Pass a single hex value when creating the calendar and all the colors are generated for you.
Description
Need to easily add a calendar of events to your website, php project or plugin? Tired of the calendar calculations? Like to save some time? Then this class is for you. Made for php developers, this class will allow you to add calendars in a variety of display types with only a few lines of code. Add unlimited events locally or display events from your Google Calendar.
Best of all only the single 56kb class file is required, no images or additional files*. Even the fully customizable color scheme is automatically generated for you.
*jQuery is added automatically but can be disabled
UPDATE & PURCHASE INFO
Thank you everyone for your interest in the Calendar Class! We are currently offering 2 license options:
- Regular: For use in your own project or a clients project. $15
- Extended: For use in a project you plan to distribute or for inclusion in a subscription or software as a service application. $75
Please request a license below. Upon receipt of payment the calendar class and examples will be sent to you via email. Alternatively you may make a payment directly via paypal to dustin@klovera.com
Please check back for updates!
Requirements
- PHP5
- PHP compiled with the Calendar Functions (likely already installed)
Features
- Output full, mini, event list & mini event list
- Auto generated color scheme by passing one color or optionally set all colors individually
- Supports unlimited events
- Display events from one or more Google Calendars
- Display an interactive calendar with as little as 2 lines of code
- Uses no images, all css
- Include one class file and you are ready to go
- Interface animation powered by jQuery
- Plenty of display options
- Start from specified date
- Tested in IE 7, IE8, Firefox, Safari, Opera and Chrome
Updates
2011-1-20: v1.1 (Initial release)
2011-2-8: v1.2.1
- Several bug fixes
- Ajax mode added
2012-10-28: Added Paypal form to this page for faster purchase
Documentation
Include the class file:
include('calendar.class.php');
Minimal Implementation:
$cal = new CALENDAR(); echo $cal->showcal();
Display Type:
$cal = new CALENDAR('full'); // options are full,mini,list,mini-list
echo $cal->showcal();
Color Scheme:
$cal = new CALENDAR(); // defaults to full $cal->basecolor = 'CC6666'; // any hex value echo $cal->showcal();
Start Date:
$cal = new CALENDAR('full','2012-6'); // format YYYY-M
echo $cal->showcal();
Add Event(s):
$cal = new CALENDAR(); // defaults to full $cal->addEvent( array( "title"=>"Event Title", // (required) "from"=>"2010-1-6", // (required) YYYY-M-D "to"=>"2010-1-8", // (required) YYYY-M-D "starttime"=>"5:30am", // (optional) "endtime"=>"7:30pm", // (optional) "color"=>"#D8E5F9", // (required) "location"=>"City, State", // (optional) "details"=>"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sagittis viverra imperdiet. Sed euismod molestie. ", // (optional) "link"=>"http://www.klovera.com" // (optional) ) ); echo $cal->showcal();
Add Google Calendar:
Note: You can find the Google Calendar XML feed in the calendar settings at Google.
$cal = new CALENDAR(); // full is default $cal->addGoogleCalendar( array( 'xmlfeed'=>'http://www.google.com/calendar/feeds/ckvf91cpb85v3crjn0mpnn53u4%40group.calendar.google.com/public/basic', // (required) 'color'=>'#D6FFD6', // (required) 'link'=>'http://www.klovera.com' // (optional) events will link here ) ); echo $cal->showcal();
All Options:
// displaytype, date, staticdisplaytype
$cal = new CALENDAR('full','2011-1',true);
// path to css file ('default' = default css, 'disable' = no css)
$cal->css = 'default';
// path to js file ('default' = default js, 'disable' = no js)
$cal->js = 'default';
// week start day (0-6 e.g. 0 = Sunday, 1 = Monday, etc.)
$cal->weekstartday = 0;
// includes jquery from google (true,false)
$cal->jqueryinclude = true;
// month/year select box (true=show selector,false=show month name)
$cal->monthselector = true;
// monthselector range of years (int)
$cal->yearoffset = 5;
// adds a column for week numbers (left,right,false)
$cal->weeknumbers = 'left';
// rotate weeknumbers 90 degrees (true,false)
// *currently only firefox is supported*
$cal->weeknumrotate = true;
// controls how weekdays are displayed. (1=full,2=abbrev,3=single char)
$cal->weeknames = 2;
// controls how weekdays are displayed. (1=full,2=abbrev)
$cal->monthnames = 1;
// base color for color scheme (hex)
$cal->basecolor = '7D9AC0';
// width of mini calendar
$cal->minicalwidth = '240px';
// width of mini event list
$cal->minilistwidth = '200px';
// base url for links on mini calendar (blank=disabled)
$cal->minilinkbase = '';
// width of the minical hover tip
$cal->tipwidth = '150px';
// all sizes scale on this value
$cal->basesize = '10px';
// event list view bg color
$cal->eventlistbg = 'ffffff';
// default text in event view when details is empty
$cal->eventemptytext = 'No additional details.';
// default date format
$cal->dateformat = 'F j, Y';
// default time format
$cal->timeformat = 'g:ia';
// font used to display the calendar
$cal->font = '"Lucida Grande","Lucida Sans Unicode",sans-serif';
// link target frame or window
$cal->linktarget = '_blank';
// limit the number of events in list
$cal->listlimit = 10;
Override Color Scheme:
All the following colors are automatically generated from the basecolor. You can optionally set these manually as follows.
$cal->linkcolor = '[any hex]'; // e.g. ffff00 $cal->calgradient = '[any hex]'; // e.g. ffff00 $cal->nodatecolor = '[any hex]'; // e.g. ffff00 $cal->nodatetextcolor = '[any hex]'; // e.g. ffff00 $cal->weekdaycolor1 = '[any hex]'; // e.g. ffff00 $cal->weekdaycolor2 = '[any hex]'; // e.g. ffff00 $cal->currentdaycolor1 = '[any hex]'; // e.g. ffff00 $cal->currentdaycolor2 = '[any hex]'; // e.g. ffff00 $cal->weekendcolor1 = '[any hex]'; // e.g. ffff00 $cal->weekendcolor2 = '[any hex]'; // e.g. ffff00 $cal->bordercolor = '[any hex]'; // e.g. ffff00 $cal->datetextcolor = '[any hex]'; // e.g. ffff00 $cal->headingtextcolor = '[any hex]'; // e.g. ffff00 $cal->headingcolor1 = '[any hex]'; // e.g. ffff00 $cal->headingcolor2 = '[any hex]'; // e.g. ffff00 $cal->shadowcolor = '[any hex]'; // e.g. ffff00

Wow this is exactly what I’m looking for and seems to be the easiest implementation! Is this class available for download?
It is currently pending approval on the Envato Marketplaces. I will email you with the details.I’ve decided to not offer this via Envato and distribute it directly. A new version of the website it under development and will include a support area and checkout system. In the mean time licenses can be purchased via paypal (dustin( at )klovera.com). $15 for a standard license (for use in projects for you or your clients) and $75 for an extended license (if you plan to use the class in a distributed application or ‘software as a service’). Please contact me with questions and check back for the unveiling of our new website!
Hiya, it’s a very nice calendar! :o is it available for download? or do you need to pay for it?
Greetz Geoff!!
It will be a licensed class on the envato marketplaces, specifically codecanyon (ie will have to pay a few dollars for it). I plan on finishing the documentation and making it available asap.My envato profile can be found here.You may also subscribe to my new file feed at http://codecanyon.net/feeds/users/klovera.atom for the latest updates.(now distributing directly – see above)
Hi Dustin,
Any update on availabilty off this cool looking class ?
Looking forward to implement in my projects !
Best,
Robby
Had to set it aside the documentation for a couple weeks due to a project deadline. I plan to have it complete and available in the next 2-4 weeks. If anyone needs it before then please let me know.
Yes I would really love to take a look at the code to use it in my own project !
I’ll shoot you an email with details.
Could really use this as well. Email me. Thanks.
Will do :)
Could you please send me the code as would love to have a look and also help me in my own project. Many thanks x
Please email me the details as well!
I like very much your class. I would like use it in one my poject and I would like buy it. How can I make a payment and download the class?
I will be updating this post in a few mins to include purchase/license info.
@Peter Thank you for your interest. I will email you the info!
Dustin,
Will you also be adding support for weekly and daily views? This seems to be the trickiest part of most calendars.
Stephen
Absolutely! Weekly and daily views are in the works as is a ‘timeline’ view.
Dustin, any idea when this will be?
I do not have a solid development timeline currently. Updates are made periodically. Please check back.
Dustin,
My team and I ran across your calendar and I like it a lot. We are in the process of creating our own, with a very similar idea in mind. But after running across yours, we might consider using yours. W have a few questions about the calendar I need to ask. First, is the details of the payment info? Is it a one time fee? What kind of subscription is it? Does it cover usage for thousands of users (Our website/project)?
I need to know if there is any built in support for MySql or if that is even possible? Finally, can we edit the calendar in anyway? You have a great class and the ads are awesome!
Dustin, I am self-taught as well and learn from breaking down code from people like you. I built a site for my daughter’s softball organization and am interested in your calendar. I have been looking for something like this to add to the sidebar for awhile. If purchased, do you provide directions for implementation?
Thank you for your interest in the Calendar Class! The package includes example implementations along with the class itself. If you have an understanding of PHP & HTML the instructions should be sufficient in getting you started!
For anyone who has been looking for a calendar that you can quickly implement into your website while matching your color scheme, the search is over. I had the mini-calendar and mini-list working on my site in less than fifteen minutes and that includes playing with the hex codes to get the colors just right. For the small price that you pay for Calendar.Class, you get a great product and great service. Thanks, Dustin.
For anyone else thinking of buying this. Purchased in 5 minutes. Class running in 10 secs. Seriously nice piece of coding, with great examples and well commented. Recommended.
@Dom Thank you for your comments :) Glad to hear you are enjoying the calendar class!
Excellent piece of code and classes Dustin,
Again – to anyone looking to buy DO IT!
I had some issues initially setting this up on a VBulletin board, but now it works superbly. It’s instant and really looks the biz on my site/forums.
It’s used by a lot of people and they’re all very happy with the look and layout plus all the info we can add to it.
Well worth every penny.
Amazing work, thank you very much, been looking for something like this for a VERY long time, esp having to have it co-exist with a VB board.
I would like to purchase the license for $15.00. This is by far the nicest looking calendar script I have seen. Great work! Going to save me a bunch of time and allow me to work on the functions to add events to an existing Google calendar which can then be displayed by your calendar script on my clients website. Let me know how to pay (via Paypal I assume).
Thanks.