A bit of history if you are interested
I can vaguely recalled that a designer friend wanted to add a calendar to a custom made CMS. We searched high and low found a few good ones – some commercial and some open source. He found the installation and configuration daunting though.
As a programmer, I knew that playing with dates is always complicated. That is why, creating a calendar from scratch is not a simple task. At about the same time, I was researching in how to create a calendar in a quick and efficient way. After a few days of hard work, I managed to come up with a quick solution. To make his life easier, I combined the source code and the cofiguration variables into one file so he can just include one php line in his current CMS and get it to work. The quick calendar turned out to be functional and good enough to meet the deadline.
I then decided to share the code in evolt.org and received alot of request to add more features. Well, that was good and bad news for me. Good news because many people like it – felt good; Bad news because my daytime work became hectic and I don’t have the time!
Thanks for the support
I would like to thank everyone at evolt.org for giving ideas and commenting on the quick calendar. I hope many people find it useful. It has been a year++ since I last updated it… as mentioned, I didn’t have the time to improve on it. The christmas break provided me some time to re-look at the calendar again. I took on the comments that you guys left on the evolt article or emailed me and made some changes. It turned out that the changes I’ve made was quite major. I’ve updated the code. check it out:
The installation instructions is in the source code.
As you can see, my css skills aren’t that great. Well, I am not a designer.
One big change was the addition of more comments in the source code. I hope that will make things easier if you decide to hack it (you might need to if you want drastic change in the layout for now). The structure of the class has been changed as well. Instead of using 2 separate classes and aggregation, I decided to use one base calendar class and inheritance. There were also some tweaks in the logic and bug fixes.
I still think there are room for improvements:
1. I like to separate the presentation from logic. At the moment, the QCalendarStandard class is working like a ‘view’, creating all the html code. Not ideal. Ultimately, the user should be able to design the layout without touching the source code.
2. As the calendar becomes more flexible, there is a need to separate the application into a few files. Perhaps a config file, a css file, a base class file, a few more extension classes, a template file. This also means that the installation becomes slightly complex (something against my wish!!). I was struggling with this for a long time. It was the first time I chunked all the code into one file. The reason was simple – I wanted to make the installation idiot proof, minimise installation procedures and reduce the complication with other running apps.
3. Use PHP 5 Coding standards. Eg using “__construct” and proper variable declaration. I purposely made it in PHP 4 two years ago because I knew alot of apps are still using PHP 4. Its probably time to upgrade.
4. I think the way the ajax function – qCalendarDetails() is being used to display the long description is kinda doggy. I probably need to rethink that part or create a user friendly admin panel to administer the calendar.
5. Yes, I think adding a calendar admin panel is a good idea.
6. Possible to use css to create the calendar instead of using tables.
I will post the more information on how to use the calendar in the demo soon.