views:

105

answers:

2

Hello, I am trying to do a dual-timetable system thing.

Basically, it's for a school project, and some schools have week 1 and week 2 systems.

The way this works is through alternating each week, so at the start of september, the school week starts on week 1, and the next week is week 2.

How would I implement this in PHP an MySQL?

A: 

Seems that there is no clear answer, and hasn't been actually done before.

Shamil
A: 

This is a big project. I've done it for an educational management system where knowing what classes were on at a particular time was pervasive.

The way we made it work was to have an object that converted between a real datetimestamp, and a 'schooltime' value that consisted of the run, the term/semester, the week, the day and the period. The run ID was so that different period layouts could be built for different school years, and also for different sections of a school. Each term also knew what the week cycle was, e.g. 1 which would mean all weeks were the same, 2 for a week 1/2 arrangement, or any other value if you wanted to get fancy. (The object code also had some fancy caching logic to save unnecessary conversions. This is also what taught me to use the the PHP date libraries exclusively for date manipulation: daylight-savings shifting mid-term must be handled correctly!)

As far at the database went, items that needed to be oriented with a schooltime, rather than a real datetime, such as timetable entries, had five columns for the various elements of the schooltime object. They did not record real datetimes: only schooltimes. We also stored one entry per actual period. Although this made systematic changes harder, it meant individual changes could be more easily accomodated. We were thinking of experimenting with an override type structure, but it was a lot of work. If I got to start from scratch again, I would give it a try.

staticsan