I just posted asking to figure out how to populate the dynamic URL,
I'm not sure if that's part of this problem or not.
My problem here is that this function actually works without errors
and I can retrieve a giant string from google, but I can't find my
event listed anywhere....!?!?!
I'm confused.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Here's the function
function insertEvent ( $title,$where,$content,$startDate,$startTime,
$endDate,$endTime,$CalendarID,$CalendarURL ) {
$CalendarURL = "http://www.google.com/calendar/
feeds/".CALENDAR_USERNAME."/private/full";
// $CalendarURL = "http://www.google.com/calendar/feeds/".
$CalendarURL."/private/full";
// $CalendarURL =
'http://www.google.com/calendar/feeds/default/
private/full';
//Validate elements' format.if not jump the insert
if( preg_match( "/[0-9]{4}\-[0-9]{2}\-[0-9]{2}/i", $startDate )
&& preg_match( "/[0-9]{4}\-[0-9]{2}\-[0-9]{2}/i", $endDate )
&& ( preg_match( "/[0-9]{1,2}:[0-9]{2}/i", $startTime ) ||
$startTime=="all_day" )
&& ( preg_match( "/[0-9]{1,2}:[0-9]{2}/i", $endTime ) ||
$endTime=="all_day" ) ) {
try {
$event= $this->gdataCal->newEventEntry();
// Populate the event with the desired
information
// Note that each attribute is created as an
instance of a
matching class
$event->title =
$this->gdataCal->newTitle( $title );
$event->where =
array($this->gdataCal->newWhere( $where ));
$event->content =
$this->gdataCal->newContent( $content );
$when = $this->gdataCal->newWhen();
if ($startTime=='all_day') {
$when->startTime =
"{$startDate}{$this->tzOffset}:00";
} else {
$when->startTime =
"{$startDate}T{$startTime}:00.000{$this-
>tzOffset}:00";
}
if ($endTime=='all_day') {
$when->endTime =
"{$endDate}{$this->tzOffset}:00";
} else {
$when->endTime =
"{$endDate}T{$endTime}:00.000{$this->tzOffset}:
00";
}
$event->when = array($when);
// Upload the event to the calendar server
// A copy of the event as it is recorded on the
server is returned
$newEvent = $this->gdataCal->insertEvent(
$event, $CalendarURL );
return $newEvent;
////////////////////////////////////////////////////////////////////////////////////////////////////
// Catching the error
} catch (Zend_Gdata_App_HttpException $e) {
echo "<BR><BR>Error: " . $e->getMessage() .
"<br />\n";
if ($e->getResponse() != null) {
echo "Body: <br />\n" .
$e->getResponse()->getBody() . "<br />
\n";
}
}
}else {
// Was not successful at adding an event to the
calendar because
of the date format
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---