开发者

Create a recurring event on FullCalendar plugin

I'm using FullCalendar but I need create a recurring event, that happen forever(e.g. an event that happens weekly), there is some feature for this?开发者_开发问答 If it not have, how can I implement it?


If two or more events in fullcalendar have the same id they're treated as one just as the example "Repeating event" in http://arshaw.com/fullcalendar/ so, you can send the plugin something like this from PHP

echo json_encode(array(
        array(
            'id' => 1,
            'title' => 'test',
            'start' => strtotime('now')
        ),
        array(
            'id' => 1,
            'title' => 'test',
            'start' => strtotime('+1 weeks')
        ),
        array(
            'id' => 1,
            'title' => 'test',
            'start' => strtotime('+2 weeks')
        ),
        array(
            'id' => 1,
            'title' => 'test',
            'start' => strtotime('+3 weeks')
        )
    ));

You can use a javascript helper to transform the array into json if you're using some sort of phpframework such as CakePHP.

In case you are not using some server side processing you can code the events by yourself directly form javascript. Json events should look like this:

[{"id":1,"title":"test","start":1324426610},{"id":1,"title":"test","start":1325031410},{"id":1,"title":"test","start":1325636210},{"id":1,"title":"test","start":1326241010}]

Note: start and end dates format can be other such as "2011-12-20 12:20:23" (string in this case) or something like that (Unix timestamps are used in my example).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜