Jump to content

Recurring Actions (Calendar Events)


Rohlan

Recommended Posts

Hello everyone.

 

I'm building a calendar system for a client and have finally gotten to the recurring events which I was dreadfully fearing, and now the beast is showing its fangs.

 

Alright, first a little explanation on how it works, its pretty straightforward... each event is stored in the database, within the table "events" I have multiple fields, including starting hour, ending hour, starting date, ending date and "recurring" which can be 0 or 1.

 

So, each event has its own "identity" in the database. The user can specify an end date and also how often it repeats or on which days, in any case the problem I face now is, for recurring events... if an event has an undetermined end date - which happens oftenly - it would naturally be impossible to insert infinite number of events on the database.

 

Anyone have a suggestion? I have seen this be done on many calendar systems... just have no idea on how to take the first step in the right direction.

 

I have thought about Cron Jobs but I steer clear away from cron jobs usually... I'd much rather do it all programactically... I'm never comfortable with CJ...

 

Thank you for any tips!

 

Link to comment
Share on other sites

Cron jobs wouldn't even be for what you're trying to do. You just want to display information on a calendar, correct? When you set recurring to 0 or 1 in the db, lets say 1 = TRUE, then when you pull events for your db you need to have a special statement for when recurring == 1. Let's say it is an event that is once a week every monday, well just run a loop to display that information for as far as you want to go. If you're showing your calendar month by month, just make it generate the days/times that date is going to be displayed and echo it out. I may have made it sound more confusing than it should be. Hopefully it gives you an idea of where to go ;)

Link to comment
Share on other sites

The thing is, if an "event" starts on 10/12/2008 and ends on 12/12/2008, there will be 3 entries on the database:

 

1 - Client, Place, Hour, 10/12/2008

2 - Client, Place, Hour, 11/12/2008

3 - Client, Place, Hour, 13/12/2008

 

Now, if the end date is undetermined... how will I fill the database correctly? Each "event" has to be stored on the database as a unique entry, these aren't really "events" per-se, they are more like "interventions".

 

There is probably a much better way to do all this...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.