Event calendar database design using iCalendar in PHP and MYSQL

After long time we are publishing a new article about calendar events and multiple recurrence with mysql. So many free open source scripts are available for integrating calendar events. In this post explains how to integrate iCalendar event calendar script in PHP with MYSQL. Lets see database design things are

iCalendar recurrence event script

We have split two different ways of db structure one is a usual method and another one is a iCalendar method.

Old Method:

Id event start_time end_time is_all_day repeat_type interval
2 Home 2017-10-01 8:00:00 2017-10-30 9:30:00 0 1 1:30
1 Home 2017-10-01 10:00:00 2017-11-30 12:00:00 0 2 2

Notes: 

is_all_day – all day event (0-FALSE, 1-TRUE)

repeat_type – 1-daily, 2-weekly, 3-monthly, 4-yearly

interval – event duration.

Cons:

  1. table dumping issue occurs.
  2. complex query to use for get repeating events.
  3. loading problem occurs in calendar.

Instead of this method to use iCalendar event scheduler.

iCalendar Method:

  1. iCalendar globally declares some common objects to get and set variables with some specific values.
  2. It supports both API and web platforms.
  3. This calendar plugin support responsive.
  4. Initially they provide some common add/edit/delete events popup functionalities in a calendar.
  5. Simple recurring/repeating method for long time event tracking. It defines with rrule method.
  6. Read more iCalendar specifications from here.

Define rrule:

rrule is nothing but recurring rule. It always start FREQ keyword. We have to define the values for it and read more structure from here.

For example it is a weekly event this should start every monday to friday means that

  1. In this way to define daily, monthly and yearly too.
  2. Database wise it stored in event table only one record.
  3. So we can get those records with event start and end time values.
  4. Query wise is also simple.
  5. Read more recurring events click here. 

Now we create a database and below these tables.

Step 1: calendar table

Step 2: events table

Download iCalendar event full script from our github page click here.

Right now we use iCalendar script and will add more related post to iCalendar functional wise in future.

Thanks for reading this post and let me know your feedback its very helpful to all readers.

Comments

comments

phpexpertise

I’m Blogger and Programming Blog, Tutorials, PHP, MySQL, jQuery, Laravel, Wordpress and Codeigniter