php - Google Calendar Gdata 旧的重复事件已删除事件仍然显示,事件 ID 以 Z 结尾

标签 php zend-framework gdata recurring-events event-id

我曾尝试用谷歌搜索这个问题,但没有成功,可能是因为搜索字符串“Z”不够具体。

背景:
使用 Google Calendar Zend gdata 库,并一直使用简单的代码来列出特定时间段的事件。在这种情况下,27-02-2012 到 03-03-2012。 我列出了许多单一事件,其中有一个重复发生的事件,名为“Rob”,每周一至周五。
我使用的是基本代码,没有任何花哨的添加。还:)

问题:
当我使用 $query->setSingleEvents(TRUE) 参数时,一切都按预期工作,并显示了正确的事件。

当我谈论“显示”事件时,我指的是使用 Zend gdata 显示日历事件的 PHP 页面。
在所有情况下,Google 日历 GUI 都显示正确的数据(即“Rob”事件未显示,因为它已被删除。

但是当我将其设置为 FALSE 时,重复事件“Rob”应该具有要分组的开始时间,但相反,显示了一些没有 starttime,就是同一个标题。即使我删除了重复发生的事件,它仍然显示在 gdata 返回的数据中。

有趣的观察
已删除但仍显示在页面上的事件的 EventID 以“Z”结尾。 它具有通常的 eventID,后跟:_20120302T030000Z

我的问题
此事件已在 Google 日历 GUI 中删除。为什么gdata仍然显示删除的事件,以时间戳和Z结尾的eventid是什么意思。

解决尝试:
1. 尝试将其从循环事件更改为普通事件(删除“系列中所有事件”的循环
运气不好,仍然列出了额外的。
2. 完全删除了系列中所有事件的重复事件。
这再次显示了 SingleEvents(TRUE) 中的正确结果,但在 FALSE 中,旧的“Rob”事件仍然显示,但已从日历中完全删除。

代码:

function outputCalendarByDateRange($client, $startDate='2012-02-27',
                                   $endDate='2012-03-03')
{
  $gdataCal = new Zend_Gdata_Calendar($client);
  $query = $gdataCal->newEventQuery();
  $query->setUser('default');
  $query->setVisibility('private');
  $query->setProjection('full');
  $query->setOrderby('starttime');
  $query->setStartMin($startDate);
  $query->setStartMax($endDate);
  $query->setSingleEvents(FALSE);
  $eventFeed = $gdataCal->getCalendarEventFeed($query);

  foreach ($eventFeed as $event) {
    echo "Title: " . $event->title->text . "<br />";
    echo "Event ID: " . $event->id->text . "<br />";
    foreach ($event->when as $when) {
      echo "Start: " . $when->startTime . "<br />";
    }
    echo "<br />";
  }
}

最佳答案

这是我在 docs 中找到的内容:

36.5.6. Deleting Events Calendar events can be deleted either by calling the calendar service's delete() method and providing the edit URL of an event or by calling an existing event's own delete() method.

In either case, the deleted event will still show up on a user's private event feed if an updateMin query parameter is provided. Deleted events can be distinguished from regular events because they will have their eventStatus property set to "http://schemas.google.com/g/2005#event.canceled".

看起来您必须在解析提要时测试事件状态。

顺便说一句,时间戳分解为

year:2012 day:03 month:02 time:T hours:minutes:seconds 03:00:00 zulu:Z

Zulu 与 GMT(格林威治标准时间)或 UTC(世界时码)相同

关于php - Google Calendar Gdata 旧的重复事件已删除事件仍然显示,事件 ID 以 Z 结尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9411893/

相关文章:

zend-framework - 在批量邮件脚本中发送数千封电子邮件时出现 Sendmail 异常。 sendmail 是否有给定进程的电子邮件发送限制?

php - 面试作业

iphone - 有没有使用 GData API 将视频上传到 youtube iOS 应用程序的教程?

.net - GData OAuthUtil.GetAccessToken不返回refresh_token值

api - gdata API不返回任何结果

php - SELECT * FROM table WHERE date BETWEEN 显示去年的数据,为什么?

php - 我应该为 User 类的唯一实例使用哪种模式?

php - 将图像链接到右侧页面

php - 从 2 个带有 2 个外键的表中选择

zend-framework - Zend Mail - 在哪里实例化它?