6 * This object is responsible for generating a list of calendar-homes for each
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
15 class Sabre_CalDAV_CalendarRootNode extends Sabre_DAVACL_AbstractPrincipalCollection {
20 * @var Sabre_CalDAV_Backend_BackendInterface
22 protected $caldavBackend;
27 * This constructor needs both an authentication and a caldav backend.
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
35 * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
36 * @param Sabre_CalDAV_Backend_BackendInterface $caldavBackend
37 * @param string $principalPrefix
39 public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend,Sabre_CalDAV_Backend_BackendInterface $caldavBackend, $principalPrefix = 'principals') {
41 parent::__construct($principalBackend, $principalPrefix);
42 $this->caldavBackend = $caldavBackend;
47 * Returns the nodename
49 * We're overriding this, because the default will be the 'principalPrefix',
50 * and we want it to be Sabre_CalDAV_Plugin::CALENDAR_ROOT
54 public function getName() {
56 return Sabre_CalDAV_Plugin::CALENDAR_ROOT;
61 * This method returns a node for a principal.
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.
67 * @param array $principal
68 * @return Sabre_DAV_INode
70 public function getChildForPrincipal(array $principal) {
72 return new Sabre_CalDAV_UserCalendars($this->principalBackend, $this->caldavBackend, $principal['uri']);