PublicCalendarRoot.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Georg Ehrke <oc.list@georgehrke.com>
  7. * @author Lukas Reschke <lukas@statuscode.ch>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. * @author Thomas Citharel <nextcloud@tcit.fr>
  10. * @author Thomas Müller <thomas.mueller@tmit.eu>
  11. *
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. namespace OCA\DAV\CalDAV;
  28. use OCP\IConfig;
  29. use OCP\IL10N;
  30. use Sabre\DAV\Collection;
  31. class PublicCalendarRoot extends Collection {
  32. /** @var CalDavBackend */
  33. protected $caldavBackend;
  34. /** @var \OCP\IL10N */
  35. protected $l10n;
  36. /** @var \OCP\IConfig */
  37. protected $config;
  38. /**
  39. * PublicCalendarRoot constructor.
  40. *
  41. * @param CalDavBackend $caldavBackend
  42. * @param IL10N $l10n
  43. * @param IConfig $config
  44. */
  45. public function __construct(CalDavBackend $caldavBackend, IL10N $l10n,
  46. IConfig $config) {
  47. $this->caldavBackend = $caldavBackend;
  48. $this->l10n = $l10n;
  49. $this->config = $config;
  50. }
  51. /**
  52. * @inheritdoc
  53. */
  54. public function getName() {
  55. return 'public-calendars';
  56. }
  57. /**
  58. * @inheritdoc
  59. */
  60. public function getChild($name) {
  61. $calendar = $this->caldavBackend->getPublicCalendar($name);
  62. return new PublicCalendar($this->caldavBackend, $calendar, $this->l10n, $this->config);
  63. }
  64. /**
  65. * @inheritdoc
  66. */
  67. public function getChildren() {
  68. return [];
  69. }
  70. }