1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Nextcloud - namespace OCA\Nextnote |
4
|
|
|
* |
5
|
|
|
* @copyright Copyright (c) 2016, Sander Brand ([email protected]) |
6
|
|
|
* |
7
|
|
|
* @license GNU AGPL version 3 or any later version |
8
|
|
|
* |
9
|
|
|
* This program is free software: you can redistribute it and/or modify |
10
|
|
|
* it under the terms of the GNU Affero General Public License as |
11
|
|
|
* published by the Free Software Foundation, either version 3 of the |
12
|
|
|
* License, or (at your option) any later version. |
13
|
|
|
* |
14
|
|
|
* This program is distributed in the hope that it will be useful, |
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17
|
|
|
* GNU Affero General Public License for more details. |
18
|
|
|
* |
19
|
|
|
* You should have received a copy of the GNU Affero General Public License |
20
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
21
|
|
|
* |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
namespace OCA\NextNote\Settings; |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
|
29
|
|
|
use OCA\NextNote\Service\SettingsService; |
30
|
|
|
use OCP\AppFramework\Http\TemplateResponse; |
31
|
|
|
use OCP\IL10N; |
32
|
|
|
use OCP\IURLGenerator; |
33
|
|
|
use OCP\Settings\ISettings; |
34
|
|
|
class AdminSettings implements ISettings { |
35
|
|
|
|
36
|
|
|
|
37
|
|
|
/** @var IL10N */ |
38
|
|
|
private $l; |
39
|
|
|
|
40
|
|
|
/** @var IURLGenerator */ |
41
|
|
|
private $urlGenerator; |
42
|
|
|
private $settingsService; |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Admin constructor. |
47
|
|
|
* |
48
|
|
|
* @param IL10N $l |
49
|
|
|
* @param IURLGenerator $urlGenerator |
50
|
|
|
* @param SettingsService $settingsService |
51
|
|
|
*/ |
52
|
|
|
public function __construct(IL10N $l, |
53
|
|
|
IURLGenerator $urlGenerator, |
54
|
|
|
SettingsService $settingsService |
55
|
|
|
) { |
56
|
|
|
$this->l = $l; |
57
|
|
|
$this->urlGenerator = $urlGenerator; |
58
|
|
|
$this->settingsService = $settingsService; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return TemplateResponse |
63
|
|
|
*/ |
64
|
|
|
public function getForm() { |
65
|
|
|
|
66
|
|
|
$params = $this->settingsService->getSettings(); |
67
|
|
|
|
68
|
|
|
return new TemplateResponse('nextnote', 'admin', $params); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return string the section ID, e.g. 'sharing' |
73
|
|
|
*/ |
74
|
|
|
public function getSection() { |
75
|
|
|
return 'nextnote'; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @return int whether the form should be rather on the top or bottom of |
80
|
|
|
* the admin section. The forms are arranged in ascending order of the |
81
|
|
|
* priority values. It is required to return a value between 0 and 100. |
82
|
|
|
* |
83
|
|
|
* keep the server setting at the top, right after "server settings" |
84
|
|
|
*/ |
85
|
|
|
public function getPriority() { |
86
|
|
|
return 0; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
} |
90
|
|
|
|