使用日期重复 API 将同一天的事件合并为日历中的一个事件
我使用 Date Repeat API 来设置每周发生的事件。但是,日期重复仅允许您将事件设置为一次(小时和分钟)。为了解决这个限制,我刚刚在内容类型中创建了另一个重复输入。 它工作得很好,但我希望日历中显示的两个时间段的节点标题显示为一个。因此,如果我一天有三个时间段,它只会显示为一个。
我尝试通过创建自定义模块来拦截查看结果,但它仅返回节点的信息,而没有任何有关其实际运行日期的信息。
[0] => stdClass Object
(
[nid] => 145
[node_title] => Repeat 1
[node_data_field_recurring_field_recurring_value] => 2011-05-19T20:00:00
[node_data_field_recurring_field_recurring_rrule] => RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TH,FR;UNTIL=20110722T235959Z;WKST=SU
[node_data_field_recurring_delta] => 0
[node_type] => test_event
[node_vid] => 145
[node_data_field_specific_date_field_specific_date_value] => 2011-06-15T16:00:00
[node_data_field_specific_date_delta] => 0
[node_data_field_recurring_2_field_recurring_2_value] => 2011-05-19T00:00:00
[node_data_field_recurring_2_field_recurring_2_rrule] => RRULE:FREQ=DAILY;INTERVAL=1;BYDAY=MO,FR;UNTIL=20110722T235959Z;WKST=SU
[node_data_field_recurring_2_delta] => 0
)
[1] => stdClass Object
(
[nid] => 145
[node_title] => Repeat 1
[node_data_field_recurring_field_recurring_value] => 2011-05-19T20:00:00
[node_data_field_recurring_field_recurring_rrule] => RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TH,FR;UNTIL=20110722T235959Z;WKST=SU
[node_data_field_recurring_delta] => 0
[node_type] => test_event
[node_vid] => 145
[node_data_field_specific_date_field_specific_date_value] => 2011-06-15T16:00:00
[node_data_field_specific_date_delta] => 0
[node_data_field_recurring_2_field_recurring_2_value] => 2011-05-20T00:00:00
[node_data_field_recurring_2_field_recurring_2_rrule] => RRULE:FREQ=DAILY;INTERVAL=1;BYDAY=MO,FR;UNTIL=20110722T235959Z;WKST=SU
[node_data_field_recurring_2_delta] => 1
)
[2] => stdClass Object
(
[nid] => 145
[node_title] => Repeat 1
[node_data_field_recurring_field_recurring_value] => 2011-05-19T20:00:00
[node_data_field_recurring_field_recurring_rrule] => RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TH,FR;UNTIL=20110722T235959Z;WKST=SU
[node_data_field_recurring_delta] => 0
[node_type] => test_event
[node_vid] => 145
[node_data_field_specific_date_field_specific_date_value] => 2011-06-15T16:00:00
[node_data_field_specific_date_delta] => 0
[node_data_field_recurring_2_field_recurring_2_value] => 2011-05-23T00:00:00
[node_data_field_recurring_2_field_recurring_2_rrule] => RRULE:FREQ=DAILY;INTERVAL=1;BYDAY=MO,FR;UNTIL=20110722T235959Z;WKST=SU
[node_data_field_recurring_2_delta] => 2
)
正如您所看到的,它只返回重复规则,所以我认为日历模块必须在之后进行计算。但在哪里呢?
Im using the Date Repeat API to set events that occur every week. However, date repeat only let's you set the event for one time(hour and minute). To solve this limitation I just created another repeat input in the content type.
It works great, but I want the node titles that show in my calendar for the two time slots to be displayed as one. So, if I have three timeslots on one day it will only appear as one.
I tried intercepting the View results by making a custom module but it only came back with the node's information without any info on the actual day it will be on.
[0] => stdClass Object
(
[nid] => 145
[node_title] => Repeat 1
[node_data_field_recurring_field_recurring_value] => 2011-05-19T20:00:00
[node_data_field_recurring_field_recurring_rrule] => RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TH,FR;UNTIL=20110722T235959Z;WKST=SU
[node_data_field_recurring_delta] => 0
[node_type] => test_event
[node_vid] => 145
[node_data_field_specific_date_field_specific_date_value] => 2011-06-15T16:00:00
[node_data_field_specific_date_delta] => 0
[node_data_field_recurring_2_field_recurring_2_value] => 2011-05-19T00:00:00
[node_data_field_recurring_2_field_recurring_2_rrule] => RRULE:FREQ=DAILY;INTERVAL=1;BYDAY=MO,FR;UNTIL=20110722T235959Z;WKST=SU
[node_data_field_recurring_2_delta] => 0
)
[1] => stdClass Object
(
[nid] => 145
[node_title] => Repeat 1
[node_data_field_recurring_field_recurring_value] => 2011-05-19T20:00:00
[node_data_field_recurring_field_recurring_rrule] => RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TH,FR;UNTIL=20110722T235959Z;WKST=SU
[node_data_field_recurring_delta] => 0
[node_type] => test_event
[node_vid] => 145
[node_data_field_specific_date_field_specific_date_value] => 2011-06-15T16:00:00
[node_data_field_specific_date_delta] => 0
[node_data_field_recurring_2_field_recurring_2_value] => 2011-05-20T00:00:00
[node_data_field_recurring_2_field_recurring_2_rrule] => RRULE:FREQ=DAILY;INTERVAL=1;BYDAY=MO,FR;UNTIL=20110722T235959Z;WKST=SU
[node_data_field_recurring_2_delta] => 1
)
[2] => stdClass Object
(
[nid] => 145
[node_title] => Repeat 1
[node_data_field_recurring_field_recurring_value] => 2011-05-19T20:00:00
[node_data_field_recurring_field_recurring_rrule] => RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TH,FR;UNTIL=20110722T235959Z;WKST=SU
[node_data_field_recurring_delta] => 0
[node_type] => test_event
[node_vid] => 145
[node_data_field_specific_date_field_specific_date_value] => 2011-06-15T16:00:00
[node_data_field_specific_date_delta] => 0
[node_data_field_recurring_2_field_recurring_2_value] => 2011-05-23T00:00:00
[node_data_field_recurring_2_field_recurring_2_rrule] => RRULE:FREQ=DAILY;INTERVAL=1;BYDAY=MO,FR;UNTIL=20110722T235959Z;WKST=SU
[node_data_field_recurring_2_delta] => 2
)
As you can see, it only returns the Repeat rule, so i'm thinking the Calendar module must do the calculations after. But where?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会采取完全不同的方法。创建一个节点引用,该引用在事件之间创建父子关系。然后在您的视图中仅排除具有父节点的事件。
您必须修改事件模板才能显示子事件。
从数据输入的角度来看,这将需要每个事件更多的工作,除非完成一些其他定制以提高输入效率。没有使用过这个,但它似乎可以加快多个节点的创建速度,http://drupal.org/project/编辑视图
I'd take a different approach entirely. Create a node reference which creates a parent to child relationship between events. Then in your View just exclude events that have parent nodes.
You'd have to modify your event template to display the child events.
From a data entry standpoint this would take more work per event unless some other customization to make it efficient to input was done. Haven't used this but it seems like it could speed up multiple node creations, http://drupal.org/project/editview