1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Nextcloud - OCR |
5
|
|
|
* |
6
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
7
|
|
|
* later. See the COPYING file. |
8
|
|
|
* |
9
|
|
|
* @author Janis Koehr <[email protected]> |
10
|
|
|
* @copyright Janis Koehr 2017 |
11
|
|
|
*/ |
12
|
|
|
namespace OCA\Ocr\Settings; |
13
|
|
|
|
14
|
|
|
use OCP\Settings\ISettings; |
15
|
|
|
use OCP\IConfig; |
16
|
|
|
use OCP\AppFramework\Http\TemplateResponse; |
17
|
|
|
use OCA\Ocr\Constants\OcrConstants; |
18
|
|
|
|
19
|
|
|
class Admin implements ISettings { |
20
|
|
|
|
21
|
|
|
/** @var IConfig */ |
22
|
|
|
private $config; |
23
|
|
|
/** |
24
|
|
|
* |
25
|
|
|
* @param IConfig $config |
26
|
|
|
*/ |
27
|
|
|
public function __construct(IConfig $config) { |
28
|
|
|
$this->config = $config; |
29
|
|
|
} |
30
|
|
|
/** |
31
|
|
|
* |
32
|
|
|
* @return TemplateResponse |
33
|
|
|
*/ |
34
|
|
|
public function getForm() { |
35
|
|
|
return new TemplateResponse( 'ocr', 'settings-admin', [ |
36
|
|
|
OcrConstants::LANGUAGES_CONFIG_KEY => $this->config->getAppValue ( 'ocr', OcrConstants::LANGUAGES_CONFIG_KEY), |
37
|
|
|
OcrConstants::REDIS_CONFIG_KEY_HOST => $this->config->getAppValue ( 'ocr', OcrConstants::REDIS_CONFIG_KEY_HOST), |
38
|
|
|
OcrConstants::REDIS_CONFIG_KEY_PORT => $this->config->getAppValue('ocr', OcrConstants::REDIS_CONFIG_KEY_PORT), |
39
|
|
|
OcrConstants::REDIS_CONFIG_KEY_DB => $this->config->getAppValue('ocr', OcrConstants::REDIS_CONFIG_KEY_DB) |
40
|
|
|
], 'blank' ); |
41
|
|
|
} |
42
|
|
|
/** |
43
|
|
|
* |
44
|
|
|
* @return string the section ID, e.g. 'sharing' |
45
|
|
|
*/ |
46
|
|
|
public function getSection() { |
47
|
|
|
return 'ocr'; |
48
|
|
|
} |
49
|
|
|
/** |
50
|
|
|
* |
51
|
|
|
* @return int whether the form should be rather on the top or bottom of |
52
|
|
|
* the admin section. The forms are arranged in ascending order of the |
53
|
|
|
* priority values. It is required to return a value between 0 and 100. |
54
|
|
|
* |
55
|
|
|
* keep the server setting at the top, right after "server settings" |
56
|
|
|
*/ |
57
|
|
|
public function getPriority() { |
58
|
|
|
return 0; |
59
|
|
|
} |
60
|
|
|
} |