Logo Search packages:      
Sourcecode: davical version File versions  Download package

CalDAVClient::DoCalendarQuery ( filter,
relative_url = '',
reponse_type = 'data' 
)

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$filterXML fragment which is the <filter> element of a calendar-query
string$relative_urlThe URL relative to the base_url specified when the calendar was opened. Default ''.
string$report_typeUsed as a name for the array element containing the calendar data.
Deprecated:
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.

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

References DoXMLRequest(), and SetDepth().

Referenced by GetEntryByUid(), GetEvents(), and GetTodos().

                                                                                  {

    $xml = <<<EOXML
<?xml version="1.0" encoding="utf-8" ?>
<calendar-query xmlns:D="DAV:" xmlns="urn:ietf:params:xml:ns:caldav">
  <D:prop>
    <calendar-data/>
    <D:getetag/>
  </D:prop>$filter
</calendar-query>
EOXML;

    $this->SetDepth("1");
    $this->DoXMLRequest( 'REPORT', $xml, $relative_url );
    $xml_parser = xml_parser_create_ns('UTF-8');
    $this->xml_tags = array();
    xml_parser_set_option ( $xml_parser, XML_OPTION_SKIP_WHITE, 1 );
    xml_parse_into_struct( $xml_parser, $this->response, $this->xml_tags );
    xml_parser_free($xml_parser);

    $report = array();
    foreach( $this->xml_tags AS $k => $v ) {
      switch( $v['tag'] ) {
        case 'DAV::RESPONSE':
          if ( $v['type'] == 'open' ) {
            $response = array();
          }
          elseif ( $v['type'] == 'close' ) {
            $report[] = $response;
          }
          break;
        case 'DAV::HREF':
          $response['href'] = basename( $v['value'] );
          break;
        case 'DAV::GETETAG':
          $response['etag'] = preg_replace('/^"?([^"]+)"?/', '$1', $v['value']);
          break;
        case 'URN:IETF:PARAMS:XML:NS:CALDAV:CALENDAR-DATA':
          $response['data'] = $v['value'];
          if ( $report_type != 'data' ) $response[$report_type] = $v['value'];  // deprecated - will be removed.  Just use 'data' please :-)
          break;
      }
    }
    return $report;
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index