## CalDAVClient

Description

A class for accessing DAViCal via CalDAV, as a client

Located in /inc/caldav-client-v2.php (line 39)

Variable Summary
string $base_url
mixed $body
mixed $calendar_home_set
mixed $calendar_url
mixed $calendar_urls
mixed $entry
mixed $headers
mixed $httpRequest
mixed $httpResponse
mixed $parser
mixed $pass
mixed $port
mixed $principal_url
mixed $protocol
mixed $requestMethod
mixed $server
mixed $user
string $user_agent
mixed $xmlRequest
mixed $xmlResponse
Method Summary
CalDAVClient __construct (string $base_url, string $user, string $pass)
void CalendarHomeSet ([$url $urls = null])
void CalendarMultiget ( $event_hrefs, [ $url = null])
void CalendarUrls ([$urls $urls = null])
array DoCalendarQuery (string $filter, [string $url = null])
int DoDELETERequest (string $url, [string $etag = null])
void DoGETRequest (string $url)
void DoHEADRequest (string $url)
array DoOptionsRequest ([string $url = null])
void DoPROPFINDRequest (string $url, $props, [ $depth = 0])
string DoPUTRequest (string $url, string $icalendar, [string $etag = null])
string DoRequest ([string $url = null])
array DoXMLRequest ( $request_method, string $xml, [string $url = null], string $method)
void FindCalendarHome ([ $recursed = false], string $url)
void FindCalendars ([ $recursed = false])
void FindPrincipal (string $url)
void GetCalendarDetails ([ $url = null])
void GetCollectionETags ([ $url = null])
string GetEntryByHref (string $href)
array GetEntryByUid (uid $uid, [string $relative_url = ''])
array GetEvents ([timestamp $start = null], [timestamp $finish = null], [string $relative_url = ''])
HTTP GetHttpRequest ()
void GetOKProps (string $nodenum)
HTTP GetResponseBody ()
HTTP GetResponseHeaders ()
array GetTodos (timestamp $start, timestamp $finish, [boolean $completed = false], [boolean $cancelled = false], [string $relative_url = ""])
raw GetXmlRequest ()
raw GetXmlResponse ()
void HrefForProp (string $tagname, [ $i = 0], integer $which)
void HrefForResourcetype (string $tagname, [ $i = 0], integer $which)
void HrefValueInside (string $tagname)
void ParseResponse (string $response)
void PrincipalURL ([$url $url = null])
void SetCalendar (string $url)
void SetContentType (string $type)
void SetDepth ([int $depth = '0'])
void SetMatch (bool $match, [string $etag = '*'])
void SetUserAgent ([ $user_agent = null], int $depth)
Variables
string $base_url (line 45)

Server, username, password, calendar

- access: protected

mixed $body = "" (line 75)

- access: protected

mixed $calendar_home_set (line 60)

The calendar-home-set we're using

- access: protected

mixed $calendar_url (line 55)

The calendar-URL we're using

- access: protected

mixed $calendar_urls (line 65)

The calendar_urls we have discovered

- access: protected

mixed $entry (line 45)

- access: protected

mixed $headers = array() (line 74)

- access: protected

mixed $httpRequest = "" (line 77)

- access: protected

mixed $httpResponse = "" (line 79)

- access: protected

mixed $parser (line 82)

- access: protected

mixed $pass (line 45)

- access: protected

mixed $port (line 45)

- access: protected

mixed $principal_url (line 50)

The principal-URL we're using

- access: protected

mixed $protocol (line 45)

- access: protected

mixed $requestMethod = "GET" (line 76)

- access: protected

mixed $server (line 45)

- access: protected

mixed $user (line 45)

- access: protected

string $user_agent = 'DAViCalClient' (line 72)

The useragent which is send to the caldav server

- access: public

mixed $xmlRequest = "" (line 78)

- access: protected

mixed $xmlResponse = "" (line 80)

- access: protected

Methods
Constructor __construct (line 91)

Constructor, initialises the class

CalDAVClient __construct (string $base_url, string $user, string $pass)

- 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

CalendarHomeSet (line 445)

Get/Set the calendar-home-set URL

void CalendarHomeSet ([$url $urls = null])

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

CalendarMultiget (line 710)

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

void CalendarMultiget ( $event_hrefs, [ $url = null])

- $event_hrefs
- $url

CalendarUrls (line 459)

Get/Set the calendar-home-set URL

void CalendarUrls ([$urls $urls = null])

- $urls $urls: array of string The calendar URLs to set

DoCalendarQuery (line 762)

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.

- return: 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.

array DoCalendarQuery (string $filter, [string $url = null])

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

DoDELETERequest (line 393)

DELETE a text/icalendar resource

- return: The HTTP Result Code for the DELETE

int DoDELETERequest (string $url, [string $etag = null])

- 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.

DoGETRequest (line 333)

Get a single item from the server.

void DoGETRequest (string $url)

- string $url: The URL to GET

DoHEADRequest (line 345)

Get the HEAD of a single item from the server.

void DoHEADRequest (string $url)

- string $url: The URL to HEAD

DoOptionsRequest (line 299)

Send an OPTIONS request to the server

- return: The allowed options

array DoOptionsRequest ([string $url = null])

- string $url: The URL to make the request to

DoPROPFINDRequest (line 410)

Get a single item from the server.

void DoPROPFINDRequest (string $url, $props, [ $depth = 0])

- string $url: The URL to PROPFIND on
- $props
- $depth

DoPUTRequest (line 361)

PUT a text/icalendar resource, returning the etag

- return: The content of the response from the server

string DoPUTRequest (string $url, string $icalendar, [string $etag = null])

- 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.

DoRequest (line 241)

Send a request to the server

- return: The content of the response from the server

string DoRequest ([string $url = null])

- string $url: The URL to make the request to

DoXMLRequest (line 319)

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

- return: An array of the allowed methods

array DoXMLRequest ( $request_method, string $xml, [string $url = null], string $method)

- 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
- $request_method

FindCalendarHome (line 589)

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

void FindCalendarHome ([ $recursed = false], string $url)

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

FindCalendars (line 618)

Find the calendars, from the calendar_home_set

void FindCalendars ([ $recursed = false])

- $recursed

FindPrincipal (line 566)

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

void FindPrincipal (string $url)

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

GetCalendarDetails (line 662)

Find the calendars, from the calendar_home_set

void GetCalendarDetails ([ $url = null])

- $url

GetCollectionETags (line 690)

Get all etags for a calendar

void GetCollectionETags ([ $url = null])

- $url

GetEntryByHref (line 916)

Get the calendar entry by HREF

- return: The iCalendar of the calendar entry

string GetEntryByHref (string $href)

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

GetEntryByUid (line 890)

Get the calendar entry by UID

- return: An array of the relative URL, etag, and calendar data returned from DoCalendarQuery() @see DoCalendarQuery()

array GetEntryByUid (uid $uid, [string $relative_url = ''])

- string $relative_url: The URL relative to the base_url specified when the calendar was opened. Default ''.
- uid $uid

GetEvents (line 818)

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.

- return: An array of the relative URLs, etags, and events, returned from DoCalendarQuery() @see DoCalendarQuery()

array GetEvents ([timestamp $start = null], [timestamp $finish = null], [string $relative_url = ''])

- 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 ''.

GetHttpRequest (line 198)

Output http request headers

- return: headers

HTTP GetHttpRequest ()
GetOKProps (line 536)

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

void GetOKProps (string $nodenum)

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

GetResponseBody (line 214)

Output http response body

- return: body

HTTP GetResponseBody ()
GetResponseHeaders (line 206)

Output http response headers

- return: headers

HTTP GetResponseHeaders ()
GetTodos (line 853)

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.

- return: An array of the relative URLs, etags, and events, returned from DoCalendarQuery() @see DoCalendarQuery()

array GetTodos (timestamp $start, timestamp $finish, [boolean $completed = false], [boolean $cancelled = false], [string $relative_url = ""])

- 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 ''.

GetXmlRequest (line 222)

Output xml request

- return: xml

raw GetXmlRequest ()
GetXmlResponse (line 230)

Output xml response

- return: xml

raw GetXmlResponse ()
HrefForProp (line 490)

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

void HrefForProp (string $tagname, [ $i = 0], integer $which)

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

HrefForResourcetype (line 516)

Return the href which has a resourcetype of the specified type

void HrefForResourcetype (string $tagname, [ $i = 0], integer $which)

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

HrefValueInside (line 473)

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

void HrefValueInside (string $tagname)

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

ParseResponse (line 168)

Split response into httpResponse and xmlResponse

void ParseResponse (string $response)

- string $response: Response from server

PrincipalURL (line 432)

Get/Set the Principal URL

void PrincipalURL ([$url $url = null])

- $url $url: string The Principal URL to set

SetCalendar (line 159)

Set the calendar_url we will be using for a while.

void SetCalendar (string $url)

- string $url: The calendar_url

SetContentType (line 150)

Add a Content-type: header.

void SetContentType (string $type)

- string $type: The content type

SetDepth (line 131)

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

void SetDepth ([int $depth = '0'])

- int $depth: The depth, default to infinity

SetMatch (line 122)

Adds an If-Match or If-None-Match header

void SetMatch (bool $match, [string $etag = '*'])

- bool $match: to Match or Not to Match, that is the question!
- string $etag: The etag to match / not match against.

SetUserAgent (line 140)

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

void SetUserAgent ([ $user_agent = null], int $depth)

- int $depth: The depth, default to infinity
- $user_agent

Documentation generated on Sat, 17 Apr 2010 12:32:24 +1200 by phpDocumentor 1.3.2