blob: 5e4e83920ad58866cb415c3b67eab994ec0ae5ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
<?php
namespace OCA\News\Settings;
use OCA\News\AppInfo\Application;
use OCA\News\Service\StatusService;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\Settings\ISettings;
use OCP\AppFramework\Services\IInitialState;
class AdminSettings implements ISettings
{
/**
* @var IConfig
*/
private $config;
/** @var IInitialState */
private $initialState;
/** @var StatusService */
private $service;
public function __construct(IConfig $config, IInitialState $initialState, StatusService $service)
{
$this->config = $config;
$this->initialState = $initialState;
$this->service = $service;
}
public function getForm()
{
foreach (array_keys(Application::DEFAULT_SETTINGS) as $setting) {
$this->initialState->provideInitialState($setting, $this->config->getAppValue(
Application::NAME,
$setting,
(string)Application::DEFAULT_SETTINGS[$setting]
));
}
if ($this->service->isCronProperlyConfigured()) {
$lastUpdate = $this->service->getUpdateTime();
} else {
$lastUpdate = 0;
}
$this->initialState->provideInitialState("lastCron", $lastUpdate);
return new TemplateResponse(Application::NAME, 'admin', []);
}
public function getSection()
{
return 'news';
}
public function getPriority()
{
return 40;
}
}
|