PublicCalendarRoot.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 Thomas Citharel <nextcloud@tcit.fr>
  9. * @author Thomas Müller <thomas.mueller@tmit.eu>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCA\DAV\CalDAV;
  27. use OCP\IConfig;
  28. use OCP\IL10N;
  29. use Psr\Log\LoggerInterface;
  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. /** @var LoggerInterface */
  39. private $logger;
  40. /**
  41. * PublicCalendarRoot constructor.
  42. *
  43. * @param CalDavBackend $caldavBackend
  44. * @param IL10N $l10n
  45. * @param IConfig $config
  46. */
  47. public function __construct(CalDavBackend $caldavBackend, IL10N $l10n,
  48. IConfig $config, LoggerInterface $logger) {
  49. $this->caldavBackend = $caldavBackend;
  50. $this->l10n = $l10n;
  51. $this->config = $config;
  52. $this->logger = $logger;
  53. }
  54. /**
  55. * @inheritdoc
  56. */
  57. public function getName() {
  58. return 'public-calendars';
  59. }
  60. /**
  61. * @inheritdoc
  62. */
  63. public function getChild($name) {
  64. $calendar = $this->caldavBackend->getPublicCalendar($name);
  65. return new PublicCalendar($this->caldavBackend, $calendar, $this->l10n, $this->config, $this->logger);
  66. }
  67. /**
  68. * @inheritdoc
  69. */
  70. public function getChildren() {
  71. return [];
  72. }
  73. }