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
|
|
|
use OCA\NextNote\Service\SettingsService; |
29
|
|
|
use OCP\AppFramework\Http\TemplateResponse; |
30
|
|
|
use OCP\IL10N; |
31
|
|
|
use OCP\IURLGenerator; |
32
|
|
|
use OCP\IUserSession; |
33
|
|
|
use OCP\Settings\ISettings; |
34
|
|
|
|
35
|
|
|
class PersonalSettings implements ISettings { |
36
|
|
|
/** @var IUserSession */ |
37
|
|
|
private $userSession; |
38
|
|
|
/** @var IL10N */ |
39
|
|
|
private $l; |
40
|
|
|
/** @var IURLGenerator */ |
41
|
|
|
private $urlGenerator; |
42
|
|
|
/** @var \OC_Defaults */ |
43
|
|
|
private $defaults; |
44
|
|
|
private $settingsService; |
45
|
|
|
|
46
|
|
|
public function __construct( |
47
|
|
|
IUserSession $userSession, |
48
|
|
|
IL10N $l, |
49
|
|
|
IURLGenerator $urlGenerator, |
50
|
|
|
\OC_Defaults $defaults, |
51
|
|
|
SettingsService $settingsService |
52
|
|
|
) { |
53
|
|
|
$this->userSession = $userSession; |
54
|
|
|
$this->l = $l; |
55
|
|
|
$this->urlGenerator = $urlGenerator; |
56
|
|
|
$this->defaults = $defaults; |
57
|
|
|
$this->settingsService = $settingsService; |
58
|
|
|
} |
59
|
|
|
/** |
60
|
|
|
* @return TemplateResponse returns the instance with all parameters set, ready to be rendered |
61
|
|
|
* @since 9.1 |
62
|
|
|
*/ |
63
|
|
|
public function getForm() { |
64
|
|
|
$params = ['config' => $this->settingsService->getSettings()]; |
65
|
|
|
return new TemplateResponse('nextnote', 'settings-personal', $params, ''); |
66
|
|
|
} |
67
|
|
|
/** |
68
|
|
|
* @return string the section ID, e.g. 'sharing' |
69
|
|
|
* @since 9.1 |
70
|
|
|
*/ |
71
|
|
|
public function getSection() { |
72
|
|
|
return 'nextnote'; |
73
|
|
|
} |
74
|
|
|
/** |
75
|
|
|
* @return int whether the form should be rather on the top or bottom of |
76
|
|
|
* the admin section. The forms are arranged in ascending order of the |
77
|
|
|
* priority values. It is required to return a value between 0 and 100. |
78
|
|
|
* |
79
|
|
|
* E.g.: 70 |
80
|
|
|
* @since 9.1 |
81
|
|
|
*/ |
82
|
|
|
public function getPriority() { |
83
|
|
|
return 0; |
84
|
|
|
} |
85
|
|
|
} |