代码之家  ›  专栏  ›  技术社区  ›  Tim Lytle

获取特定Google日历的Zend_GData提要

  •  5
  • Tim Lytle  · 技术社区  · 16 年前

    关于如何获取特定日历的事件提要,我有一个很长很详细的问题,但在我发布之前,我想出了(我认为)一个解决方案。然而,即使有了解决方案

    • 验证(显然)
    • 获取日历列表:getCalendarListFeed();
    • 从“日历”对象之一获取id属性
    • 收件人:…/calendar/feeds/XXX%40YYY/private/full
    • 将其传递给getCalendarEventFeed()以查询该日历。

    为什么我要操纵ID? Zend_Gdata的文档似乎分布在谷歌和Zend的网站上。我还没有从getCalendarListFeed()找到一个关于可用属性的好引用,所以也许我应该获取ID以外的其他内容?

    更直截了当地说,我在这里遗漏了什么?

    2 回复  |  直到 16 年前
        1
  •  3
  •   Trevor Johns    12 年前

    protocol guide ,有一个 <link rel="alternate" .../> 元素,该元素包含所需的URL。

    // $entry is an instance of Zend_Gdata_Calendar_ListEntry
    $link = $entry->getAlternateLink()->getHref();
    

    此外,您要查找的文档如下: http://framework.zend.com/apidoc/1.9/Zend_Gdata/Calendar/Zend_Gdata_Calendar_ListEntry.html

        2
  •  2
  •   bogeymin    15 年前

    $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
    $Client = Zend_Gdata_ClientLogin::getHttpClient('googleaccount','googlepass',$service);
    $Service = new Zend_Gdata_Calendar($Client);
    
    $Query = $Service->newEventQuery();
    $Query->setUser('calendarid'); # As you know, you can obtain this with getCalendarListFeed()
    $Query->setVisibility('public');
    $Query->setProjection('full');
    $Query->setOrderby('starttime');
    $Query->setFutureevents('true');
    

    一开始让我感到不舒服的是,通话的“用户”部分实际上是日历ID。然后你可以做如下操作:

    $events = $Service->getCalendarEventFeed($Query);
    foreach ($events as $Event)
    {
       // work with Event object here...
    }