I don't know the detailed ins and outs of the Zend library, but you don't
have an editLink on an event that you have created locally.
You need to capture the event that is returned from Google, so change this
line:
$gcal->insertEvent($event);
to something like:
$newEvent = $gcal->insertEvent($event);
then you can get the editLink from
echo $newEvent->getEditLink()->href;
Zend also supplies easier mechanisms for deleting an event so you don't need
to worry about the editLink, etc.
$newEvent->delete()
Ray
On Wed, Jul 22, 2009 at 1:24 PM, behrk2 <[email protected]> wrote:
>
> Hey everyone,
>
> I have modified my PHP web app to add events to a Google Calendar.
> Currently, it adds successfully.
>
> However, now I wish to delete and edit events. This seems easy to do,
> except for the fact that I cannot retrieve an Event URL for a
> particular event.
>
> When I add an event, I would like to add the Event URL to my database,
> so that when I want to delete that I event, I can recall the URL from
> the DB.
>
> Here is my code for adding an event and trying to echo the event URL.
> The echo appears as nothing. It's just blank.
>
> Can anyone see what I am doing wrong? Thanks!
>
> $newIncludePath = array();
> $newIncludePath[] = '../ZendGdata-1.8.4PL1/library';
> $newIncludePath = implode($newIncludePath);
> set_include_path($newIncludePath);
>
> // load classes
> require_once 'Zend/Loader.php';
> Zend_Loader::loadClass('Zend_Gdata');
> Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
> Zend_Loader::loadClass('Zend_Gdata_Calendar');
> Zend_Loader::loadClass('Zend_Http_Client');
>
> // connect to service
> $gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
> $user = "*****[email protected]";
> $pass = "*****";
> $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass,
> $gcal);
> $gcal = new Zend_Gdata_Calendar($client);
>
> // construct event object
> // save to server
> try {
> $event = $gcal->newEventEntry();
> $event->title = $gcal->newTitle($title);
> $event->content = $gcal->newContent($desc);
> $when = $gcal->newWhen();
> $when->startTime = $date;
> $when->endTime = $date;
> $event->when = array($when);
> $gcal->insertEvent($event);
>
> echo $event->getEditLink()->href;
>
> } catch (Zend_Gdata_App_Exception $e) {
> echo "Error: Unable to add event to Google Calendar" . $e-
> >getResponse();
> }
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---