防止通过 Zend 显示单独删除的重复 Google 日历条目?

发布于 2024-12-10 02:17:39 字数 1325 浏览 1 评论 0原文

我正在使用规划器创建一个网站,并希望将其与 Google 日历同步。到目前为止,它使用 Zend 框架的 GData 类运行得很好。我遇到了一个问题,即每周都会出现重复事件,即使它们被单独删除。 我已经尝试过:

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

但现在很多活动都没有在我的计划的前几周出现,并且在某些几周我只是错过了一些活动。 这是我的脚本的基本结构:

require_once '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('[email protected]');    
$query->setVisibility('public');
$query->setProjection('full');
$query->setStartMin(date('Y-m-d', strtotime(week_start_date("Y-m-d H:i:s"))));
$query->setStartMax(date('Y-m-d', strtotime(week_start_date("Y-m-d H:i:s")) +
    (60*60*24*7*10)));
$query->setOrderby('starttime');
$query->setParam('singleevents','true');

try { 
    $eventFeed = $service->getCalendarEventFeed($query); 
}

catch (Zend_Gdata_App_Exception $e) { 
    return; 
}

foreach ($eventFeed as $event) {        
    foreach ($event->when as $when) {
         // transform data
    }
}

我该怎么做才能让我的计划者获得与我的 Google 日历完全相同的数据?

I'm creating a website with a planner and want to synchronize it with a Google Calendar. So far it works pretty well using the GData Class of the Zend framework. I'm running into a problem where recurring events appear every week, even if they are individually deleted.
I have tried:

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

But now a lot of events don't show up at the first weeks of my planner and at some weeks I simply miss a few events.
This is the basic structure of my script:

require_once '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('[email protected]');    
$query->setVisibility('public');
$query->setProjection('full');
$query->setStartMin(date('Y-m-d', strtotime(week_start_date("Y-m-d H:i:s"))));
$query->setStartMax(date('Y-m-d', strtotime(week_start_date("Y-m-d H:i:s")) +
    (60*60*24*7*10)));
$query->setOrderby('starttime');
$query->setParam('singleevents','true');

try { 
    $eventFeed = $service->getCalendarEventFeed($query); 
}

catch (Zend_Gdata_App_Exception $e) { 
    return; 
}

foreach ($eventFeed as $event) {        
    foreach ($event->when as $when) {
         // transform data
    }
}

What can I do to make my planner get the exact same data as my Google Calendar?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尛丟丟 2024-12-17 02:17:39

我找到了解决方案。我猜想 zend 框架使用 XML feed 中的 resultsPerPage 值。由于事件是按相反的时间顺序检索的,并且在 10 周的日期范围内有 55 个条目,因此前几周保持空白。我决定采用简单的解决方案,并将日期范围缩短至 5 周。现在可以完美运行了!

I found the solution. I guess the zend framework uses the resultsPerPage value in the XML feed. Since events are retrieved in reversed chronological order, and there where 55 entry's in my date range of 10 weeks, the first weeks stayed empty. I decided to go for the easy solution and reduced my date range to 5 weeks. Now it works perfectly!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文