我如何在Zend Framework Google Calendar API中更新活动日期?

时间:2013-01-24 07:57:24

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

在Zend Framework手册中,Google Calendar Api我找不到更新日期说明。

在文档中我们有:

// Get the first event in the user's event list
$event = $eventFeed[0];

// Change the title to a new value
$event->title = $service->newTitle("Woof!");

// Upload the changes to the server
try {
    $event->save();
} catch (Zend_Gdata_App_Exception $e) {
    echo "Error: " . $e->getMessage();
}

但我如何更新任何事件的startDate和endDate?..

2 个答案:

答案 0 :(得分:1)

在Zend Framework(1.2)Google Calendar API中更新活动日期工作正常

                $user = "xxxx@gmail.com";
                $pass = "12345@mapring";

                $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
                $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
                $service = new Zend_Gdata_Calendar($client);

                $query = $service->newEventQuery();
                $query->setUser('default');


                /*to update your event*/
                $urlid = "https://www.google.com/calendar/feeds/default/private/full/tbc633h37hgv4s4u0ivl3eigak/63509906072";
                $event = $service->getCalendarEventEntry($urlid);
                // Change the title
                $event->title = $service->newTitle("New Title!");
                $event->save();

答案 1 :(得分:0)

我从参考指南中采用了这个例子。

ZF Reference Guide

$start = new Zend_Date();
$end = new Zend_Date();
$end->addHour(2);

$when = $event->newWhen();

$when->startTime = $start->toString(Zend_Date::RFC_3339);
$when->endTime = $end->toString(Zend_Date::RFC_3339);

$event->when = array($when);