I am writing a site that sends the following:

https://accounts.google.com/ServiceLogin?service=cl&passive=1209600&continue=http://www.google.com/calendar/event?action%3DTEMPLATE%26text%3DEventTitle%26dates%3D20120107T152000Z/20120107T162000Z%26location%3D1%2BNicholas%2BStreet%26details%3Dhttp://dev.uocal.uottawa.ca/en/node/354&followup=http://www.google.com/calendar

to Google to add to the Google calendar. How would I write the URL if I want to add a calendar event every Monday until a specific date to Google calendar. I looked in the Google API and I did not come across anything of this sort.

Recommended Answers

All 2 Replies

OK. I got it so far as requesting the user to allow my company access to Google calendar and I wrote the callback method:

require_once 'google-api-php-client/src/apiClient.php';
require_once 'google-api-php-client/src/contrib/apiPlusService.php';
require_once 'google-api-php-client/src/contrib/apiGanService.php';


$event = new Event();
$event->setSummary('Appointment');
$event->setLocation('Somewhere');
$start = new EventDateTime();
$start->setDateTime('2012-03-20T10:00:00.000-07:00');
$start->setTimeZone('America/Los_Angeles');
$event->setStart($start);
$end = new EventDateTime();
$end->setDateTime('2012-03-20T10:25:00.000-07:00');
$end->setTimeZone('America/Los_Angeles');
$event->setEnd($end);
$event->setRecurrence(array('RRULE:FREQ=WEEKLY;UNTIL=20120401T100000-07:00'));
$recurringEvent = $service->events->insert('primary', $event);

echo $recurringEvent->getId();

and it fails at Event->setSummary

I found where this method is located (apiCalendarService) and tried to add as a require_once but the application complains.

Anything missing?


Fatal error: Call to undefined method Event::setSummary() in C:\xampp\htdocs\drupal\sites\default\modules\custom\uo_personal_timetable-6.x-1.x\uo_personal_timetable.inc on line 454


Here's the call to Google access:

require_once 'google-api-php-client/src/apiClient.php';
require_once 'google-api-php-client/src/contrib/apiPlusService.php';
//require_once 'google-api-php-client/src/contrib/apiCalendarService.php';

session_start();

$client = new apiClient();
$client->setApplicationName('University of Ottawa');
// Visit https://code.google.com/apis/console?api=plus to generate your
// client id, client secret, and to register your redirect uri.
$client->setClientId('149259101497.apps.googleusercontent.com');
$client->setClientSecret('29bxlRTCfeqs1TKdIF8Rs53y');
$client->setRedirectUri('http://localhost/drupal/apps/personal_timetable/calendar');
$client->setDeveloperKey('AI39si6DH6yMIGiPKK9uuLGtnPbNjJXW4Jg9o4iu3oc46qaW_7Q3LX6lsRjIoqztL5rOE2opqJcgznIDMBIUR6Z1oBwYZP3HHQ');
$plus = new apiPlusService($client);

if (isset($_GET)) {
$client->authenticate();
$_SESSION = $client->getAccessToken();
header('Location: http://' . $_SERVER . $_SERVER);
}

if (isset($_SESSION)) {
$client->setAccessToken($_SESSION);
}

if ($client->getAccessToken()) {
$activities = $plus->activities->listActivities('me', 'public');
print 'Your Activities: <pre>' . print_r($activities, true) . '</pre>';

// The access token may have been updated.
$_SESSION = $client->getAccessToken();
} else {
$authUrl = $client->createAuthUrl();
print "<a href='$authUrl'>Connect Me!</a>";
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.