Calendar Class in Zend Framework

Calendar Class in Zend Framework

In our previous tutorial of Zend Framework we had covered views in Zend Framework, today in this tutorial we will learn to use a Calendar Class in Zend Framework

Zend framework has an interface to access Google Data. This is one of the easiest ways to access Google data API using PHP.
To use Google calendar we first have to authenticate on Google calendar, list all the calendars and create a new calendar.
Zend_Gdata_Calendar is the service class for interacting with the Google Calendar data API.
The packages needed in the use of Calendar are Zend/Gdata.php and Zend/Loader.php.

  • Authentication process:
    • The Google calendar API allows access to both public and private calendar feeds.
    • Public feeds do not require authentication, but are read-only and provide reduced functionality.
    • Private feeds provide complete functionality, but require an authenticated connection to the calendar server.
    • There are 3 authentication schemas supported by Google calendar:
      1. ClientAuth: It provides direct username/password authentication to the calendar servers. This type is only recommended, when other authentication schemas are insufficient.
      2. AuthSub: It allows authentication to the calendar servers via a Google proxy server.
      3. MagicCookie: It allows authentication based on a semi-random URL available from within the Google Calendar interface. This is the simplest authentication scheme to implement, but requires that the users manually retrieve their secure URL before they can authenticate.
    • An example code for authentication is given below, which uses the ClientAuth schema for authentication.
    • After authentication we are now get an access to Google Calendar.
    • Now we can verify a calendar we want to use from the Calendar list or else create a new calendar.
    • The sample code is given below:

In this way we learned how to use a calendar and work with it this Calendar Class in Zend Framework tutorial.


Please enter your comment!
Please enter your name here