]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/lib/Sabre/CalDAV/CalendarRootNode.php
Merge branch 'master' of git://github.com/friendica/friendica-addons
[friendica-addons.git] / dav / SabreDAV / lib / Sabre / CalDAV / CalendarRootNode.php
1 <?php
2
3 /**
4  * Calendars collection
5  *
6  * This object is responsible for generating a list of calendar-homes for each
7  * user.
8  *
9  * @package Sabre
10  * @subpackage CalDAV
11  * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
12  * @author Evert Pot (http://www.rooftopsolutions.nl/)
13  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
14  */
15 class Sabre_CalDAV_CalendarRootNode extends Sabre_DAVACL_AbstractPrincipalCollection {
16
17     /**
18      * CalDAV backend
19      *
20      * @var Sabre_CalDAV_Backend_Abstract
21      */
22     protected $caldavBackend;
23
24     /**
25      * Constructor
26      *
27      * This constructor needs both an authentication and a caldav backend.
28      *
29      * By default this class will show a list of calendar collections for
30      * principals in the 'principals' collection. If your main principals are
31      * actually located in a different path, use the $principalPrefix argument
32      * to override this.
33      *
34      *
35      * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
36      * @param Sabre_CalDAV_Backend_Abstract $caldavBackend
37      * @param string $principalPrefix
38      */
39     public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend,Sabre_CalDAV_Backend_Abstract $caldavBackend, $principalPrefix = 'principals') {
40
41         parent::__construct($principalBackend, $principalPrefix);
42         $this->caldavBackend = $caldavBackend;
43
44     }
45
46     /**
47      * Returns the nodename
48      *
49      * We're overriding this, because the default will be the 'principalPrefix',
50      * and we want it to be Sabre_CalDAV_Plugin::CALENDAR_ROOT
51      *
52      * @return string
53      */
54     public function getName() {
55
56         return Sabre_CalDAV_Plugin::CALENDAR_ROOT;
57
58     }
59
60     /**
61      * This method returns a node for a principal.
62      *
63      * The passed array contains principal information, and is guaranteed to
64      * at least contain a uri item. Other properties may or may not be
65      * supplied by the authentication backend.
66      *
67      * @param array $principal
68      * @return Sabre_DAV_INode
69      */
70     public function getChildForPrincipal(array $principal) {
71
72         return new Sabre_CalDAV_UserCalendars($this->principalBackend, $this->caldavBackend, $principal['uri']);
73
74     }
75
76 }