Completed
Push — master ( 446472...7ef246 )
by Lukas
02:50
created

Admin   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 43
ccs 0
cts 23
cp 0
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getForm() 0 14 1
A getSection() 0 3 1
A getPriority() 0 3 1
1
<?php
2
/**
3
 * @copyright Copyright (c) 2016 Lukas Reschke <[email protected]>
4
 *
5
 * @author Lukas Reschke <[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
namespace OCA\Richdocuments\Settings;
25
26
use OCP\AppFramework\Http\TemplateResponse;
27
use OCP\Defaults;
28
use OCP\IConfig;
29
use OCP\IL10N;
30
use OCP\Settings\ISettings;
31
32
class Admin implements ISettings {
33
	/** @var IConfig */
34
	private $config;
35
	/**
36
	 * @param IConfig $config
37
	 */
38
	public function __construct(IConfig $config) {
39
		$this->config = $config;
40
	}
41
	/**
42
	 * @return TemplateResponse
43
	 */
44
	public function getForm() {
45
		return new TemplateResponse(
46
			'richdocuments',
47
			'admin',
48
			[
49
				'wopi_url' => $this->config->getAppValue('richdocuments', 'wopi_url'),
50
				'edit_groups' => $this->config->getAppValue('richdocuments', 'edit_groups'),
51
				'doc_format' => $this->config->getAppValue('richdocuments', 'doc_format'),
52
				'test_wopi_url' => $this->config->getAppValue('richdocuments', 'test_wopi_url'),
53
				'test_server_groups' => $this->config->getAppValue('richdocuments', 'test_server_groups')
54
			],
55
			'blank'
56
		);
57
	}
58
	/**
59
	 * @return string the section ID, e.g. 'sharing'
60
	 */
61
	public function getSection() {
62
		return 'richdocuments';
63
	}
64
	/**
65
	 * @return int whether the form should be rather on the top or bottom of
66
	 * the admin section. The forms are arranged in ascending order of the
67
	 * priority values. It is required to return a value between 0 and 100.
68
	 *
69
	 * keep the server setting at the top, right after "server settings"
70
	 */
71
	public function getPriority() {
72
		return 0;
73
	}
74
}
75