Google API

Is it possible to get the data from my Google Calendar (using an API) and display that data together with my events that I already have in dhtmlxScheduler?

Many thanks.

As far as I know - google calendar provides public ical data feed.
You can load it directly in the scheduler ( you will need some kind of server proxy script, to resolve cross domain issue )

with regards to cross domain issue, do you mean synchronsiation?

Do you have a simple statement to load these ical items?

Many thanks.

scheduler.load(“proxy.php?url=some.ical”,“ical”);

where proxy.php reads data from google calendar ical feed and outputs it as plain text ( simple proxy )

, do you mean synchronsiation?
Nope, just loading.
If you want to have a two-way sync with google calendar - it will require a lot more of coding.

ok, thanks. A proxy works great. Now, how can I colour my google calendar events different from the rest of my other events and make the google events read only (so I don’t worry about synchronisation!) :slight_smile:

Many thanks.

You can use onClick event and event_class template to do above task. The only question how distinguish between native and gCal events.
While loading from iCal all details of event is converted to the properties - you can check javascript object of such events - I’m quite sure it will have some property which is not exist for normal events.

Thanks Stanislav. Yes, you can check if the word “google” is contained in the event id. If it is, then it is from you google calendar!

The event_id is as follows: erdfgtvuh34ni23jrt80jr23wf@google.com

How do I apply a style to only these events (without looping through them all)?

:slight_smile:

default styling through template
docs.dhtmlx.com/doku.php?id=dhtm … appearance

[code].dhx_cal_event.google div{
background-color:purple !important;
color:white !important;
}

scheduler.templates.event_class=function(start,end,event){
if (event.id.toString().indexOf(“google”)!=-1) //if id contains ‘google’
return “google”;
return “”;
}[/code]

Pure genius, thank you so much Stanislav!

hi, i’d like to do the same, but with wordpress. can you explain to me how i’d do that?

Hello,

Unfortunately for now that’s not possible.

Best regards,
Ilya