Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe JGoogleDataCalendar
+ Graphe d'héritage de JGoogleDataCalendar:
+ Graphe de collaboration de JGoogleDataCalendar:

Liste de tous les membres

Fonctions membres publiques

 __construct (JRegistry $options=null, JGoogleAuth $auth=null)
 removeCalendar ($calendarID)
 getCalendar ($calendarID)
 addCalendar ($calendarID, $options=array())
 listCalendars ($options=array(), $maxpages=1)
 editCalendarSettings ($calendarID, $options)
 clearCalendar ($calendarID)
 deleteCalendar ($calendarID)
 createCalendar ($title, $options=array())
 editCalendar ($calendarID, $options)
 deleteEvent ($calendarID, $eventID)
 getEvent ($calendarID, $eventID, $options=array())
 createEvent ($calendarID, $start, $end=false, $options=array(), $timezone=false, $allday=false, $notify=false)
 listRecurrences ($calendarID, $eventID, $options=array(), $maxpages=1)
 listEvents ($calendarID, $options=array(), $maxpages=1)
 moveEvent ($calendarID, $eventID, $destID, $notify=false)
 editEvent ($calendarID, $eventID, $options, $notify=false)
- Fonctions membres publiques inherited from JGoogleData
 authenticate ()
 isAuthenticated ()
 getOption ($key)
 setOption ($key, $value)

Additional Inherited Members

- Fonctions membres protégées inherited from JGoogleData
 listGetData ($url, $maxpages=1, $token=null)
 query ($url, $data=null, $headers=null, $method= 'get')
- Fonctions membres protégées statiques inherited from JGoogleData
static safeXML ($data)
- Attributs protégés inherited from JGoogleData
 $options
 $auth

Description détaillée

Définition à la ligne 19 du fichier calendar.php.


Documentation des constructeurs et destructeur

JGoogleDataCalendar::__construct ( JRegistry  $options = null,
JGoogleAuth  $auth = null 
)

Constructor.

Paramètres:
JRegistry$optionsGoogle options object
JGoogleAuth$authGoogle data http client object
Depuis:
12.3

Réimplémentée à partir de JGoogleData.

Définition à la ligne 29 du fichier calendar.php.

{
parent::__construct($options, $auth);
if (isset($this->auth) && !$this->auth->getOption('scope'))
{
$this->auth->setOption('scope', 'https://www.googleapis.com/auth/calendar');
}
}

Documentation des fonctions membres

JGoogleDataCalendar::addCalendar (   $calendarID,
  $options = array() 
)

Method to add a calendar to a user's Google Calendar list

Paramètres:
string$calendarIDNew calendar ID
array$optionsNew calendar settings
Renvoie:
mixed Data from Google
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 109 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$options['id'] = $calendarID;
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList';
$jdata = $this->query($url, json_encode($options), array('Content-type' => 'application/json'), 'post');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
JGoogleDataCalendar::clearCalendar (   $calendarID)

Method to clear a Google Calendar

Paramètres:
string$calendarIDID of calendar to clear
Renvoie:
boolean Success or failure
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 202 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$data = $this->query('https://www.googleapis.com/calendar/v3/users/me/calendars/' . urlencode($calendarID) . '/clear', null, null, 'post');
if ($data->body != '')
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$data->body}`.");
}
return true;
}
else
{
return false;
}
}
JGoogleDataCalendar::createCalendar (   $title,
  $options = array() 
)

Method to create a Google Calendar

Paramètres:
string$titleNew calendar title
array$optionsNew calendar settings
Renvoie:
mixed Data from Google.
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 259 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$options['summary'] = $title;
$url = 'https://www.googleapis.com/calendar/v3/calendars';
$jdata = $this->query($url, json_encode($options), array('Content-type' => 'application/json'), 'post');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
JGoogleDataCalendar::createEvent (   $calendarID,
  $start,
  $end = false,
  $options = array(),
  $timezone = false,
  $allday = false,
  $notify = false 
)

Method to create a Google Calendar event

Paramètres:
string$calendarIDID of calendar
mixed$startEvent start time
mixed$endEvent end time
array$optionsNew event settings
mixed$timezoneTimezone for event
boolean$alldayTreat event as an all-day event
boolean$notifyNotify participants
Renvoie:
mixed Data from Google.
Depuis:
12.3
Exceptions:
InvalidArgumentException
UnexpectedValueException

Définition à la ligne 398 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
if (!$start)
{
$startobj = new DateTime;
}
elseif (is_int($start))
{
$startobj = new DateTime;
$startobj->setTimestamp($start);
}
elseif (is_string($start))
{
$startobj = new DateTime($start);
}
elseif (is_a($start, 'DateTime'))
{
$startobj = $start;
}
else
{
throw new InvalidArgumentException('Invalid event start time.');
}
if (!$end)
{
$endobj = $startobj;
}
elseif (is_int($end))
{
$endobj = new DateTime;
$endobj->setTimestamp($end);
}
elseif (is_string($end))
{
$endobj = new DateTime($end);
}
elseif (is_a($end, 'DateTime'))
{
$endobj = $end;
}
else
{
throw new InvalidArgumentException('Invalid event end time.');
}
if ($allday)
{
$options['start'] = array('date' => $startobj->format('Y-m-d'));
$options['end'] = array('date' => $endobj->format('Y-m-d'));
}
else
{
$options['start'] = array('dateTime' => $startobj->format(DateTime::RFC3339));
$options['end'] = array('dateTime' => $endobj->format(DateTime::RFC3339));
}
if ($timezone === true)
{
$options['start']['timeZone'] = $startobj->getTimezone()->getName();
$options['end']['timeZone'] = $endobj->getTimezone()->getName();
}
elseif (is_a($timezone, 'DateTimeZone'))
{
$options['start']['timeZone'] = $timezone->getName();
$options['end']['timeZone'] = $timezone->getName();
}
elseif (is_string($timezone))
{
$options['start']['timeZone'] = $timezone;
$options['end']['timeZone'] = $timezone;
}
$url = 'https://www.googleapis.com/calendar/v3/calendars/' . urlencode($calendarID) . '/events' . ($notify ? '?sendNotifications=true' : '');
$jdata = $this->query($url, json_encode($options), array('Content-type' => 'application/json'), 'post');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
JGoogleDataCalendar::deleteCalendar (   $calendarID)

Method to delete a calendar from Google

Paramètres:
string$calendarIDID of calendar to delete.
Renvoie:
boolean Success or failure
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 230 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$data = $this->query('https://www.googleapis.com/calendar/v3/users/me/calendars/' . urlencode($calendarID), null, null, 'delete');
if ($data->body != '')
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$data->body}`.");
}
return true;
}
else
{
return false;
}
}
JGoogleDataCalendar::deleteEvent (   $calendarID,
  $eventID 
)

Method to delete an event from a Google Calendar

Paramètres:
string$calendarIDID of calendar to delete from
string$eventIDID of event to delete.
Renvoie:
boolean Success or failure.
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 327 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendars/' . urlencode($calendarID) . '/events/' . urlencode($eventID);
$data = $this->query($url, null, null, 'delete');
if ($data->body != '')
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$data->body}`.");
}
return true;
}
else
{
return false;
}
}
JGoogleDataCalendar::editCalendar (   $calendarID,
  $options 
)

Method to edit a Google Calendar

Paramètres:
string$calendarIDCalendar ID.
array$optionsCalendar settings.
Renvoie:
mixed Data from Google.
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 293 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendars/' . urlencode($calendarID);
$jdata = $this->query($url, json_encode($options), array('Content-type' => 'application/json'), 'put');
$data = json_decode($jdata->body, true);
if ($data && array_key_exists('items', $data))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
JGoogleDataCalendar::editCalendarSettings (   $calendarID,
  $options 
)

Method to edit a Google Calendar's settings

Paramètres:
string$calendarIDCalendar ID
array$optionsCalendar settings
Renvoie:
mixed Data from Google
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 170 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList/' . urlencode($calendarID);
$jdata = $this->query($url, json_encode($options), array('Content-type' => 'application/json'), 'put');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
JGoogleDataCalendar::editEvent (   $calendarID,
  $eventID,
  $options,
  $notify = false 
)

Method to edit a Google Calendar event

Paramètres:
string$calendarIDCalendar ID
string$eventIDID of the event to change
array$optionsEvent settings
boolean$notifyNotify participants of changes
Renvoie:
mixed Data from Google.
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 598 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/calendars/';
$url .= urlencode($calendarID) . '/events/' . urlencode($eventID) . ($notify ? '?sendNotifications=true' : '');
$jdata = $this->query($url, json_encode($options), array('Content-type' => 'application/json'), 'put');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
JGoogleDataCalendar::getCalendar (   $calendarID)

Method to get a calendar's settings from Google

Paramètres:
string$calendarIDID of calendar to get.
Renvoie:
mixed Data from Google
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 77 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$jdata = $this->query('https://www.googleapis.com/calendar/v3/users/me/calendarList/' . urlencode($calendarID));
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
JGoogleDataCalendar::getEvent (   $calendarID,
  $eventID,
  $options = array() 
)

Method to get an event from a Google Calendar

Paramètres:
string$calendarIDID of calendar
string$eventIDID of event to get
array$optionsOptions to send to Google
Renvoie:
mixed Data from Google.
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 358 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList/';
$url .= urlencode($calendarID) . '/events/' . urlencode($eventID) . '?' . http_build_query($options);
$jdata = $this->query($url);
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
JGoogleDataCalendar::listCalendars (   $options = array(),
  $maxpages = 1 
)

Method to retrieve calendar list from Google

Paramètres:
array$optionsSearch settings
int$maxpagesMaximum number of pages of calendars to return
Renvoie:
mixed Data from Google
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 143 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ? $options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
JGoogleDataCalendar::listEvents (   $calendarID,
  $options = array(),
  $maxpages = 1 
)

Method to retrieve a list of events on a Google calendar

Paramètres:
string$calendarIDCalendar ID
array$optionsCalendar settings
int$maxpagesCycle through pages of data to generate a complete list
Renvoie:
mixed Data from Google.
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 533 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ? $options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/calendar/v3/calendars/' . urlencode($calendarID) . '/events?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
JGoogleDataCalendar::listRecurrences (   $calendarID,
  $eventID,
  $options = array(),
  $maxpages = 1 
)

Method to retrieve a list of events on a Google calendar

Paramètres:
string$calendarIDCalendar ID
string$eventIDID of the event to change
array$optionsSearch settings
int$maxpagesMinimum number of events to retrieve (more may be retrieved depending on page size)
Renvoie:
mixed Data from Google.
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 504 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ? $options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendars/' . urlencode($calendarID) . '/events/' . urlencode($eventID) . '/instances';
$url .= '?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
JGoogleDataCalendar::moveEvent (   $calendarID,
  $eventID,
  $destID,
  $notify = false 
)

Method to move an event from one calendar to another

Paramètres:
string$calendarIDCalendar ID
string$eventIDID of the event to change
string$destIDCalendar ID
boolean$notifyNotify participants of changes
Renvoie:
mixed Data from Google.
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 562 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/calendars/' . urlencode($calendarID) . '/events/' . urlencode($eventID) . '/move';
$url .= '?destination=' . $destID . ($notify ? '&sendNotifications=true' : '');
$jdata = $this->query($url, null, null, 'post');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
JGoogleDataCalendar::removeCalendar (   $calendarID)

Method to remove a calendar from a user's calendar list

Paramètres:
string$calendarIDID of calendar to delete
Renvoie:
boolean Success or failure
Depuis:
12.3
Exceptions:
UnexpectedValueException

Définition à la ligne 49 du fichier calendar.php.

{
if ($this->isAuthenticated())
{
$jdata = $this->query('https://www.googleapis.com/calendar/v3/users/me/calendarList/' . urlencode($calendarID), null, null, 'delete');
if ($jdata->body != '')
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
return true;
}
else
{
return false;
}
}

La documentation de cette classe a été générée à partir du fichier suivant :