PublicCalendarRoot.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\DAV\CalDAV;
  8. use OCP\IConfig;
  9. use OCP\IL10N;
  10. use Psr\Log\LoggerInterface;
  11. use Sabre\DAV\Collection;
  12. class PublicCalendarRoot extends Collection {
  13. /** @var CalDavBackend */
  14. protected $caldavBackend;
  15. /** @var \OCP\IL10N */
  16. protected $l10n;
  17. /** @var \OCP\IConfig */
  18. protected $config;
  19. /** @var LoggerInterface */
  20. private $logger;
  21. /**
  22. * PublicCalendarRoot constructor.
  23. *
  24. * @param CalDavBackend $caldavBackend
  25. * @param IL10N $l10n
  26. * @param IConfig $config
  27. */
  28. public function __construct(CalDavBackend $caldavBackend, IL10N $l10n,
  29. IConfig $config, LoggerInterface $logger) {
  30. $this->caldavBackend = $caldavBackend;
  31. $this->l10n = $l10n;
  32. $this->config = $config;
  33. $this->logger = $logger;
  34. }
  35. /**
  36. * @inheritdoc
  37. */
  38. public function getName() {
  39. return 'public-calendars';
  40. }
  41. /**
  42. * @inheritdoc
  43. */
  44. public function getChild($name) {
  45. $calendar = $this->caldavBackend->getPublicCalendar($name);
  46. return new PublicCalendar($this->caldavBackend, $calendar, $this->l10n, $this->config, $this->logger);
  47. }
  48. /**
  49. * @inheritdoc
  50. */
  51. public function getChildren() {
  52. return [];
  53. }
  54. }