You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CalDAVSettings.php 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * @copyright 2017, Georg Ehrke <oc.list@georgehrke.com>
  4. *
  5. * @author Georg Ehrke <oc.list@georgehrke.com>
  6. * @author Julius Härtl <jus@bitgrid.net>
  7. * @author Thomas Citharel <nextcloud@tcit.fr>
  8. * @author François Freitag <mail@franek.fr>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  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
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCA\DAV\Settings;
  27. use OCA\DAV\AppInfo\Application;
  28. use OCP\AppFramework\Http\TemplateResponse;
  29. use OCP\IConfig;
  30. use OCP\AppFramework\Services\IInitialState;
  31. use OCP\Settings\ISettings;
  32. class CalDAVSettings implements ISettings {
  33. /** @var IConfig */
  34. private $config;
  35. /** @var IInitialState */
  36. private $initialState;
  37. /**
  38. * CalDAVSettings constructor.
  39. *
  40. * @param IConfig $config
  41. * @param IInitialState $initialState
  42. */
  43. public function __construct(IConfig $config, IInitialState $initialState) {
  44. $this->config = $config;
  45. $this->initialState = $initialState;
  46. }
  47. public function getForm(): TemplateResponse {
  48. $defaults = [
  49. 'sendInvitations' => 'yes',
  50. 'generateBirthdayCalendar' => 'yes',
  51. 'sendEventReminders' => 'yes',
  52. 'sendEventRemindersPush' => 'no',
  53. ];
  54. foreach ($defaults as $key => $default) {
  55. $value = $this->config->getAppValue(Application::APP_ID, $key, $default);
  56. $this->initialState->provideInitialState($key, $value === 'yes');
  57. }
  58. return new TemplateResponse(Application::APP_ID, 'settings-admin-caldav');
  59. }
  60. /**
  61. * @return string
  62. */
  63. public function getSection() {
  64. return 'groupware';
  65. }
  66. /**
  67. * @return int
  68. */
  69. public function getPriority() {
  70. return 10;
  71. }
  72. }