This article refers to Google Calendar API v2, which isn't used any more. The details on actual version of Google Calendar API v3, are given here.
First of all, to start sync, check whether the extension php_curl.dll is enabled.
If it's not, activate it by removing a semicolon from the following line in the php.ini file, used by your web server:
;extension=php_curl.dll
Once you are sure that the needed extension is enabled, you can move to setup.
To sync Scheduler with Google Calendar, do the following:
Server-side:
<?php
$email = "";
$pass = "";
$cal = "";
include('google_proxy.php');
$calendar = new GoogleCalendarProxy($email, $pass, $cal);
//$calendar->map("location", "details");
$calendar->connect();
?>
Make sure that you wrote the correct values. For example, if the name of your calendar is test@googlemail.com, the value test@gmail.com results in error.
Client-side:
scheduler.load("../gCal_proxy/server/01_proxy.php");
Initialize dataProcessor, to provide 2-way sync.
Include one more file.
<script src="../gCal_proxy/sample/codebase/dhtmlxdataprocessor.js"></script>
var dp = scheduler.createDataProcessor("../gCal_proxy/server/01_proxy.php");
dp.init(scheduler);//'scheduler' is the name of the scheduler instance.
The sync is finished. You can find the ready-to-use example 'sample.html' at [rootFolder] gCal_proxy sample.
To export events from Google Calendar to your database, just follow these steps:
The function 'export()' returns a number of records that have been exported from Google Calendar
To import events from your database to Google calendar, just follow these steps:
The function 'import()' returns a number of records that have been imported to Google Calendar
Google Calendar has one set of fields and Scheduler has the other. So, to sync (import or export) the event information correctly, you should set mapping between the related fields of the calendars.
By default, there is the following mapping between Google Calendar and Scheduler:
Google Calendar -> Scheduler
Additionally, you can pass information of the following Google Calendar fields:
Field | Description |
canEdit | defines whether the logged-in user can edit the current event. Possible values: '0' or '1' |
created | the event's creation date in gcal format |
details | the event's details |
updated | the last update date of the event in gcal format |
location | the location, where the event takes place |
status | shows the current status of the event: cancelled (the event is canceled), confirmed (the event is confirmed), tentative (the event is tentatively scheduled) |
To pass some additional info, follow the steps below:
Server-side:
$calendar->map("location", "place");
place - the name of the related Scheduler field. You can write any name here.
Save changes and close the file.
Client-side:
The lightbox section:
scheduler.config.lightbox.sections=[
...
{name:"placeField", height:50, map_to:"place", type:"textarea"}
];
where the map_to parameter must be set to the value, specified on server-side (see above).
scheduler.locale.labels.section_placeField = 'Place';
where after the underscore you should specify the name of the related section.