ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Invite.php
Go to the documentation of this file.
1 <?php
2 
4 
6 use Sabre\DAV;
10 
23 class Invite implements XmlSerializable {
24 
30  protected $sharees;
31 
37  function __construct(array $sharees) {
38 
39  $this->sharees = $sharees;
40 
41  }
42 
48  function getValue() {
49 
50  return $this->sharees;
51 
52  }
53 
73  function xmlSerialize(Writer $writer) {
74 
75  $cs = '{' . Plugin::NS_CALENDARSERVER . '}';
76 
77  foreach ($this->sharees as $sharee) {
78 
79  if ($sharee->access === DAV\Sharing\Plugin::ACCESS_SHAREDOWNER) {
80  $writer->startElement($cs . 'organizer');
81  } else {
82  $writer->startElement($cs . 'user');
83 
84  switch ($sharee->inviteStatus) {
86  $writer->writeElement($cs . 'invite-accepted');
87  break;
89  $writer->writeElement($cs . 'invite-declined');
90  break;
92  $writer->writeElement($cs . 'invite-noresponse');
93  break;
95  $writer->writeElement($cs . 'invite-invalid');
96  break;
97  }
98 
99  $writer->startElement($cs . 'access');
100  switch ($sharee->access) {
102  $writer->writeElement($cs . 'read-write');
103  break;
105  $writer->writeElement($cs . 'read');
106  break;
107 
108  }
109  $writer->endElement(); // access
110 
111  }
112 
113  $href = new DAV\Xml\Property\Href($sharee->href);
114  $href->xmlSerialize($writer);
115 
116  if (isset($sharee->properties['{DAV:}displayname'])) {
117  $writer->writeElement($cs . 'common-name', $sharee->properties['{DAV:}displayname']);
118  }
119  if ($sharee->comment) {
120  $writer->writeElement($cs . 'summary', $sharee->comment);
121  }
122  $writer->endElement(); // organizer or user
123 
124  }
125 
126  }
127 
128 }
Objects implementing XmlSerializable can control how they are represented in Xml. ...
__construct(array $sharees)
Creates the property.
Definition: Invite.php:37
startElement($name)
Opens a new element.
Definition: Writer.php:121
Href property.
Definition: Href.php:26
const NS_CALENDARSERVER
This is the namespace for the proprietary calendarserver extensions.
Definition: Plugin.php:38
xmlSerialize(Writer $writer)
The xmlSerialize method is called during xml writing.
Definition: Invite.php:73
getValue()
Returns the list of users, as it was passed to the constructor.
Definition: Invite.php:48
writeElement($name, $content=null)
Write a full element tag and it&#39;s contents.
Definition: Writer.php:189
The XML Writer class.
Definition: Writer.php:31