拥有双时间表系统

发布于 2024-08-05 21:48:13 字数 142 浏览 4 评论 0原文

我正在尝试做双时间表系统的事情。

基本上,这是一个学校项目,有些学校有第一周和第二周的系统。

其工作方式是每周交替进行,因此在 9 月初,学校周从第一周开始,下周是第二周。

我如何在 PHP 和 MySQL 中实现这一点?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怎会甘心 2024-08-12 21:48:13

似乎没有明确的答案,而且之前也没有实际做过。

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

停顿的约定 2024-08-12 21:48:13

这是一个大工程。我已经为一个教育管理系统做到了这一点,在该系统中,人们普遍知道特定时间正在上什么课程。

我们让它发挥作用的方法是让一个对象在真实的日期时间戳和“上课时间”值之间进行转换,“上课时间”值由跑步、学期/学期、周、日和期间组成。运行 ID 可以为不同学年以及学校的不同部分构建不同的时期布局。每个术语还知道周周期是什么,例如 1 表示所有周都相同,2 表示一周 1/2 安排,或者如果您想要喜欢的任何其他值。 (目标代码还有一些奇特的缓存逻辑来节省不必要的转换。这也教会了我专门使用 PHP 日期库进行日期操作:夏令时转换中期必须正确处理!)

就数据库而言,需要以上课时间而不是真实日期时间为导向的项目(例如时间表条目)有五列用于表示 schooltime 对象的各个元素。他们没有记录真实的日期时间:只有上学时间。我们还为每个实际周期存储了一个条目。尽管这使得系统性的改变变得更加困难,但这意味着个人的改变可以更容易地适应。我们正在考虑尝试覆盖类型结构,但工作量很大。如果我能重新从头开始,我会尝试一下。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文