Deprecated: This repository contains a legacy PHP helper for Google Calendar authentication and is no longer maintained. For the current integration example, please use the new repository: DHTMLX/scheduler-google-calendar-demo.
This class can be used to load a data from the Google Calendar to the dhtmlxScheduler, or to save changes from the dhtmlxScheduler back to the Google Calendar.
- login to google API console - https://code.google.com/apis/console
- press "Create new project"
- enable Calendar API on "Services" screen
- go to API Access screen and click on "Create an OAuth2.0 Client ID", enter your name, upload a logo, and click Next, select the Service account option and press Create client ID. As result you will have private key file, Client ID and Email address - they will be necessary later
- login to the google calendar, which you want to use for the app, and share it on "Email address", which was generated on previous step
- locate and save the calendar id
Location of calendar id - https://drupal.org/node/589310
Create a php file data.php with code like
<?php
include('../src/google_proxy.php');
$calendar = new GoogleCalendarProxy(
"<account>@developer.gserviceaccount.com",
"<account>.apps.googleusercontent.com",
file_get_contents("<key>"),
"<calendar id>"
);
$calendar->connect();
?>- - take from Google Console API
- - path to private key from Google Console API
- - can be taken from the settings of the related Google Calendar
On client side you can init scheduler in any legal way, with any configuration. After scheduler's initialization, place the next lines
//load data from google calendar
scheduler.load("./data.php", "json");
//save changes back to google calendar
var dp = new dataProcessor("./data.php");
dp.init(scheduler);
dp.setTransactionMode("POST", false);If you need readonly access - just ignore the second part of above code.
If you have some problems with data loading, try to open the data.php directly in the browser - it will show details of authorization error.
Distributed under the MIT software license
Copyright (c) 2013 Dinamenta UAB