使用Zend Google数据API将Google日历活动添加到与会者/访客值

时间:2012-01-23 19:43:10

标签: php zend-framework google-calendar-api

我正在尝试使用php在zend google data api上制作一个privet应用程序。我需要从脚本创建事件。我面临的问题是,我无法在活动的脚本中添加访客/与会者/参与者。实际上我找不到正确的参数。 我正在使用的功能:

function createEvent ($client, $title = 'Tennis with Beth',
    $desc='Meet for a quick lesson', $where = 'On the courts',
    $startDate = '2008-01-20', $startTime = '10:00',
    $endDate = '2008-01-20', $endTime = '11:00', $tzOffset = '-08')
{
$gdataCal = new Zend_Gdata_Calendar($client);
$newEvent = $gdataCal->newEventEntry();

$newEvent->title = $gdataCal->newTitle($title);
$newEvent->where = array($gdataCal->newWhere($where));
$newEvent->content = $gdataCal->newContent("$desc");

$when = $gdataCal->newWhen();
$when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
$when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
$newEvent->when = array($when);

// Upload the event to the calendar server
// A copy of the event as it is recorded on the server is returned
$createdEvent = $gdataCal->insertEvent($newEvent);
return $createdEvent->id->text;
}

我尝试通过$ newEvent->来宾,$ newEvent->与会者,$ newEvent->参与者添加它。 有人知道吗? 如果您还可以告诉我如何选择带有ID的日历而不是主日历,那将会很有帮助。提前谢谢。

1 个答案:

答案 0 :(得分:1)

您可以使用以下代码进行设置: -

 $who = $gcal->newwho();
$who->setEmail('myEm...@myDomain.com');
$event->setWho(array($who));