Page 1 of 1

Reccuring events in calendar application

Posted: Fri Nov 21, 2003 4:32 am
by JayBird
Im really stumped on this one.

I have built a calendar application (monthly view) where users can input appointments and the like.

This part was quite easy, but now i need to add a feature so when someone adds an appointment, they can choose whether it reccurs weekly or monthly.

I haven't got a clue how to make the appointments appear for future dates.

I don't think i can use a cron job to update all the recurring appointments because a user is able to choose a month they want to view in the future and the appointment needs to be shown there too.

I can't imagine that for each day, i need to check back to see if there were any recurring events?

Any pointers on how i would achieve this?

Thanks

Mark

Posted: Fri Nov 21, 2003 10:15 am
by xisle
You may want to create a single record for each occurrence. Flag that record with a key to the description of the recurring event.

Soo two tables
recurring table: recurring id, description
events table: event id, recurring id, date, time, etc.

that is one way to handle it..

Posted: Fri Nov 21, 2003 10:19 am
by JayBird
what if the event that i am entering recurrs indefinately?

The way you suggested is not a bad idea if i want an event to occur monthly for the next 8 months, but not indefinately recurring.

Any other ideas how to handle this situation?

Thanks

Mark

Posted: Fri Nov 21, 2003 10:36 am
by xisle
You could have the user choose a start_date and end_date along with the frequency.
You could also have the user choose every individual date from a twelve month calendar-- I prefer this method because of flexibility around holidays, plus it looks cooler.

Posted: Fri Nov 21, 2003 10:40 am
by JayBird
xisle wrote:You could have the user choose a start_date and end_date along with the frequency.
What do you mean by frequency?

Mark

Posted: Fri Nov 21, 2003 10:47 am
by xisle
sorry, yeah the frequency ie. ( daily, weekly, monthly, every Friday )of the recurring event. This method works well but you will have to output the dates based on the frequency - which can be tricky.