philippfrenzel / yii2fullcalendar

JQuery Fullcalendar Yii2 Extension
GNU General Public License v2.0
132 stars 95 forks source link

how to display google calendar events along with events from the database? #124

Closed cla-dev closed 6 years ago

cla-dev commented 6 years ago

Hi,

I am new to this plugin and need to display both google events and events from the database on the same calendar. I have it working with either google events or events from the database, but not both.

when I set the clientOptions to display the google events, then all the database events do not display.

please help!

thanks,

Rovin

philippfrenzel commented 6 years ago

Hi, guess you need to merge them on the server side?

cla-dev commented 6 years ago

Hi, thank you for the quick reply...

any idea how to create this array of events from google calendar?

i do not know where to start...

thanks,

Rovin

cla-dev commented 6 years ago

Hi again,

in the fullcalendar.io docs it mentions using eventSources to set multiple event sources, however I do not see that implemented in yii2fullcalendar?

please advise...

thanks,

Rovin

cla-dev commented 6 years ago

Hi Philip, I figured it out :)

here is the code for those looking to do the same:

<?= \yii2fullcalendar\yii2fullcalendar::widget(['header'=>['left'=>"today prev,next",'center'=> "title",'right'=>"basicWeek,month"], 'id'=>'dash-calendar', 'googleCalendar'=>true, 'clientOptions'=>[ 'googleCalendarApiKey'=>'', 'eventSources'=>[ $dbevents, //events array from database ['googleCalendarId'=>'en.sr#holiday@group.v.calendar.google.com', //events from the google calendar 'allDayDefault'=>true, 'color'=>'orange', ], ] ], 'defaultView'=>'month', ])?>

cla-dev commented 6 years ago

<?= \yii2fullcalendar\yii2fullcalendar::widget(['header'=>['left'=>"today prev,next",'center'=> "title",'right'=>"basicWeek,month"], 'id'=>'dash-calendar', 'googleCalendar'=>true, 'clientOptions'=>[ 'googleCalendarApiKey'=>'<YOUR API KEY>', 'eventSources'=>[ $dbevents, //events array from database ['googleCalendarId'=>'en.sr#holiday@group.v.calendar.google.com', //events from public google calendar 'allDayDefault'=>true, 'color'=>'orange', ], ] ], 'defaultView'=>'month', ])?>

cla-dev commented 6 years ago

happy coding folks!