ShareableCalendar.php 2.0 KB

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