1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* ownCloud - Tasks |
4
|
|
|
* |
5
|
|
|
* @author Raimund Schlüßler |
6
|
|
|
* @copyright 2017 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\AppFramework\Http\NotFoundResponse; |
28
|
|
|
use \OCP\IRequest; |
29
|
|
|
use \OCP\IConfig; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Controller class for main page. |
33
|
|
|
*/ |
34
|
|
|
class PageController extends Controller { |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param string $appName |
38
|
|
|
* @param IConfig $config |
39
|
|
|
*/ |
40
|
|
|
public function __construct($appName, IRequest $request, |
41
|
|
|
$userId, IConfig $config) { |
42
|
|
|
parent::__construct($appName, $request); |
43
|
|
|
$this->config = $config; |
44
|
|
|
$this->userId = $userId; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @NoAdminRequired |
50
|
|
|
* @NoCSRFRequired |
51
|
|
|
*/ |
52
|
|
|
public function index() { |
53
|
|
|
|
54
|
|
|
$day = new \DateTime('today'); |
55
|
|
|
$day = $day->format('d'); |
56
|
|
|
|
57
|
|
|
$appVersion = $this->config->getAppValue($this->appName, 'installed_version'); |
58
|
|
|
$response = new TemplateResponse('tasks', 'main'); |
59
|
|
|
$response->setParams(array( |
60
|
|
|
'appVersion' => $appVersion, |
61
|
|
|
'DOM' => $day |
62
|
|
|
)); |
63
|
|
|
|
64
|
|
|
return $response; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @NoAdminRequired |
70
|
|
|
* @NoCSRFRequired |
71
|
|
|
*/ |
72
|
|
|
public function templates($template) { |
73
|
|
|
$templates = array( 'confirmation'); |
74
|
|
|
if (in_array($template, $templates)) { |
75
|
|
|
$response = new TemplateResponse('tasks', $template, [], 'blank'); |
76
|
|
|
} else { |
77
|
|
|
$response = new NotFoundResponse(); |
78
|
|
|
} |
79
|
|
|
return $response; |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|