My calendar listing of the current month's events seem to be
displaying
incorrectly. I have tried different sort order settings,
but nothing seems
to work. Any thoughts?
Site: http://cdv2.corywiles
.com/news/
<code>
/**
* Because the calls to Calendar are so slow we are
going to setup some
class
* level caching to speed things up. I might move this
snippet to the
base.php
*/
try {
$frontendOptions = array(
'cached_entity' => new Zend_Gdata_Calendar(),
// An instance of
the class
'cache_by_default' => true,
'lifetime' =>
$globalConfig->calendar->ttl
);
$backendOptions = array('cache_dir' =>
$globalConfig->cache->directory);
$cache =
Zend_Cache::factory($globalConfig->caching->frontEndMe
chanism,
$globalConfig->caching->backendMechanism,
$frontendOptions,
$backendOptions);
$cache->setTagsArray(array('calendarInstance'));
} catch (Zend_Cache_Exception $ex) {
$logger->crit($ex->getMessage());
print $ex->__toString();
} catch (Exception $ex) {
$logger->crit($ex->__toString());
print $ex->__toString();
}
$dateObj = new Zend_Date();
$startDate = $dateObj->get(Zend_Date::W3C);
$endDate =
$dateObj->get(Zend_Date::YEAR)."-".$dateObj->
;get(Zend_Date::MONTH)."-".$dateObj->get(Zend_D
ate::MONTH_DAYS);
//$cache = new Zend_Gdata_Calendar();
$query = $cache->newEventQuery();
$query->setUser($globalConfig->gmail->account);
$query->setVisibility('public');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setSortorder('descending');
$query->setStartMin($startDate);
$query->setStartMax($endDate);
$query->setFutureevents(false);
// Retrieve the event list from the calendar
server
try {
$eventFeed =
$cache->getCalendarEventFeed($query);
} catch (Zend_Gdata_App_Exception $e) {
print $e->getResponse()->getBody();
$logger->err($e->__toString());
$cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,
array('calendarInstance'));
}
?>
<ul>
<?php
foreach ($eventFeed as $event):
$logger->info($event->title);
foreach ($event->getWhen() as $when):
$finalDate = new
Zend_Date($when->startTime,Zend_Date::ISO_8601);
?>
<h4><?=$finalDate?></h4>
<li> #
content?>"><?=$event->title?>
</li>
<?php
endforeach;
?>
<?php
endforeach;
?>
<li> /schedule/ View entire schedule
</li>
</ul>
</code>
--
View this message in context: ht
tp://www.nabble.com/Google-Calendar---Sort-Order-doesn%27t-s
eem-to-be-working-tp15836253s16154p15836253.html
Sent from the Zend gdata mailing list archive at
Nabble.com.
|