Short Stories
Photo Albums
DE-DSO MKE
Linux
PHP
Links
Miscellaneous
Communications
Login
| Review of PHP Calendar |
| Reviews | |||
| Written by Tim Bonesho | |||
|
Introduction:
Recently I had a requirement to build a dashboard that was calendar based. All of the data originates from a series of MySQL tables. The dashboard calendar could take either the form of an event calendar (listing details scheduled by date) or a conventional monthly calendar with linkage to the details. Having gone through a number of calendar and Gantt Chart application builds from scratch, I decided that, for this project, I would make an earnest effort to see if an open source library was available to do the heavy calendar lifting.
My first stop in searching for available scripts was HotScripts.com . Doing the usual search within PHP scripts, resulted in about 200 hits. Checking through the first page of scripts, I found a number that would potentially fit my requirements. Checking a bit deeper, several classes looked too detailed for my limited application. I narrowed my download to 3 different calendar class libraries. Reviewing the code and and examples supplied by each of these libraries, the one that looked the most promising was the PHP Calendar authored by Gerd (Gerry) Tentler http://www.gerd-tentler.de/tools/phpcalendar/.
Documentation:
The documentation that accompanies the application is pretty sparse. The main documentation on use is contained in the readme.txt file that is bundled in the zip download file. There are also a couple of script example files in the download package also. That is basically it for the documentation. Since there are so few options on the library call, the above referenced documents and examples should suffice in most situations.
Installation and Include:
The installation was very easy to accomplish as the library is totally contained within one file calendar.inc.php . The entire library is small compared to other class libraries I've used in PHP with a total size of 13.7KiB. Since I plan on accessing the library across a number of PHP applications, I put the include call embedded into the master include file that is used for all applications written in PHP. If you do not want to follow that approach, you will need to include it into the specific applications you are going to run with it as in include_once $_SERVER['DOCUMENT_ROOT'].'/eos2/ssi/php_calendar/calendar.ini.php';
Use:
The calendar was installed and used with PHP version 5.3.3-1. This instance of PHP is running with the Globals turned off. As mentioned above, the coding in support of the library is very simple. Here's a sample of some code I'm running to produce a number of month's schedules.
$cal = new CALENDAR($yr_in,$mo_in);
The above code is embedded into a single table cell (I'm doing multiple months each assigned to a separate table cell). The variables $yr_in and $mo_in contain the year and month for the calendar. The offset=-1 identifies the first day of the week as Sunday.
The calendar class has the ability to depict specific event(s) on days of the month. The feature allows a hover-over popup on the specific date. Additionally on the day's events, you can fill the color on the date as well as supply a url for additional information. An example from one of my applications is:
$cal ->viewEvent($start, $end, $color, $roster, "http://localhost/eos2/dbr/dc2p1a.php?dt_out=".$date_out);
The variables $start and $end the start and ending date for the event. The variable $color identifies the fill color for the event. The variable $roster contains the hover popup information (recommend that you keep is short). Finally, the url address is the on-click location that the user is taken to when they click the calendar date.
After looping through any events for the specific month, the calendar class is completed like: print $cal->create();
Here's an example of a simple calendar set that was generated with the PHP Calendar
Because of the deep red that I used for a fill color, I lost the background dates for the Sundays. Adjusting to a lighter shade of red will restore these date displays.
Conclusion:
I found that the PHP Calendar was very easy to deploy and use. The class is very simple in it's constructs but still provides the variations that I needed for these projects. Because of it's simplicity, it runs very well in the few environments that I tried it on. Additionally, I found the coding to be very stable with no un-intended crashes etc. The author is to be commended for assembling an outstanding calendar library with limited coding. Based on my experiences with the library I would rate it at 4.5 stars and would highly recommend that you take a serious look at it if your application needs a month view calendar with the capabilities mentioned above..
Tim Bonesho
|


Comments