jquery - What's the best way to implement recurring events in FullCalendar via PHP/MySQL? -



jquery - What's the best way to implement recurring events in FullCalendar via PHP/MySQL? -

i'm getting ready utilize jquery-based fullcalendar in online app using php/mysql , noticed when implementing recurring events, must place new item in event array each recurrence (using same id), this:

events: [ { id: 999, title: 'repeating event', start: new date(y, m, d-1, 16, 0), allday: false }, { id: 999, title: 'repeating event', start: new date(y, m, d+6, 16, 0), allday: false }, { id: 999, title: 'repeating event', start: new date(y, m, d+13, 16, 0), allday: false } ]

okay, that's not big deal. using mysql, i'll feed in event looped bunch of times, maybe 100 in future start date of event if doesn't have end date. i'm loading page bunch of javascript might not needed (if user opens calendar see 1 month). not cool.

there has improve way... have own experience this?

fullcalender default fetch events current time-frame using lazyfetching. generally, means you'll send-off ajax phone call when user switches out current month. can cut down server load turning off caching:

$('#calendar').fullcalendar({ events: { url: '/myfeed.php', cache: true } });

further, should optimize sql on server fetch events in given timeframe:

fullcalendar determine date-range needs events , pass info along in parameters. ... here url fullcalendar might visit:

/myfeed.php?start=1262332800&end=1265011200&_=1263178646

if utilize these parameters in sql, you'll drastically cut down info need send client:

select * events start > params_start_date , end < params_end_date

obviously, won't succinct when using recurring events, may illustration (in pseudo-code):

recurring_events.each |recurring_event| running_date = recurring_event.starts_on while running_date < params_end_date if running_date > params_start_date events.push { :event => event.id, :date => running.date, ... } end running_date = running_date + recurring_event.frequency_as_days end end

this way, you'll send total calendar applicable current view.

php jquery mysql fullcalendar

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -