Admin.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 Bjoern Schiessle <bjoern@schiessle.org>
  4. *
  5. * @license GNU AGPL version 3 or any later version
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Affero General Public License as
  9. * published by the Free Software Foundation, either version 3 of the
  10. * License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. namespace OCA\ShareByMail\Settings;
  22. use OCP\AppFramework\Http\TemplateResponse;
  23. use OCP\Settings\ISettings;
  24. class Admin implements ISettings {
  25. /** @var SettingsManager */
  26. private $settingsManager;
  27. public function __construct(SettingsManager $settingsManager) {
  28. $this->settingsManager = $settingsManager;
  29. }
  30. /**
  31. * @return TemplateResponse
  32. */
  33. public function getForm() {
  34. $parameters = [
  35. 'sendPasswordMail' => $this->settingsManager->sendPasswordByMail(),
  36. 'enforcePasswordProtection' => $this->settingsManager->enforcePasswordProtection()
  37. ];
  38. return new TemplateResponse('sharebymail', 'settings-admin', $parameters, '');
  39. }
  40. /**
  41. * @return string the section ID, e.g. 'sharing'
  42. */
  43. public function getSection() {
  44. return 'sharing';
  45. }
  46. /**
  47. * @return int whether the form should be rather on the top or bottom of
  48. * the admin section. The forms are arranged in ascending order of the
  49. * priority values. It is required to return a value between 0 and 100.
  50. *
  51. * E.g.: 70
  52. */
  53. public function getPriority() {
  54. return 40;
  55. }
  56. }