【问题标题】:Google calendar - Showing recurring events like normal events谷歌日历 - 显示像正常事件一样的重复事件
【发布时间】:2009-08-17 14:01:37
【问题描述】:

我正在尝试显示来自 Google 日历帐户的未来 20 天活动的列表。没有显示令人发指的重复事件(我假设是因为它们的开始时间很旧)......所以。有什么想法吗?

require_once dirname(__FILE__).'/../../../Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_HttpClient');
Zend_Loader::loadClass('Zend_Gdata_Calendar');

$service = new Zend_Gdata_Calendar();

$query = $service->newEventQuery();
$query->setUser('REMOVED');
$query->setVisibility('public');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setSortOrder('ascending');
$query->setFutureevents('true');
$query->setMaxResults(20); 

try { $eventFeed = $service->getCalendarEventFeed($query); }
catch (Zend_Gdata_App_Exception $e) { return; }

我愿意接受任何可以让我的所有公共活动按升序排列的替代方法。我试过 RSS,但日期似乎是它们被添加到日历的时间。

【问题讨论】:

  • 第二。我还没有找到一个可以很好地做到这一点的日历提要(iCal、谷歌日历、xml)库。

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


【解决方案1】:

投影是我以前玩过的东西。它没有帮助(除非我想手动解析和分解重复事件)。但是that link 是金色的。

$query->setParam('singleevents','true');

来自他们的文档:

单项赛事

表示是否重复事件 应该扩展或表示为 单一事件。

有效值为真(展开 重复事件)或假(离开 重复事件表示为单个 事件)。默认为假。

在我看来,false 是一个愚蠢的默认设置,但是嘿嘿。它现在似乎可以工作了!

【讨论】:

    【解决方案2】:

    改变这个:

    $query->setProjection('full');
    

    到这里:

    $query->setProjection('composite');
    

    将为您提供各种额外数据,包括重复事件。这是根据 Google Calendar API 参考:http://code.google.com/apis/calendar/docs/2.0/reference.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-21
      • 1970-01-01
      • 2012-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多