ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
InviteReply.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Sabre\CalDAV;
7 use Sabre\DAV;
9 
18 
24  protected $id;
25 
31  protected $dtStamp;
32 
38  protected $inReplyTo;
39 
45  protected $href;
46 
52  protected $type;
53 
59  protected $hostUrl;
60 
66  protected $summary;
67 
73  protected $etag;
74 
93  function __construct(array $values) {
94 
95  $required = [
96  'id',
97  'etag',
98  'href',
99  'dtStamp',
100  'inReplyTo',
101  'type',
102  'hostUrl',
103  ];
104  foreach ($required as $item) {
105  if (!isset($values[$item])) {
106  throw new \InvalidArgumentException($item . ' is a required constructor option');
107  }
108  }
109 
110  foreach ($values as $key => $value) {
111  if (!property_exists($this, $key)) {
112  throw new \InvalidArgumentException('Unknown option: ' . $key);
113  }
114  $this->$key = $value;
115  }
116 
117  }
118 
138  function xmlSerialize(Writer $writer) {
139 
140  $writer->writeElement('{' . CalDAV\Plugin::NS_CALENDARSERVER . '}invite-reply');
141 
142  }
143 
151  function xmlSerializeFull(Writer $writer) {
152 
153  $cs = '{' . CalDAV\Plugin::NS_CALENDARSERVER . '}';
154 
155  $this->dtStamp->setTimezone(new \DateTimezone('GMT'));
156  $writer->writeElement($cs . 'dtstamp', $this->dtStamp->format('Ymd\\THis\\Z'));
157 
158  $writer->startElement($cs . 'invite-reply');
159 
160  $writer->writeElement($cs . 'uid', $this->id);
161  $writer->writeElement($cs . 'in-reply-to', $this->inReplyTo);
162  $writer->writeElement('{DAV:}href', $this->href);
163 
164  switch ($this->type) {
165 
167  $writer->writeElement($cs . 'invite-accepted');
168  break;
170  $writer->writeElement($cs . 'invite-declined');
171  break;
172 
173  }
174 
175  $writer->writeElement($cs . 'hosturl', [
176  '{DAV:}href' => $writer->contextUri . $this->hostUrl
177  ]);
178 
179  if ($this->summary) {
180  $writer->writeElement($cs . 'summary', $this->summary);
181  }
182  $writer->endElement(); // invite-reply
183 
184  }
185 
194  function getId() {
195 
196  return $this->id;
197 
198  }
199 
207  function getETag() {
208 
209  return $this->etag;
210 
211  }
212 
213 }
xmlSerializeFull(Writer $writer)
This method serializes the entire notification, as it is used in the response body.
This interface reflects a single notification type.
xmlSerialize(Writer $writer)
The xmlSerialize method is called during xml writing.
startElement($name)
Opens a new element.
Definition: Writer.php:121
This class represents the cs:invite-reply notification element.
Definition: InviteReply.php:17
const NS_CALENDARSERVER
This is the namespace for the proprietary calendarserver extensions.
Definition: Plugin.php:38
$values
getETag()
Returns the ETag for this notification.
__construct(array $values)
Creates the Invite Reply Notification.
Definition: InviteReply.php:93
$key
Definition: croninfo.php:18
writeElement($name, $content=null)
Write a full element tag and it&#39;s contents.
Definition: Writer.php:189
getId()
Returns a unique id for this notification.
The XML Writer class.
Definition: Writer.php:31