ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
CalendarQueryReport.php
Go to the documentation of this file.
1 <?php
2 
4 
9 
23 
29  public $properties;
30 
36  public $filters;
37 
46  public $expand = null;
47 
54  public $contentType = null;
55 
62  public $version = null;
63 
85  static function xmlDeserialize(Reader $reader) {
86 
87  $elems = $reader->parseInnerTree([
88  '{urn:ietf:params:xml:ns:caldav}comp-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\CompFilter',
89  '{urn:ietf:params:xml:ns:caldav}prop-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\PropFilter',
90  '{urn:ietf:params:xml:ns:caldav}param-filter' => 'Sabre\\CalDAV\\Xml\\Filter\\ParamFilter',
91  '{urn:ietf:params:xml:ns:caldav}calendar-data' => 'Sabre\\CalDAV\\Xml\\Filter\\CalendarData',
92  '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue',
93  ]);
94 
95  $newProps = [
96  'filters' => null,
97  'properties' => [],
98  ];
99 
100  if (!is_array($elems)) $elems = [];
101 
102  foreach ($elems as $elem) {
103 
104  switch ($elem['name']) {
105 
106  case '{DAV:}prop' :
107  $newProps['properties'] = array_keys($elem['value']);
108  if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
109  $newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
110  }
111  break;
112  case '{' . Plugin::NS_CALDAV . '}filter' :
113  foreach ($elem['value'] as $subElem) {
114  if ($subElem['name'] === '{' . Plugin::NS_CALDAV . '}comp-filter') {
115  if (!is_null($newProps['filters'])) {
116  throw new BadRequest('Only one top-level comp-filter may be defined');
117  }
118  $newProps['filters'] = $subElem['value'];
119  }
120  }
121  break;
122 
123  }
124 
125  }
126 
127  if (is_null($newProps['filters'])) {
128  throw new BadRequest('The {' . Plugin::NS_CALDAV . '}filter element is required for this request');
129  }
130 
131  $obj = new self();
132  foreach ($newProps as $key => $value) {
133  $obj->$key = $value;
134  }
135  return $obj;
136 
137  }
138 
139 }
parseInnerTree(array $elementMap=null)
Parses all elements below the current element.
Definition: Reader.php:129
static xmlDeserialize(Reader $reader)
The deserialize method is called during xml parsing.
The Reader class expands upon PHP&#39;s built-in XMLReader.
Definition: Reader.php:20
Implementing the XmlDeserializable interface allows you to use a class as a deserializer for a specif...
CalendarQueryReport request parser.
$key
Definition: croninfo.php:18
const NS_CALDAV
This is the official CalDAV namespace.
Definition: Plugin.php:33