Completed
Pull Request — master (#1641)
by Raimund
01:47 queued 26s
created

TasksWidget::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * @copyright Copyright (c) 2021 Jakob Röhrl <[email protected]>
6
 *
7
 * @author Jakob Röhrl <[email protected]>
8
 *
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
26
namespace OCA\Tasks\Dashboard;
27
28
use OCA\Tasks\AppInfo\Application;
29
use OCA\Tasks\Service\CollectionsService;
30
use OCP\Dashboard\IWidget;
31
use OCP\IInitialStateService;
32
use OCP\IL10N;
33
34
class TasksWidget implements IWidget {
35
36
	/**
37
	 * @var IL10N
38
	 */
39
	private $l10n;
40
41
	/**
42
	 * @var IInitialStateService
43
	 */
44
	private $initialStateService;
45
46
	/**
47
	 * @var CollectionsService
48
	 */
49
	private $dataService;
50
51
	/**
52
	 * CalendarWidget constructor.
53
	 * @param IL10N $l10n
54
	 * @param IInitialStateService $initialStateService
55
	 * @param CollectionsService $dataService
56
	 */
57
	public function __construct(IL10N $l10n,
58
								IInitialStateService $initialStateService,
59
								CollectionsService $dataService) {
60
		$this->l10n = $l10n;
61
		$this->initialStateService = $initialStateService;
62
		$this->dataService = $dataService;
63
	}
64
65
	/**
66
	 * @inheritDoc
67
	 */
68
	public function getId(): string {
69
		return Application::APP_ID;
70
	}
71
72
	/**
73
	 * @inheritDoc
74
	 */
75
	public function getTitle(): string {
76
		return $this->l10n->t('Upcoming tasks');
77
	}
78
79
	/**
80
	 * @inheritDoc
81
	 */
82
	public function getOrder(): int {
83
		return 20;
84
	}
85
86
	/**
87
	 * @inheritDoc
88
	 */
89
	public function getIconClass(): string {
90
		return 'icon-tasks';
91
	}
92
93
	/**
94
	 * @inheritDoc
95
	 */
96
	public function getUrl(): ?string {
97
		return null;
98
	}
99
100
	/**
101
	 * @inheritDoc
102
	 */
103
	public function load(): void {
104
		\OCP\Util::addScript('tasks', 'tasks-dashboard');
105
106
		// $this->initialStateService->provideLazyInitialState(Application::APP_ID, 'dashboard', function () {
107
		// 	return $this->dataService;
108
		// });
109
	}
110
}
111