I Brian,

Use Javascript instead, that's the what i'm doing it ; create the function
as above :
/**
 * Cette fonction affiche les évènements Google Calendar
 * sous la forme d'une liste séparés par des lignes horizontales.
 * @param root
 * @return
 */
function listEventsTable(root) {
    var eventDiv = document.getElementById(eventsDivName);
    if (eventDiv.childNodes.length > 0) {
        eventDiv.removeChild(eventDiv.childNodes[0]);
    }

    // Obtain the array of matched CalendarEventEntry
    var eventEntries = root.feed.getEntries();
    var HTMLContent = "";
    // If there is matches for the date query
    if (eventEntries.length > 0) {
        for ( var i = 0; i < eventEntries.length; i++) {
            var event = eventEntries[i];

            //On reccupère ensuite les dates de l'évènement
            var dates = '';
            var eventTimes = event.getTimes();
            for ( var j = 0; j < eventTimes.length; j++) {
                var eventDate = eventTimes[j];
                var dateDebut = eventDate.getStartTime().getDate();
                var dateFin = eventDate.getEndTime().getDate();

                var dateDebutString = dateDebut.dateFormat(dateFormat, 'fr'
);
                var dateFinString = dateFin.dateFormat(dateFormat, 'fr');
                var heureDebutString = dateDebut.dateFormat(heureFormat,
'fr');
                var heureFinString = dateFin.dateFormat(heureFormat, 'fr');
                var heureNulle = '00:00:00';

                //Si on n'a pas d'information sur les horaires
                if (heureNulle == heureDebutString
                        && heureNulle == heureFinString) {
                    dates = dates + 'Du ' + dateDebutString + ' au '
                            + dateFinString + ' ';
                }
                //Sinon on précise les heures
                else {
                    dates = dates + 'Du ' + dateDebutString + ' de '
                            + heureDebutString + ' au ' + dateFinString + '
à '
                            + heureFinString + ' ';
                }
            }

            //Mise en forme de l'évènement à afficher
            var eventLink = '';
            if (showsLinks) {
                eventLink = '<a href=' + event.getHtmlLink().getHref() + '>'
                        + event.getTitle().getText() + '</a>';
            } else {
                eventLink = '<div class="events">' +
event.getTitle().getText() + '</div>';
            }

            // Ajout de l'évènement au contenu HTML de l'element JAVASCRIPT
            HTMLContent = HTMLContent + " " + dates + '<br />' + eventLink
                    + '<hr width=\'80%\'>';
        }
        //Puis on affecte le contenu ainsi crée à l'element HTML 'events' du
document
        document.getElementById('events').innerHTML = HTMLContent;
    } else {
        // No match is found for the date query
        PRINT('no events are matched from the query!');
    }

this function is the *callback *passed as argument to the method of the
Service Google :
service.getEventsFeed(query, *listEventsTable*, handleGDError);

Just keep in mind you'll have to create the function PRINT() and the
function handleGDError(e) (*functions advised by the Google API test page*).

All events appear in a div section whose id='events' !!!!

finally to load my calendar, i use the above function that does the call to
the function and the Google sevice as well :
function loadCalendar(calendarUrl, formatJours, formatHeures,
        nombreEvenementsMax, maxMonthPeriod, showLinks) {
    //On spécifie le format des dates si il est non null
    if (formatJours != null) {
        //On écrase le format par défaut
        dateFormat = formatJours;
    }
    //Si le format des heures en paramètre est non null alors on ecrase
celui par défaut
    if (formatHeures != null) {
        //On écrase le format par défaut
        heureFormat = formatHeures;
    }
    showsLinks = showLinks;

    var service = new google.gdata.calendar.CalendarService(
            'gdata-js-client-samples-simple');
    var query = new google.gdata.calendar.CalendarEventQuery(calendarUrl);
    query.setOrderBy('starttime');
    query.setSortOrder('ascending');
    query.setFutureEvents(true);
    query.setSingleEvents(true);
    query.setMaxResults(nombreEvenementsMax);
    //On regarde pour les evènements 3 mois à l'avance
    var startDate = new Date();
    var startMin = new google.gdata.DateTime().setDate(startDate);
    var startMax = new google.gdata.DateTime().setDate(new Date()
            .setMonth(startDate.getMonth() + maxMonthPeriod));
    query.setMinimumStartTime(startMin);
    query.setMaximumStartTime(startMax);

    service.getEventsFeed(query, listEventsTable, handleGDError);
}

then the principal call is done to the following functions :
/**
 * Méthode simple permettant de gerer l'affichage du calendrier à partir de
l'adresse.
 *
 * @param calendarAddress
 * @return
 */
function loadCalendarByAddress(calendarAddress) {
    var calendarUrl = 'http://www.google.com/calendar/feeds/' +
calendarAddress + '/public/full';
    loadCalendar(calendarUrl);
}

/**
 * Fonction simplifiée d'appel à l'affichage du Google Calendar courant.
 *
 * @param calendarUrl
 * @return
 */
function loadCalendar(calendarUrl) {
    loadCalendar(calendarUrl, 'd/m/Y', 'H:i:s', 10, 3);
}

just call in your PHP the function
loadCalendarByAddress(calendarAddress)with your Goolge account adress
(*do not forget to reference the .js where you'll write down those functions
AND a .js file with the DateFormat class I used ,see the code at
http://blog.stevenlevithan.com/archives/date-time-format for more info*)
Also do a call to the JSAPI and google.load('gdata',1); functions (i've got
an issue on IE7 with the call to the JSAPI)

cheers

Vincent

2008/11/16 BNOP <[EMAIL PROTECTED]>

>
> Things have gone very smoothly showing events and adding event to
> Google Calendar using PHP.  The one area where I have hit my head
> against the wall for a couple days is listing events and their start
> and end times.  Can anyone help with this?  Thanks.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" group.
To post to this group, send email to 
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to