简体   繁体   English

PHP + MySQL +重复日历事件

[英]PHP + MySQL + Repeating Calendar Events

I know this has been a question asked many times and I wish there was some solid answers out there, so i'm going to try and ask it and see if we can get a different response. 我知道这个问题已经问了很多遍了,我希望那里有可靠的答案,所以我将尝试问一下,看看是否能得到不同的答复。

I realize there are tons of complexity's in dealing with recurring events. 我意识到处理重复发生的事件有很多复杂性。 But is my understanding right if I were to do something like of this nature: 但是,如果我要做这种性质的事情,我的理解是正确的:

MySQL column (RRULE) When a user enters in an event ant says, "This repeats", now enter in this RRULE information Such as, (ie: FREQ=YEARLY;BYMONTH=3;BYDAY=2SU ) MySQL列(RRULE)当用户输入事件ant时说“这重复”时,现在在此RRULE信息中输入,例如(FREQ = YEARLY; BYMONTH = 3; BYDAY = 2SU)

So use this method instead of INSERTING hundreds of events of the same thing, just create 1 table to store my repeating events and then add this RRULE column for the event, correct? 因此,使用此方法而不是插入同一事件的数百个事件,只需创建1个表来存储我的重复事件,然后为事件添加此RRULE列,对吗?

Question 2. How do you determine the maximum length of an event if stated, "Repeat this forever" (ie: a birthday). 问题2。如何确定事件的最大持续时间,如果说“永远重复此事件”(即:生日)。

Question 3. Is there a better way to do this, than what I am thinking? 问题3.是否有比我在想的更好的方法?

If you could shed some light on what I am questioning, that would be greatly appreciated. 如果您能阐明我的疑问,将不胜感激。 I would like to write a class that handles all the information based on this setup but would like to know if I am on the right track or not. 我想编写一个基于此设置处理所有信息的类,但想知道我是否处在正确的轨道上。

Please and thank you! 谢谢,麻烦您了!

Yes, just enter it once. 是的,只需输入一次。 Calculate the first day for it to run, based off user input (what did they choose? yearly, monthly, etc) when you insert it, and put that in as the next run date. 插入时根据用户输入(他们选择了什么?每年,每月等)计算运行的第一天,并将其作为下一个运行日期。 Also store their type choice. 还存储其类型选择。 Then when you run the task at the specified time, you update the next run date/time based off the stored type choice. 然后,当您在指定时间运行任务时,将根据存储的类型选择来更新下一个运行日期/时间。 In addition you may want another field that indicates how many times to repeat; 另外,您可能需要另一个字段来指示要重复多少次。 forever, 4 times etc. Decrement this accordingly when running the task. 持续4次,等等。运行任务时相应减少此值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM