Loading...
Searching...
No Matches
CalDAVClient Class Reference

## Public Member Functions

| __construct ( $base_url, $user, $pass)
| SetDebug ( $new_value)

## Public Attributes

| $user_agent = 'DAViCalClient'
| $calendar
| $httpResponse = ""

## Protected Attributes

| $base_url
| $user
| $pass
| $entry
| $protocol
| $server
| $port
| $principal_url
| $calendar_url
| $calendar_home_set
| $calendar_urls
| $headers = array()
| $body = ""
| $requestMethod = "GET"
| $httpRequest = ""
| $xmlRequest = ""
| $xmlResponse = ""
| $httpResponseCode = 0
| $httpResponseHeaders = ""
| $httpParsedHeaders
| $httpResponseBody = ""
| $parser

## Private Attributes

| $debug = false

## Detailed Description

A class for accessing DAViCal via CalDAV, as a client

Definition at line 44 of file caldav-client-v2.php.

## Constructor & Destructor Documentation

## __construct()

CalDAVClient::__construct | ( |  | $base_url,
|  |  | $user,
|  |  | $pass )

Constructor, initialises the class

Parameters

  string | $base_url | The URL for the calendar server
  string | $user | The name of the user logging in
  string | $pass | The password for that user

Definition at line 101 of file caldav-client-v2.php.

## Member Function Documentation

## SetDebug()

CalDAVClient::SetDebug | ( |  | $new_value | ) |

Call this to enable / disable debugging. It will return the prior value of the debugging flag.

Parameters

  boolean | $new_value | The new value for debugging.

Returns
  boolean The previous value, in case you want to restore it later.

Add a Depth: header. Valid values are 0, 1 or infinity

Parameters

  int | $depth | The depth, default to infinity

Add a Depth: header. Valid values are 1 or infinity

Parameters

  int | $depth | The depth, default to infinity

Add a Content-type: header.

Parameters

  string | $type | The content type

Set the calendar_url we will be using for a while.

Parameters

  string | $url | The calendar_url

Split response into httpResponse and xmlResponse

Parameters

  string | Response from server

Split httpResponseHeaders into an array of headers

Returns
  array of arrays of header lines

Output http request headers

Returns
  HTTP headers

Output http response headers

Returns
  HTTP headers

Output http response body

Returns
  HTTP body

Output xml request

Returns
  raw xml

Output xml response

Returns
  raw xml

Send a request to the server

Parameters

  string | $url | The URL to make the request to

Returns
  string The content of the response from the server

Unchunk a chunked response

Send an OPTIONS request to the server

Parameters

  string | $url | The URL to make the request to

Returns
  array The allowed options

Send an XML request to the server (e.g. PROPFIND, REPORT, MKCALENDAR)

Parameters

  string | $method | The method (PROPFIND, REPORT, etc) to use with the request
  string | $xml | The XML to send along with the request
  string | $url | The URL to make the request to

Returns
  array An array of the allowed methods

Get a single item from the server.

Parameters

  string | $url | The URL to GET

Get the HEAD of a single item from the server.

Parameters

  string | $url | The URL to HEAD

PUT a text/icalendar resource, returning the etag

Parameters

  string | $url | The URL to make the request to
  string | $icalendar | The iCalendar resource to send to the server
  string | $etag | The etag of an existing resource to be overwritten, or '*' for a new resource.

Returns
  string The content of the response from the server

DELETE a text/icalendar resource

Parameters

  string | $url | The URL to make the request to
  string | $etag | The etag of an existing resource to be deleted, or '*' for any resource at that URL.

Returns
  int The HTTP Result Code for the DELETE

Get a single item from the server.

Parameters

  string | $url | The URL to PROPFIND on

Get/Set the Principal URL

Parameters

  $url | string The Principal URL to set

Get/Set the calendar-home-set URL

Parameters

  $url | array of string The calendar-home-set URLs to set

Get/Set the calendar-home-set URL

Parameters

  $urls | array of string The calendar URLs to set

Return the first occurrence of an href inside the named tag.

Parameters

  string | $tagname | The tag name to find the href inside of

Return the href containing this property. Except only if it's inside a status != 200

Parameters

  string | $tagname | The tag name of the property to find the href for
  integer | $which | Which instance of the tag should we use

Return the href which has a resourcetype of the specified type

Parameters

  string | $tagname | The tag name of the resourcetype to find the href for
  integer | $which | Which instance of the tag should we use

Return the <prop> ... </prop> of a propstat where the status is OK

Parameters

  string | $nodenum | The node number in the xmlnodes which is the href

Attack the given URL in an attempt to find a principal URL

Parameters

  string | $url | The URL to find the principal-URL from

Attack the given URL in an attempt to find a principal URL

Parameters

  string | $url | The URL to find the calendar-home-set from

Find the calendars, from the calendar_home_set

Find the calendars, from the calendar_home_set

Get all etags for a calendar

Get a bunch of events for a calendar with a calendar-multiget report

Given XML for a calendar query, return an array of the events (/todos) in the response. Each event in the array will have a 'href', 'etag' and '$response_type' part, where the 'href' is relative to the calendar and the '$response_type' contains the definition of the calendar data in iCalendar format.

Parameters

  string | $filter | XML fragment which is the <filter> element of a calendar-query
  string | $url | The URL of the calendar, or empty/null to use the 'current' calendar_url

Returns
  array An array of the relative URLs, etags, and events from the server. Each element of the array will be an array with 'href', 'etag' and 'data' elements, corresponding to the URL, the server-supplied etag (which only varies when the data changes) and the calendar data in iCalendar format.

Get the events in a range from $start to $finish. The dates should be in the format yyyymmddThhmmssZ and should be in GMT. The events are returned as an array of event arrays. Each event array will have a 'href', 'etag' and 'event' part, where the 'href' is relative to the calendar and the event contains the definition of the event in iCalendar format.

Parameters

  timestamp | $start | The start time for the period
  timestamp | $finish | The finish time for the period
  string | $relative_url | The URL relative to the base_url specified when the calendar was opened. Default ''.

Returns
  array An array of the relative URLs, etags, and events, returned from DoCalendarQuery()

See also
  DoCalendarQuery()

Get the todo's in a range from $start to $finish. The dates should be in the format yyyymmddThhmmssZ and should be in GMT. The events are returned as an array of event arrays. Each event array will have a 'href', 'etag' and 'event' part, where the 'href' is relative to the calendar and the event contains the definition of the event in iCalendar format.

Parameters

  timestamp | $start | The start time for the period
  timestamp | $finish | The finish time for the period
  boolean | $completed | Whether to include completed tasks
  boolean | $cancelled | Whether to include cancelled tasks
  string | $relative_url | The URL relative to the base_url specified when the calendar was opened. Default ''.

Returns
  array An array of the relative URLs, etags, and events, returned from DoCalendarQuery()

See also
  DoCalendarQuery()

Get the calendar entry by UID

Parameters

  | uid |
  string | $relative_url | The URL relative to the base_url specified when the calendar was opened. Default ''.
  string | $component_type | The component type inside the VCALENDAR. Default 'VEVENT'.

Returns
  array An array of the relative URL, etag, and calendar data returned from DoCalendarQuery()

See also
  DoCalendarQuery()

Get the calendar entry by HREF

Parameters

  string | $href | The href from a call to GetEvents or GetTodos etc.

Returns
  string The iCalendar of the calendar entry

Definition at line 132 of file caldav-client-v2.php.

## Member Data Documentation

## $base_url

CalDAVClient::$base_url

protected

Definition at line 50 of file caldav-client-v2.php.

## $body

CalDAVClient::$body = ""

protected

Definition at line 80 of file caldav-client-v2.php.

## $calendar

CalDAVClient::$calendar

Definition at line 26 of file caldav-client.php.

## $calendar_home_set

CalDAVClient::$calendar_home_set

protected

The calendar-home-set we're using

Definition at line 65 of file caldav-client-v2.php.

## $calendar_url

CalDAVClient::$calendar_url

protected

The calendar-URL we're using

Definition at line 60 of file caldav-client-v2.php.

## $calendar_urls

CalDAVClient::$calendar_urls

protected

The calendar_urls we have discovered

Definition at line 70 of file caldav-client-v2.php.

## $debug

CalDAVClient::$debug = false

private

Definition at line 92 of file caldav-client-v2.php.

## $entry

CalDAVClient::$entry

protected

Definition at line 50 of file caldav-client-v2.php.

## $headers

CalDAVClient::$headers = array()

protected

Definition at line 79 of file caldav-client-v2.php.

## $httpParsedHeaders

CalDAVClient::$httpParsedHeaders

protected

Definition at line 87 of file caldav-client-v2.php.

## $httpRequest

CalDAVClient::$httpRequest = ""

protected

Definition at line 82 of file caldav-client-v2.php.

## $httpResponse

CalDAVClient::$httpResponse = ""

Definition at line 40 of file caldav-client.php.

## $httpResponseBody

CalDAVClient::$httpResponseBody = ""

protected

Definition at line 88 of file caldav-client-v2.php.

## $httpResponseCode

CalDAVClient::$httpResponseCode = 0

protected

Definition at line 85 of file caldav-client-v2.php.

## $httpResponseHeaders

CalDAVClient::$httpResponseHeaders = ""

protected

Definition at line 86 of file caldav-client-v2.php.

## $parser

CalDAVClient::$parser

protected

Definition at line 90 of file caldav-client-v2.php.

## $pass

CalDAVClient::$pass

protected

Definition at line 50 of file caldav-client-v2.php.

## $port

CalDAVClient::$port

protected

Definition at line 50 of file caldav-client-v2.php.

## $principal_url

CalDAVClient::$principal_url

protected

The principal-URL we're using

Definition at line 55 of file caldav-client-v2.php.

## $protocol

CalDAVClient::$protocol

protected

Definition at line 50 of file caldav-client-v2.php.

## $requestMethod

CalDAVClient::$requestMethod = "GET"

protected

Definition at line 81 of file caldav-client-v2.php.

## $server

CalDAVClient::$server

protected

Definition at line 50 of file caldav-client-v2.php.

## $user

CalDAVClient::$user

protected

Definition at line 50 of file caldav-client-v2.php.

## $user_agent

CalDAVClient::$user_agent = 'DAViCalClient'

Definition at line 77 of file caldav-client-v2.php.

## $xmlRequest

CalDAVClient::$xmlRequest = ""

protected

Definition at line 83 of file caldav-client-v2.php.

## $xmlResponse

CalDAVClient::$xmlResponse = ""

protected

Definition at line 84 of file caldav-client-v2.php.

The documentation for this class was generated from the following files:

- inc/caldav-client-v2.php
- inc/caldav-client.php