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