I have a calendar that was previously divided into 30min blocks. I am updating the site and looking to implement a new idea for the calendar and wanted to see if anyone here had an opinion on the way the data should be saved/referenced.
The physical layout will be 7 columns (Monday-Sunday) x 48 rows (12:00am-11:30pm).
In my previous version I only allowed a single time slot to be registered to a single event, so 30mins was the max.
I would like to be able to scale the time up and down inside of the day which should be easy as the old design used a start_time and end_time with timestamps.
I would like to assign an event to span multiple days, lets say 1-2pm Mon-Fri.开发者_如何学C I would then like to display that event in a 7x48 table, with a rowspan=5 and colspan=2 for example, so its 1 large block containing the event details from the db.
I am not looking for code examples, but mainly an idea of how this would be best stored in a database with a format that would be easy to display/manipulate in my calendar class.
Any and all help is appreciated. Thanks!
Consider breaking down your task complexity by separating this into two SQL tables:
(1) events: stores relational event information, containing complex information such as date, time ranges, other information.
- add a "parent" field so you can lazily span an event by duplicating, and thus pointing each entry to the master one without having to recompute on the fly
(2) availability: stores nothing but HTML table information used for rendering - display confinement and issues (you can even bother giving it rowspan and colspan properties) so it has a 1:1 relationship to HTML tables.
Otherwise, look into event libraries with recurrence awareness or integrate your library with Google calendar.
精彩评论