日历日视图在PHP [英] Calendar Day View in PHP

查看:151
本文介绍了日历日视图在PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作增加了日视图选项,以现有日历解决方案。和许多人一样实现自己的日历,我试图模拟谷歌日历。他们有一个很好的日历解决方案,他们的日子视图提供了很大的灵活性。对于大多数情况下,实施进展顺利;但是,我有问题,当它涉及到冲突的事件。

I'm working on adding a day view option to an existing calendar solution. Like many people implementing their own calendars, I am trying to model Google Calendars. They have an excellent calendar solution and their day view provides a lot of flexibility. For most part, the implementation is going well; however, I'm having issues when it comes to conflicting events.

基本上,我想的事件共享相同的空间中,并排。启动同时的事件首先应该具有最长的事件。在这个例子中的数据集,我努力着,我有四个事件:

Essentially, I want the events to share the same space, side by side. Events that start at the same time should have the longest event first. In the example data set I'm working with, I have four events:

答:10:30 - 11:30

A: 10:30 - 11:30

B:13:30 - 14:30

B: 13:30 - 14:30

C:10:30 - 11:00

C: 10:30 - 11:00

D:10:45 - 14:00

D: 10:45 - 14:00

我可以处理A,C和D就好了,问题就来了与C应的D留下D. A应留;宽度每次服用三分之一(它是固定宽度,所以我可以做简单的数学明白这一点)。问题是,B就应该是A和C下,到D的左理想的情况下,B将占用的空间,A和C同样数额(三分之二的宽度),但我甚至会满足于只只占用了三分之一的宽度。

I can handle A, C, and D just fine, the problem comes with D. A should be left of C which should be left of D; each taking one third of the width (it's fixed width so I can do simple math to figure that out). The problem is that B should be under A and C, to the left of D. Ideally, B would take up the same amount of space as A and C (two thirds width), but I would even settle for it only taking up only one third width.

我的活动的阵列类似于以下内容:

My array of events looks similar to the following:

$events = array(
  '1030' => array(
    'uniqueID1' => array(
      'start_time' => '1030',
      'end_time' => '1130',
    ),
    'uniqueID2' => array(
      'start_time' => '1030',
      'end_time' => '1100',
    ),
  ),
  '1045' => array(
    'uniqueID3' => array(
      'start_time' => '1045',
      'end_time' => '1400',
    ),
  ),
  '1330' => array(
    'uniqueID3' => array(
      'start_time' => '1330',
      'end_time' => '1430',
    ),
  ),
);

我的计划是部分指标添加到包括它有多少冲突事件每个事件(这样我就可以计算出宽度)和它的位置在那个系列应该是(这样我就可以计算出左侧值)。然而,这不利于对B。

My plan is to add some indexes to each event that include how many events it conflicts with (so I can calculate the width) and which position in that series it should be (so I can calculate the left value). However, that doesn't help the B.

我想我可能需要使用一些基本的几何形状和矩阵算法,但我不知道从哪里开始。

I'm thinking I might need an algorithm that uses some basic geometry and matrices, but I'm not sure where to begin.

任何帮助是极大的AP preciated。

Any help is greatly appreciated.

推荐答案

这并不能帮助自己的自定义日历的发展,而且为你想达到一个谷歌日历一样的界面,我可以强烈推荐的的jQuery插件fullcalendar

This doesn't help with your own custom calendar development but as you're trying to achieve a google calendar like interface I can highly recommend the jQuery fullcalendar plugin.

这需要一个饲料日历数据,我目前挂钩它到Outlook Exchange公共日历,然后在月/周/天视图中显示。日视图可以提供实现你的原始请求的一个很好的例子。

It takes a feed for the calendar data, I'm currently hooking it up to an Outlook Exchange public calendar, and then display in month / week / day views. The day view may offer a good example of implementing your original request.

这篇关于日历日视图在PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆