开发者

How to change order of google calendar events fetched via Zend_Gdata_Query?

When using the Zend_Gdata_Query library to fetch google calendar events using the example below my results are in th开发者_Python百科e opposite order that I need. Is there a simple variation on the

$query->setOrderby('starttime');

method that will achieve a list with the closest to now date at top and furthest in the future at the bottom?

Code below taken from http://framework.zend.com/manual/en/zend.gdata.calendar.html

$query = $service->newEventQuery();
$query->setUser('default');
// Set to $query->setVisibility('private-magicCookieValue') if using
// MagicCookie auth
$query->setVisibility('private');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setFutureevents('true');

Any help will be greatly appreciated.


You just have to set descending order instead of ascending.

$query->setSortOrder('d');

Valid values are ascending (with synonyms ascend and a) and descending (with synonyms descend and d).

As seen in the gData API reference.


$query->setSortOrder('a');

This will sort by current date to future date. a stands for ascending.

if this does not do the trick, try:

$query->setOrderby('starttime');
$query->setSortOrder('a'); //ascending
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜