Software Architecture

Although the calendar is ajaxian, it is actually 90% PHP and 10% Ajax/Javascript. The core logic is written in PHP and Ajax just comes in to improve user experience. One of the main features of the calendar lies in its efficient method of creating the right date to populate the calendar cells. I wrote about how this is done in

There are 2 important files that contain the core logic. Init.php and QCalendarBase.php.

init.php initialises the calendar and also acts like a controller for all incoming ajax request. It has a factory method that creates different calendar templates/theme based on user initialisation parameters.

QCalendarBase.php is the master template/theme file. It contains many commonly used functions for the calendar. All template classes inherits from this class.

The template classes are store under the ‘themes’ directory. Each template is a combination of the ‘Model’ and ‘View’ (MVC). I wanted to separate the view but come to think about it, rendering the view for the calendar still requires significant amount of programming as there would be some sort of looping involved. I suppose other programmers might want to implement the ‘View’ using a templating engine. This is open for discussion.

To customise the calendar, the only files that the user need to change are the template class and css files. At the moment, changing the template class still requires abit of programming skills though. I feel that I can still clean up the logic there abit to make the customisation easier.

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.

8 thoughts on “Software Architecture”

  1. Hi,

    I’ve made an adaption to the code to allow an event to have a start date and an end date. The calendar then shows that event over multiple days. (I can send you the file if required)

    Thank you very much for such an amazing app, with such well organised code.

  2. Please i would appreciate if you could send it to my email. I must implement a website for room reservation and your implementation will be very useful..

  3. Hi I am not a great programmer and php is not my primary language but I do have a need. I need to be able to identify saturdays for an SDA church site. As I say I am not a great programmer so your code logic is a bit above my threshold, so I need a pointer for where to look to see how the days are aligned with the dates. Please?

  4. Hi Grigzie, please, i will apreciated if you send to may email and help me with the adaption you have done, i needed for a school classes schedule website implementation. thanks in advance.

  5. Hi,

    First off – thanks for all your development work and posting your efforts as open source!

    I’ve downloaded the code and in testing cannot get any of the calendars to display correctly. I’ve changed the paths and am sure that’s not the problem. In looking at the posts and your notes, it appears that I’m missing the Init.php file – I cannot find it in the download. As you mention above, it’s one of two important files.

    Could you please point me to its’ location?


  6. Found my problem – it was indeed a path problem. And I also needed to apply the fixes mentioned in the blog on the Installation page. Here they are.

    Problem – Next / Previous Links don’t work
    All you have to do is do a find/replace on <?= and change it to <?php echo on the phtml files and on the controller.php and it works a treat.
    (hint: there are phtml files for each theme)

    hi genius,
    for this part:
    If you see the config.php,
    it should be something like this
    /qcalendar is the web location from “document root”

    htaccess file
    Place this in an htaccess file and place in the root of your website
    php_flag magic_quotes_gpc off
    php_flag short_open_tag off


    Thanks again for this great script!

  7. Hi!

    I am not a githubber, so how can I download the source?
    I need a calendar solution and have no time in the moment to start to learn other systems before coming to the solution of my plans …

    I hope you can help me,

    cheers, Connie

Comments are closed.