I am developing a calendar system, modeling off of the Yahoo Calendar & Palm Pilot Datebook..
I have the calendar display code complete (to display a month, week and day view) as well as a simple database for one-time events (everything is based off a unix timestamp (mktime and getdate functions)) --
however, I am having a design issue with repeating events. I would like to offer a comprehensive list of options for repeating events (every day, week, bimonthly, yearly, certain days during the week, etc..) but cannot figure out how to impliment this properly.
I was thinking of not allowing "always repeating" (no end date) and simply inserting a ton of records into the database when a repeating event is entered. I would use a field to link all the events together (incase they wanted to modify, delete, etc all the events) and therefore, I could easily run a query off the start time to get all the events for a specific month/week/day etc..
The other option was to create one entry and query the database for a certain time frame (ie a month) and then parse the result set in php .. however, I would have to maintain a secondary table to store dates that are "deleted" from the repeat (ie a meeting every thursday except for the first week in June..)
The second option seems correct as it would provide repeating events indefinitely, however, it seems like a lot of processing per request would be required which would slow down the response time, not to mention retrieving records that wouldn't be displayed at all (ie repeating yearly events, bimonthly events, etc..)
In anycase, if you have some ideas as to what would be considered the "best practice" for this calendar (assuming it is on a website and could potentially have thousands of hits per day), it would be much appreciated -- or possibly, if you know of some source code that is available, that would be awesome too....
thanks
John
I have the calendar display code complete (to display a month, week and day view) as well as a simple database for one-time events (everything is based off a unix timestamp (mktime and getdate functions)) --
however, I am having a design issue with repeating events. I would like to offer a comprehensive list of options for repeating events (every day, week, bimonthly, yearly, certain days during the week, etc..) but cannot figure out how to impliment this properly.
I was thinking of not allowing "always repeating" (no end date) and simply inserting a ton of records into the database when a repeating event is entered. I would use a field to link all the events together (incase they wanted to modify, delete, etc all the events) and therefore, I could easily run a query off the start time to get all the events for a specific month/week/day etc..
The other option was to create one entry and query the database for a certain time frame (ie a month) and then parse the result set in php .. however, I would have to maintain a secondary table to store dates that are "deleted" from the repeat (ie a meeting every thursday except for the first week in June..)
The second option seems correct as it would provide repeating events indefinitely, however, it seems like a lot of processing per request would be required which would slow down the response time, not to mention retrieving records that wouldn't be displayed at all (ie repeating yearly events, bimonthly events, etc..)
In anycase, if you have some ideas as to what would be considered the "best practice" for this calendar (assuming it is on a website and could potentially have thousands of hits per day), it would be much appreciated -- or possibly, if you know of some source code that is available, that would be awesome too....
thanks
John