FullCalendar和MySQL - 跨越多个月的事件 [英] FullCalendar and MySQL -- Event Spanning Multiple Months

查看:86
本文介绍了FullCalendar和MySQL - 跨越多个月的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用jQuery FullCalendar作为日历系统,它对我所有的需求都很好。但是,我注意到了一个我自己无法解决的问题,而且我不太清楚如何解决这个问题。



我的大部分事件都存储在数据库中,并且可以正常工作:

 开始结束
-------------------- ----------------- --- //例如,2天长
2012-02-17T09:00:00 2012-02-19T09:00:00

我的问题是:每当我有一个跨越几个月的事件,事件就不会呈现,例如:

 开始结束
-------------------- ------ -------------- //例如,2个月长
2012-02-17T09:00:00 2012-04-17T09:00:00

我认为这可能与发送参数有关,它会发送第一个日历视口和最后日的一天。但是,如果我的活动超过两个月,出于某种原因,日历无法呈现活动。



我希望这是有道理的。任何对此的帮助都会很大。

感谢!

编辑:
对不起,我的查询。



使用上面的事件(从2月17日开始到4月17日结束)。您正在查看二月份,FullCalendar发送开始和结束参数:

  startParam 
2012-01- 29 00:00:00 //从UNIX转换

endParam
2012-03-04 00:00:00 //从UNIX转换




所以我的查询目前看起来像这样:

  SELECT event_title FROM events 
WHERE start> = 2012-01-29 00:00:00 AND end <= 2012-03-04 00:00:00

问题是,我的实际事件(2012-02-17)和(2012-04-17)的开始和结束 t属于上述查询的条件。



改变我的查询以显示长事件的最佳方法是什么?



谢谢!

  SELECT ... FROM events $解析方案

b $ b WHERE end> 2012-01-29 00:00:00或开始< 2012-03-04 00:00:00

这会为您提供所有期间重叠的所有事件被请求。


I am currently using jQuery FullCalendar as a calendar system, and it is working quite fine for all my needs. However, I have noticed one issue that I cannot seem to resolve on my own, and I'm not quite sure how to fix this.

The majority of my events are stored in the database like this (and work fine):

start                                  end
--------------------                   --------------------    //e.g., 2 days long
2012-02-17T09:00:00                    2012-02-19T09:00:00

My question/issue is: Whenever I have an event that spans across several months, the event is not rendered, for example:

start                                  end
--------------------                   --------------------    //e.g., 2 Months long
2012-02-17T09:00:00                    2012-04-17T09:00:00

I think this may have something to do with whenever the parameters are sent, it sends the "first" day on the calendar viewport and the "last" day. However, if my event spans over two months, for some reason the calendar cannot render the event.

I hope this makes sense. Any help on this would be great.

Thanks!

EDIT: Sorry I did not include my query.

Using the event above (starting on Feb 17th and ending on April 17th).

Say you are looking at the month of February, FullCalendar sends the start and end parameters:

startParam
2012-01-29 00:00:00  //converted from UNIX

endParam
2012-03-04 00:00:00  //converted from UNIX

So my query currently looks like this:

SELECT event_title FROM events
WHERE start >= 2012-01-29 00:00:00 AND end <= 2012-03-04 00:00:00

The problem is, the "start" and "end" of my actual event (2012-02-17) and (2012-04-17) don't fall within the conditions of the query above.

What would be the best way to change my query to show a long event?

Thanks!

解决方案

Your query should be

SELECT ... FROM events
WHERE end > 2012-01-29 00:00:00 OR start < 2012-03-04 00:00:00

That gives you all events which overlap at all the period being requested.

这篇关于FullCalendar和MySQL - 跨越多个月的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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