1<?php
2
3namespace Sabre\CalDAV;
4
5/**
6 * This object represents a CalDAV calendar that can be shared with other
7 * users.
8 *
9 * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
10 * @author Evert Pot (http://evertpot.com/)
11 * @license http://sabre.io/license/ Modified BSD License
12 */
13class ShareableCalendar extends Calendar implements IShareableCalendar {
14
15    /**
16     * Updates the list of shares.
17     *
18     * The first array is a list of people that are to be added to the
19     * calendar.
20     *
21     * Every element in the add array has the following properties:
22     *   * href - A url. Usually a mailto: address
23     *   * commonName - Usually a first and last name, or false
24     *   * summary - A description of the share, can also be false
25     *   * readOnly - A boolean value
26     *
27     * Every element in the remove array is just the address string.
28     *
29     * @param array $add
30     * @param array $remove
31     * @return void
32     */
33    function updateShares(array $add, array $remove) {
34
35        $this->caldavBackend->updateShares($this->calendarInfo['id'], $add, $remove);
36
37    }
38
39    /**
40     * Returns the list of people whom this calendar is shared with.
41     *
42     * Every element in this array should have the following properties:
43     *   * href - Often a mailto: address
44     *   * commonName - Optional, for example a first + last name
45     *   * status - See the Sabre\CalDAV\SharingPlugin::STATUS_ constants.
46     *   * readOnly - boolean
47     *   * summary - Optional, a description for the share
48     *
49     * @return array
50     */
51    function getShares() {
52
53        return $this->caldavBackend->getShares($this->calendarInfo['id']);
54
55    }
56
57    /**
58     * Marks this calendar as published.
59     *
60     * Publishing a calendar should automatically create a read-only, public,
61     * subscribable calendar.
62     *
63     * @param bool $value
64     * @return void
65     */
66    function setPublishStatus($value) {
67
68        $this->caldavBackend->setPublishStatus($this->calendarInfo['id'], $value);
69
70    }
71
72}
73