ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
AddressBookHome.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\CardDAV;
4 
5 use Sabre\DAV;
7 use Sabre\DAVACL;
8 use 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 
70  throw new DAV\Exception\MethodNotAllowed();
71 
72  }
73 
79  function delete() {
80 
81  throw new DAV\Exception\MethodNotAllowed();
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 }
AddressBook Home class.
createDirectory($filename)
Creates a new directory under this object.
split($path)
Returns the &#39;dirname&#39; and &#39;basename&#39; for a path.
Definition: functions.php:279
The IExtendedCollection interface.
createFile($filename, $data=null)
Creates a new file under this object.
getName()
Returns the name of this object.
Collection class.
Definition: Collection.php:15
setName($name)
Updates the name of this object.
getChild($name)
Returns a single addressbook, by name.
ACL-enabled node.
Definition: IACL.php:16
$filename
Definition: buildRTE.php:89
getChildren()
Returns a list of addressbooks.
__construct(Backend\BackendInterface $carddavBackend, $principalUri)
Constructor.
getLastModified()
Returns the last modification date.
Unknown property.
Definition: Unknown.php:15
$data
Definition: bench.php:6