集成 google 日历与全日历
integration google calendar with fullcalendar
我正在开发一个 symfony3 项目以将 googleCalendar 与 fullcaldendar 集成。我想使用 googlecalendar 来提供完整日历以显示我在 googlecalendar 中的所有事件,然后每次我在 fullcalendar 中更改事件时,它也会在google日历。所以步骤是从 googleCalendar 中获取 google 事件,我已经完成了,我试图以 json 的格式制作它:
$我的json文件:
[{
"title": "Rdv Ecole",
"start": "2017-11-13T10:00:00+01:00",
"end": "2017-11-13T12:00:00+01:00"
}, {
"title": "testing functions",
"start": "2017-11-20T13:15:00+01:00",
"end": "2017-11-20T14:15:00+01:00"
}, {
"title": "another test",
"start": "2017-11-20T17:30:00+01:00",
"end": "2017-11-20T18:30:00+01:00"
}, {
"title": "reuinion data vc",
"start": "2017-11-21T09:00:00+01:00",
"end": "2017-11-21T10:00:00+01:00"
}]
因为我用的是symfony3,所以我做了一个
return $this->render('calendar/loadcalendar.html.twig',['gevents'=>$myjsonfile]);
然后在我的页面显示事件:
$(document).ready(function() {
$('#calendar').fullCalendar({
defaultView: 'agendaWeek',
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
navLinks: true, // can click day/week names to navigate views
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
}
$('#calendar').fullCalendar('unselect');
},
eventLimit: true, // allow "more" link when too many events
eventSources: [
{
url: "http://localhost/prog/web/app_dev.php/calendar/load",
dataType: "json",
method: 'GET'
}
],
eventClick: function(event) {
var title = prompt('Change Event title:');
event.title = title;
$('#calendar').fullCalendar('updateEvent', event);
}
});
现在的问题是我无法从我发送的 json 加载事件,所以有人可以给我一些建议吗?谢谢
在我的项目中,我是这样做的:
$('#calendar').fullCalendar({
/* [...] */
events: "{{ path('ajax_calendar_load') }}",
/* [...] */
还有我的加载动作return常规json:
$response = new JsonResponse();
$response->setContent($events);
return $response;
我正在开发一个 symfony3 项目以将 googleCalendar 与 fullcaldendar 集成。我想使用 googlecalendar 来提供完整日历以显示我在 googlecalendar 中的所有事件,然后每次我在 fullcalendar 中更改事件时,它也会在google日历。所以步骤是从 googleCalendar 中获取 google 事件,我已经完成了,我试图以 json 的格式制作它:
$我的json文件:
[{
"title": "Rdv Ecole",
"start": "2017-11-13T10:00:00+01:00",
"end": "2017-11-13T12:00:00+01:00"
}, {
"title": "testing functions",
"start": "2017-11-20T13:15:00+01:00",
"end": "2017-11-20T14:15:00+01:00"
}, {
"title": "another test",
"start": "2017-11-20T17:30:00+01:00",
"end": "2017-11-20T18:30:00+01:00"
}, {
"title": "reuinion data vc",
"start": "2017-11-21T09:00:00+01:00",
"end": "2017-11-21T10:00:00+01:00"
}]
因为我用的是symfony3,所以我做了一个
return $this->render('calendar/loadcalendar.html.twig',['gevents'=>$myjsonfile]);
然后在我的页面显示事件:
$(document).ready(function() {
$('#calendar').fullCalendar({
defaultView: 'agendaWeek',
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
navLinks: true, // can click day/week names to navigate views
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
}
$('#calendar').fullCalendar('unselect');
},
eventLimit: true, // allow "more" link when too many events
eventSources: [
{
url: "http://localhost/prog/web/app_dev.php/calendar/load",
dataType: "json",
method: 'GET'
}
],
eventClick: function(event) {
var title = prompt('Change Event title:');
event.title = title;
$('#calendar').fullCalendar('updateEvent', event);
}
});
现在的问题是我无法从我发送的 json 加载事件,所以有人可以给我一些建议吗?谢谢
在我的项目中,我是这样做的:
$('#calendar').fullCalendar({
/* [...] */
events: "{{ path('ajax_calendar_load') }}",
/* [...] */
还有我的加载动作return常规json:
$response = new JsonResponse();
$response->setContent($events);
return $response;