2012-02-05 3 views
1

Google 캘린더 API (v2.6)에 대한 간단한 PHP 클래스를 찾았습니다.PHP Google 캘린더 API v2.6 - updateEvent() function

https://github.com/montania/Google-Calendar-API-PHP-Class

그리고 기능에게이 updateEvent ($ 핸들, $ 아이디, $의 ETAG, $의 JSON) {...}

/** 
* Method to update an event in the calendar. 
    If $etag is submitted it won't update your event if it has been updated since 
    you last retreived it 
* @param string $handle E-mail or handle to identify the calendar 
* @param string $id  The id of the event 
* @param string $etag  The e-tag of the event (optional) 
* @param string $json  The complete json code from the event that you've 
          retrieved with the changes that you want 
* @return bool|object  Returns false on failure and object on success 
*/ 

나는 $의 JSON에 투입해야합니까 매개 변수? 누군가 코드 예제를 제공 할 수 있습니까?

감사합니다.

답변

3

$ json 매개 변수에는 달력 이벤트를 검색 할 때 얻은 응답의 JSON 형식의 편집 된 이벤트가 포함되어야합니다.

이것은 당신이 이벤트

  1. 를 업데이트 할 수하기 위해 수행해야하는 단계입니다 getEvents() 또는 getEvent() 메소드를 사용하여 달력에서 현재 이벤트를 가져옵니다.
  2. 업데이트는 이벤트에
  3. 인코딩 JSON 형식의 개체로 json_encode()를 사용하여 작업을 수행 할 변경 사항을 반영하고 updateEvent에 다시 전달하는 반환 된 객체의 속성() 메소드

구글 Calendar API 설명서에도 다음과 같은 내용이 설명되어 있습니다. http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html#UpdatingEvents

+0

3 단계와 JSON의 내용을 이해하지만 변경 사항을 작성하고 JSON으로 인코딩하는 방법을 모르겠습니다. Simplyfied ... $ json = json_encode ($ string) 이전에 코드의 예를 들어주세요. 예 : 업데이트 이름과 이벤트 장소를 원합니다. –