2
我有一個工作腳本,它在我的Google日曆中創建事件 - 使用google-api-php-client。我想一個小工具添加到它用下面的代碼創建的每個事件:使用google-api-php-client創建帶有小工具的Google日曆事件
require_once "google-api-php-client/src/Google_Client.php";
require_once "google-api-php-client/src/contrib/Google_CalendarService.php";
define('CLIENT_ID', 'xxx...');
define('SERVICE_ACCOUNT_NAME', 'xxx...');
define('KEY_FILE', 'xxx...');
$client = new Google_Client();
$client->setApplicationName("WEB ACCTION");
$key = file_get_contents(KEY_FILE);
$client->setAssertionCredentials(new Google_AssertionCredentials(SERVICE_ACCOUNT_NAME,'xxx...',$key));
$client->setClientId(CLIENT_ID);
$service = new Google_CalendarService($client);
$event = new Google_Event();
$event->setSummary($variable1);
$event->setLocation($variable2 . ", " . $variable3);
$start = new Google_EventDateTime();
$start->setDateTime(date(DATE_ATOM, strtotime($variable4) + $time_offset));
$event->setStart($start);
$end = new Google_EventDateTime();
$end->setDateTime(date(DATE_ATOM, strtotime($variable5) + $time_offset));
$event->setEnd($end);
//The not working section
//$gadget = new Google_EventGadget();
//$gadget->setIconLink('xxx...');
//$gadget->setTitle('xxx...');
//$gadget->setHeight('xxx...');
//$gadget->setWidth('xxx...');
//$gadget->setLink('xxx...');
//$gadget->setType('xxx...');
//$gadget->setDisplay('xxx...');
//$event->setGadget($gadget);
$createdEvent = $service->events->insert($g_calendar , $event);
不幸的是 - 我不能讓它工作,我是不是能夠找到的有關創建與谷歌小工具的任何信息-API-PHP客戶端。該庫包括一個Google_EventGadget類和setGadget函數,但沒有信息如何使用它。任何人都可以幫我嗎?