mb81 Posted February 2, 2007 Share Posted February 2, 2007 Hey everyone, I am working on a simple event listing out of a mysql table and I am trying to get an algorithm down for displaying recurring and one time events in the same listing in date order. The only thought I have had thus far is to do a step through for every day and see if it matches criteria (between start and end of recurring dates, not excluded), etc, but I think there has to be a better way to do it. I am always showing next X days (7 days on one portion of the site, "full list" goes to 30 days in advance, no other views). Any thoughts would be appreciated, thanks. Quote Link to comment Share on other sites More sharing options...
mb81 Posted February 28, 2007 Author Share Posted February 28, 2007 Can I bump this since there was no response. Anyone have any feedback? Quote Link to comment Share on other sites More sharing options...
Jenk Posted March 5, 2007 Share Posted March 5, 2007 At a guess.. Calculate the dates of your recursions, then offset them accordingly with one time dates. Quote Link to comment Share on other sites More sharing options...
mb81 Posted March 20, 2007 Author Share Posted March 20, 2007 At a guess.. Calculate the dates of your recursions, then offset them accordingly with one time dates. Well, the main problem is with things that in theory will repeat forever (weekly meetings), so it is not quite that simple. I have thought about using a model that states the day of the week and indicates it to repeat, but then for every date that I cycle through, I would have to find the number to correspond to that day of the week and search. Has anybody seen how this is constructed in calendar programs that might have a good solution? Quote Link to comment Share on other sites More sharing options...
redbrad0 Posted March 25, 2007 Share Posted March 25, 2007 I actually did something sort of like this and it worked, but not saying its the best way. Basically I created the event and in another table I listed out all the dates that the event would occur on. You can see from the attachment that it handled everything that outlook handled. I spliced together different parts of this web page so you could see the different options but a real basic table structure that I used was.... Event_ID Event_Name Event_RecurrencePattern EventDate_ID EventDate_EventID EventDate_DateTime This way you can easily list out all the dates. [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Jenk Posted March 26, 2007 Share Posted March 26, 2007 At a guess.. Calculate the dates of your recursions, then offset them accordingly with one time dates. Well, the main problem is with things that in theory will repeat forever (weekly meetings), so it is not quite that simple. I have thought about using a model that states the day of the week and indicates it to repeat, but then for every date that I cycle through, I would have to find the number to correspond to that day of the week and search. Has anybody seen how this is constructed in calendar programs that might have a good solution? It still falls back to what I said: Calculate the dates of your recursive appointments, then compare them to the one time events. Let's take a weekly meeting on Wednesdays: <?php if (date('D', $recursiveMeeting) == date('D', time())) echo "Today has a weekly meeting."; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.