Completed
Push — DAVclient ( 8808e7...202085 )
by Raimund
03:25
created

PageController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 5
nc 1
nop 4
1
<?php
2
/**
3
 * ownCloud - Tasks
4
 *
5
 * @author Raimund Schlüßler
6
 * @copyright 2015 Raimund Schlüßler [email protected]
7
 *
8
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
10
 * License as published by the Free Software Foundation; either
11
 * version 3 of the License, or any later version.
12
 *
13
 * This library is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public
19
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
20
 *
21
 */
22
23
namespace OCA\Tasks\Controller;
24
25
use \OCP\AppFramework\Controller;
26
use \OCP\AppFramework\Http\TemplateResponse;
27
use \OCP\IRequest;
28
use \OCP\IConfig;
29
30
/**
31
 * Controller class for main page.
32
 */
33
class PageController extends Controller {
34
35
	/**
36
	 * @param string $appName
37
	 * @param IConfig $config
38
	 */
39
	public function __construct($appName, IRequest $request,
40
								$userId, IConfig $config) {
41
		parent::__construct($appName, $request);
42
		$this->config = $config;
43
		$this->userId = $userId;
44
	}
45
46
47
	/**
48
	 * @NoAdminRequired
49
	 * @NoCSRFRequired
50
	 */
51
	public function index() {
52
53
		$day = new \DateTime('today');
54
		$day = $day->format('d');
55
56
		$appVersion = $this->config->getAppValue($this->appName, 'installed_version');
57
		$response = new TemplateResponse('tasks', 'main');
58
		$response->setParams(array(
59
			'appVersion' => $appVersion,
60
			'DOM' => $day
61
		));
62
63
		return $response;
64
	}
65
}
66