日历事件列表显示已删除的事件我怎么能隐藏它们?

时间:2012-02-17 13:18:40

标签: php zend-framework list events hidden

在我的主页上,我显示了在我的Google日历中创建的事件列表。 见:my homepage-> eventlist

现在我已从日历中删除了活动。这些在常规Google日历中不再可见,但现在它们已出现在我的活动列表中。

这是我的活动列表的脚本:

<a href="http://www.takenosono.de/termine.phtml">
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_Calendar');

$service = new Zend_Gdata_Calendar();

$query = $service->newEventQuery();
$query->setUser('mymagiccookie%40group.calendar.google.com');
$query->setVisibility('public');
$query->setProjection('full');
$query->setStartMin(date('Y-n-j'));
$query->setStartMax(date('Y-n-j', time() + (60*60 *24*60)));
$query->setOrderby ('starttime');
$query->setSortOrder('a');
//$query->setFutureevents(true);
$eventFeed = $service->getCalendarEventFeed($query);
echo "<h3>Besondere Termine:</h3><h6>";
setlocale(LC_TIME, 'deu', 'de_DE.UTF-8');

foreach ($eventFeed as $event) {
echo "" . $event->title->text .   "\n";
// Zend_Gdata_App_Extensions_Title->__toString() is defined, so the
// following will also work on PHP >= 5.2.0
//echo "\t<li>" . $event->title .  " (" . $event->id . ")\n";

foreach ($event->when as $when) {

$startTime = $when->startTime;
$endTime = $when->endTime;

echo "<br>" . strftime("%a %d. ", strtotime( $startTime )); 
if (strftime("%d.", strtotime( $endTime )) != strftime("%d.", strtotime( $startTime ))):
echo strftime("bis  %d. ", strtotime( $endTime ));
endif;

echo strftime("%b", strtotime( $endTime ));

if (strftime("%d.", strtotime( $endTime )) == strftime("%d.", strtotime( $startTime ))):
echo strftime(" - %H:%M", strtotime( $startTime ));
endif;
echo "<br><br><img src='picture/Trenner.gif'><br>";
 }

 }
 echo "mehr: hier klicken...";
 ?>
</a>

问题是:我可以做些什么,以便删除的事件不再显示在此列表中? 有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

只需使用如下事件状态:

foreach ($eventFeed as $event) {
    if ($event->getEventStatus() != 'http://schemas.google.com/g/2005#event.canceled')
    {
        //your foreach code
    }
}