]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/lib/Sabre/CardDAV/AddressBookRoot.php
removed community home addon
[friendica-addons.git] / dav / SabreDAV / lib / Sabre / CardDAV / AddressBookRoot.php
1 <?php
2
3 /**
4  * AddressBook rootnode
5  *
6  * This object lists a collection of users, which can contain addressbooks.
7  *
8  * @package Sabre
9  * @subpackage CardDAV
10  * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
11  * @author Evert Pot (http://www.rooftopsolutions.nl/) 
12  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
13  */
14 class Sabre_CardDAV_AddressBookRoot extends Sabre_DAVACL_AbstractPrincipalCollection {
15
16     /**
17      * Principal Backend
18      *
19      * @var Sabre_DAVACL_IPrincipalBackend
20      */
21     protected $principalBackend;
22
23     /**
24      * CardDAV backend
25      *
26      * @var Sabre_CardDAV_Backend_Abstract
27      */
28     protected $carddavBackend;
29
30     /**
31      * Constructor
32      *
33      * This constructor needs both a principal and a carddav backend.
34      *
35      * By default this class will show a list of addressbook collections for
36      * principals in the 'principals' collection. If your main principals are
37      * actually located in a different path, use the $principalPrefix argument
38      * to override this.
39      *
40      * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
41      * @param Sabre_CardDAV_Backend_Abstract $carddavBackend
42      * @param string $principalPrefix
43      */
44     public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend,Sabre_CardDAV_Backend_Abstract $carddavBackend, $principalPrefix = 'principals') {
45
46         $this->carddavBackend = $carddavBackend;
47         parent::__construct($principalBackend, $principalPrefix);
48
49     }
50
51     /**
52      * Returns the name of the node
53      *
54      * @return string
55      */
56     public function getName() {
57
58         return Sabre_CardDAV_Plugin::ADDRESSBOOK_ROOT;
59
60     }
61
62     /**
63      * This method returns a node for a principal.
64      *
65      * The passed array contains principal information, and is guaranteed to
66      * at least contain a uri item. Other properties may or may not be
67      * supplied by the authentication backend.
68      *
69      * @param array $principal
70      * @return Sabre_DAV_INode
71      */
72     public function getChildForPrincipal(array $principal) {
73
74         return new Sabre_CardDAV_UserAddressBooks($this->carddavBackend, $principal['uri']);
75
76     }
77
78 }