ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
AddressBookHome.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\CardDAV;
4
5use Sabre\DAV;
8use Sabre\Uri;
9
20
21 use DAVACL\ACLTrait;
22
28 protected $principalUri;
29
35 protected $carddavBackend;
36
43 function __construct(Backend\BackendInterface $carddavBackend, $principalUri) {
44
45 $this->carddavBackend = $carddavBackend;
46 $this->principalUri = $principalUri;
47
48 }
49
55 function getName() {
56
57 list(, $name) = Uri\split($this->principalUri);
58 return $name;
59
60 }
61
68 function setName($name) {
69
71
72 }
73
79 function delete() {
80
82
83 }
84
90 function getLastModified() {
91
92 return null;
93
94 }
95
105 function createFile($filename, $data = null) {
106
107 throw new DAV\Exception\MethodNotAllowed('Creating new files in this collection is not supported');
108
109 }
110
120
121 throw new DAV\Exception\MethodNotAllowed('Creating new collections in this collection is not supported');
122
123 }
124
132 function getChild($name) {
133
134 foreach ($this->getChildren() as $child) {
135 if ($name == $child->getName())
136 return $child;
137
138 }
139 throw new DAV\Exception\NotFound('Addressbook with name \'' . $name . '\' could not be found');
140
141 }
142
148 function getChildren() {
149
150 $addressbooks = $this->carddavBackend->getAddressBooksForUser($this->principalUri);
151 $objs = [];
152 foreach ($addressbooks as $addressbook) {
153 $objs[] = new AddressBook($this->carddavBackend, $addressbook);
154 }
155 return $objs;
156
157 }
158
167 function createExtendedCollection($name, MkCol $mkCol) {
168
169 if (!$mkCol->hasResourceType('{' . Plugin::NS_CARDDAV . '}addressbook')) {
170 throw new DAV\Exception\InvalidResourceType('Unknown resourceType for this collection');
171 }
172 $properties = $mkCol->getRemainingValues();
173 $mkCol->setRemainingResultCode(201);
174 $this->carddavBackend->createAddressBook($this->principalUri, $name, $properties);
175
176 }
177
185 function getOwner() {
186
187 return $this->principalUri;
188
189 }
190
191}
$filename
Definition: buildRTE.php:89
An exception for terminatinating execution or to throw for unit testing.
AddressBook Home class.
createFile($filename, $data=null)
Creates a new file under this object.
getLastModified()
Returns the last modification date.
getName()
Returns the name of this object.
setName($name)
Updates the name of this object.
getChildren()
Returns a list of addressbooks.
createDirectory($filename)
Creates a new directory under this object.
__construct(Backend\BackendInterface $carddavBackend, $principalUri)
Constructor.
getChild($name)
Returns a single addressbook, by name.
Collection class.
Definition: Collection.php:15
This class represents a MKCOL operation.
Definition: MkCol.php:23
ACL-enabled node.
Definition: IACL.php:16
The IExtendedCollection interface.
split($path)
Returns the 'dirname' and 'basename' for a path.
Definition: functions.php:279
$data
Definition: bench.php:6