PHP MYSQL Creating events with no recurring end date for jquery calendar -


what trying!

i making event calendar using jquery, php , mysql. events created stored in mysql database , fetched , displayed in calendar. events contain start , end date. in case user wants create event repeats through out week, can use recurring property of calendar , set recurring end date 1 week event start.

where blocked at!

suppose user requires recurring event dosenot end birthdays or weekly event repeats every week. in case think inserting each event database many years not approach. lets take case user creates daily repeating events 2 years. here database become populated.

what looking for!

can provide me idea on how manage repeating events no end dates or very long end dates.

maybe need 3 tables

  • event_base
    • with event, name, location, duration, , details, etc.
  • event_instance
    • for actual instances of reoccurring events
    • only create instances when user tries view month/week/day, etc.
    • only create instances if instance doesn't exist @ date
    • have original date , current date (in case instance can moved around)
  • event_reoccurrence table
    • with end date field. if end date null, there no end date.

here sample event_instance table schema

  1. event_base_id
  2. event_reoccurrence_id (null if no reoccurrence) rule created event.
  3. originally_created_for_date (if user moves instance won't re-added original date)
  4. current_date (the date shows on calendar
  5. location_override
  6. duration_override
  7. other overrides, etc.

here sample event_reoccurrence table schema (reoccurrence rules)

  1. event_reoccurrence_id
  2. event_base_id (unsigned int)
  3. day_of_week varchar(20)
  4. day_of_month varchar(20)
  5. day_of_year varchar(20)
  6. week_of_month varchar(20)
  7. week_of_year varchar(20)
  8. months_of_year varchar(20)
  9. years varchar(20)
  10. lastdate_of_reoccurrence date

values in #2 - #8 can single number, range "2-6", numbers seperated commas or null.

  • null means irrelevant (event can happen regardless of value)
  • some number: event happens on date when date matches number
    • weekday: 5 = event can not happen on days other friday
  • numbers seperated commas: event happens when of numbers matches
    • month: 2, 4, 5 = event can happen in february, april , may
  • range: event happens between range
    • days of month: 1-12 = event can happend 1st 12th of each month
  • when every non null field matches, date event happens on date.

so if check date , every field null or matches date, event happens on date. perhaps have multiple entries per event build complex patterns.

week of month first 7 days, not first sunday. if week_of_month 3 , day of week 2, , else null except event id, it's third tuesday of every month.

then person views calendar, request reoccurring events against each day of month , create actual events each 1 matches


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -