패키지 다운로드 here.
이 장에서는 Scheduler와 Google Calendar를 동기화하는 방법을 설명합니다.
동기화는 양방향으로 작동하므로, Scheduler나 Google Calendar에서 이루어진 모든 업데이트는 두 곳 모두에 반영됩니다.
통합을 설정하려면 다음 단계를 따르세요:
서버 측:
<?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();
?>
여기서
클라이언트 측:
1. Scheduler가 초기화된 HTML 파일을 열거나, 일반적인 방법으로 설정하세요 (How to Start 문서를 참고).
2. load 메서드를 사용하여 Google Calendar 이벤트를 scheduler에 불러옵니다. 첫 번째 파라미터는 'data.php' 파일의 경로이고, 두 번째는 데이터 포맷으로 'json'을 지정해야 합니다.
scheduler.load("./data.php", "json");
3. dataProcessor를 초기화하여 양방향 동기화를 활성화하세요 (읽기 전용 접근만 필요하다면 이 부분은 건너뛰세요).
var dp = scheduler.createDataProcessor("./data.php");
dp.init(scheduler);
dp.setTransactionMode("POST", false);
기본적으로 Scheduler는 Google Calendar의 모든 필드를 읽지만, 네 가지 필드만 적극적으로 처리합니다. 나머지 필드는 읽기 전용으로 간주됩니다.
Google Calendar와 Scheduler 필드 간의 매핑은 다음과 같습니다:
Google Calendar -> Scheduler
추가 속성을 처리하려면 패키지에 포함된 "src/google_proxy.php" 파일을 수정할 수 있습니다
(download link).