Where does authentication and loader go in Zend Framework?
Posted
by Joel
on Stack Overflow
See other posts from Stack Overflow
or by Joel
Published on 2010-05-28T21:37:26Z
Indexed on
2010/05/28
21:42 UTC
Read the original article
Hit count: 178
Hi guys, Still trying to learn the basics of MVC.
I'm making use of Zend_Loader for Google Calendar feed. What file would this information go in? The .phtml view?
// load library
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
Zend_Loader::loadClass('Zend_Http_Client');
// create authenticated HTTP client for Calendar service
$gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$user = "xxxxxxxxxxxx";
$pass = "xxxxxxxxxxxx";
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $gcal);
$gcal = new Zend_Gdata_Calendar($client);
$query = $gcal->newEventQuery();
$query->setUser('xxxxxxxxxxxx');
$secondary=true;
$query->setVisibility('private');
$query->setProjection('basic');
$query->setOrderby('starttime');
$query->setSortOrder('ascending');
//$query->setFutureevents('true');
$startDate=date('Y-m-d h:i:s');
$endDate="2015-12-31";
$query->setStartMin($startDate);
$query->setStartMax($endDate);
$query->setMaxResults(30);
try {
$feed = $gcal->getCalendarEventFeed($query);
} catch (Zend_Gdata_App_Exception $e) {
echo "Error: " . $e->getResponse();
}
Thanks!
© Stack Overflow or respective owner