ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\CardDAV\AddressBookHome Class Reference

AddressBook Home class. More...

+ Inheritance diagram for Sabre\CardDAV\AddressBookHome:
+ Collaboration diagram for Sabre\CardDAV\AddressBookHome:

Public Member Functions

 __construct (Backend\BackendInterface $carddavBackend, $principalUri)
 Constructor. More...
 
 getName ()
 Returns the name of this object. More...
 
 setName ($name)
 Updates the name of this object. More...
 
 delete ()
 Deletes this object. More...
 
 getLastModified ()
 Returns the last modification date. More...
 
 createFile ($filename, $data=null)
 Creates a new file under this object. More...
 
 createDirectory ($filename)
 Creates a new directory under this object. More...
 
 getChild ($name)
 Returns a single addressbook, by name. More...
 
 getChildren ()
 Returns a list of addressbooks. More...
 
 createExtendedCollection ($name, MkCol $mkCol)
 Creates a new address book. More...
 
 getOwner ()
 Returns the owner principal. More...
 
- Public Member Functions inherited from Sabre\DAV\Collection
 getChild ($name)
 Returns a child object, by its name. More...
 
 childExists ($name)
 Checks is a child-node exists. More...
 
 createFile ($name, $data=null)
 Creates a new file in the directory. More...
 
 createDirectory ($name)
 Creates a new subdirectory. More...
 
- Public Member Functions inherited from Sabre\DAV\Node
 getLastModified ()
 Returns the last modification time as a unix timestamp. More...
 
 delete ()
 Deletes the current node. More...
 
 setName ($name)
 Renames the node. More...
 
- Public Member Functions inherited from Sabre\DAVACL\IACL
 getGroup ()
 Returns a group principal. More...
 
 getACL ()
 Returns a list of ACE's for this node. More...
 
 setACL (array $acl)
 Updates the ACL. More...
 
 getSupportedPrivilegeSet ()
 Returns the list of supported privileges for this node. More...
 

Protected Attributes

 $principalUri
 
 $carddavBackend
 

Detailed Description

AddressBook Home class.

This collection contains a list of addressbooks associated with one user.

Author
Evert Pot (http://evertpot.com/) http://sabre.io/license/ Modified BSD License

Definition at line 19 of file AddressBookHome.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\CardDAV\AddressBookHome::__construct ( Backend\BackendInterface  $carddavBackend,
  $principalUri 
)

Constructor.

Parameters
Backend\BackendInterface$carddavBackend
string$principalUri

Definition at line 43 of file AddressBookHome.php.

References Sabre\CardDAV\AddressBookHome\$carddavBackend, and Sabre\CardDAV\AddressBookHome\$principalUri.

43  {
44 
45  $this->carddavBackend = $carddavBackend;
46  $this->principalUri = $principalUri;
47 
48  }

Member Function Documentation

◆ createDirectory()

Sabre\CardDAV\AddressBookHome::createDirectory (   $filename)

Creates a new directory under this object.

This is currently not allowed.

Parameters
string$filename
Returns
void

Implements Sabre\DAV\ICollection.

Definition at line 119 of file AddressBookHome.php.

119  {
120 
121  throw new DAV\Exception\MethodNotAllowed('Creating new collections in this collection is not supported');
122 
123  }

◆ createExtendedCollection()

Sabre\CardDAV\AddressBookHome::createExtendedCollection (   $name,
MkCol  $mkCol 
)

Creates a new address book.

Parameters
string$name
MkCol$mkCol
Exceptions
DAV

Implements Sabre\DAV\IExtendedCollection.

Definition at line 167 of file AddressBookHome.php.

167  {
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  }
const NS_CARDDAV
xml namespace for CardDAV elements
Definition: Plugin.php:33

◆ createFile()

Sabre\CardDAV\AddressBookHome::createFile (   $filename,
  $data = null 
)

Creates a new file under this object.

This is currently not allowed

Parameters
string$filename
resource$data
Returns
void

Implements Sabre\DAV\ICollection.

Definition at line 105 of file AddressBookHome.php.

105  {
106 
107  throw new DAV\Exception\MethodNotAllowed('Creating new files in this collection is not supported');
108 
109  }

◆ delete()

Sabre\CardDAV\AddressBookHome::delete ( )

Deletes this object.

Returns
void

Implements Sabre\DAV\INode.

Definition at line 79 of file AddressBookHome.php.

79  {
80 
81  throw new DAV\Exception\MethodNotAllowed();
82 
83  }

◆ getChild()

Sabre\CardDAV\AddressBookHome::getChild (   $name)

Returns a single addressbook, by name.

Parameters
string$name
Todo:
needs optimizing
Returns
AddressBook

Implements Sabre\DAV\ICollection.

Definition at line 132 of file AddressBookHome.php.

References $name, and Sabre\CardDAV\AddressBookHome\getChildren().

132  {
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  }
getChildren()
Returns a list of addressbooks.
+ Here is the call graph for this function:

◆ getChildren()

Sabre\CardDAV\AddressBookHome::getChildren ( )

Returns a list of addressbooks.

Returns
array

Implements Sabre\DAV\ICollection.

Definition at line 148 of file AddressBookHome.php.

Referenced by Sabre\CardDAV\AddressBookHome\getChild().

148  {
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  }
+ Here is the caller graph for this function:

◆ getLastModified()

Sabre\CardDAV\AddressBookHome::getLastModified ( )

Returns the last modification date.

Returns
int

Implements Sabre\DAV\INode.

Definition at line 90 of file AddressBookHome.php.

90  {
91 
92  return null;
93 
94  }

◆ getName()

Sabre\CardDAV\AddressBookHome::getName ( )

Returns the name of this object.

Returns
string

Implements Sabre\DAV\INode.

Definition at line 55 of file AddressBookHome.php.

References $name, and Sabre\Uri\split().

55  {
56 
57  list(, $name) = Uri\split($this->principalUri);
58  return $name;
59 
60  }
split($path)
Returns the 'dirname' and 'basename' for a path.
Definition: functions.php:279
+ Here is the call graph for this function:

◆ getOwner()

Sabre\CardDAV\AddressBookHome::getOwner ( )

Returns the owner principal.

This must be a url to a principal, or null if there's no owner

Returns
string|null

Implements Sabre\DAVACL\IACL.

Definition at line 185 of file AddressBookHome.php.

185  {
186 
187  return $this->principalUri;
188 
189  }

◆ setName()

Sabre\CardDAV\AddressBookHome::setName (   $name)

Updates the name of this object.

Parameters
string$name
Returns
void

Implements Sabre\DAV\INode.

Definition at line 68 of file AddressBookHome.php.

68  {
69 
70  throw new DAV\Exception\MethodNotAllowed();
71 
72  }

Field Documentation

◆ $carddavBackend

Sabre\CardDAV\AddressBookHome::$carddavBackend
protected

Definition at line 35 of file AddressBookHome.php.

Referenced by Sabre\CardDAV\AddressBookHome\__construct().

◆ $principalUri

Sabre\CardDAV\AddressBookHome::$principalUri
protected

Definition at line 28 of file AddressBookHome.php.

Referenced by Sabre\CardDAV\AddressBookHome\__construct().


The documentation for this class was generated from the following file: