source: pmb4.2/trunk/fuentes/pmb/admin/connecteurs/out/webdav/lib/Sabre/CardDAV/AddressBookRoot.php @ 815

Last change on this file since 815 was 815, checked in by jrpelegrina, 4 years ago

Initial release of pmb 4.2

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1<?php
2
3namespace Sabre\CardDAV;
4
5use Sabre\DAVACL;
6
7/**
8 * AddressBook rootnode
9 *
10 * This object lists a collection of users, which can contain addressbooks.
11 *
12 * @copyright Copyright (C) 2007-2013 Rooftop Solutions. All rights reserved.
13 * @author Evert Pot (http://www.rooftopsolutions.nl/)
14 * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
15 */
16class AddressBookRoot extends DAVACL\AbstractPrincipalCollection {
17
18    /**
19     * Principal Backend
20     *
21     * @var Sabre\DAVACL\PrincipalBackend\BackendInteface
22     */
23    protected $principalBackend;
24
25    /**
26     * CardDAV backend
27     *
28     * @var Backend\BackendInterface
29     */
30    protected $carddavBackend;
31
32    /**
33     * Constructor
34     *
35     * This constructor needs both a principal and a carddav backend.
36     *
37     * By default this class will show a list of addressbook collections for
38     * principals in the 'principals' collection. If your main principals are
39     * actually located in a different path, use the $principalPrefix argument
40     * to override this.
41     *
42     * @param DAVACL\PrincipalBackend\BackendInterface $principalBackend
43     * @param Backend\BackendInterface $carddavBackend
44     * @param string $principalPrefix
45     */
46    public function __construct(DAVACL\PrincipalBackend\BackendInterface $principalBackend,Backend\BackendInterface $carddavBackend, $principalPrefix = 'principals') {
47
48        $this->carddavBackend = $carddavBackend;
49        parent::__construct($principalBackend, $principalPrefix);
50
51    }
52
53    /**
54     * Returns the name of the node
55     *
56     * @return string
57     */
58    public function getName() {
59
60        return Plugin::ADDRESSBOOK_ROOT;
61
62    }
63
64    /**
65     * This method returns a node for a principal.
66     *
67     * The passed array contains principal information, and is guaranteed to
68     * at least contain a uri item. Other properties may or may not be
69     * supplied by the authentication backend.
70     *
71     * @param array $principal
72     * @return \Sabre\DAV\INode
73     */
74    public function getChildForPrincipal(array $principal) {
75
76        return new UserAddressBooks($this->carddavBackend, $principal['uri']);
77
78    }
79
80}
Note: See TracBrowser for help on using the repository browser.