|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author Joas Schilling <[email protected]> |
|
4
|
|
|
* |
|
5
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc. |
|
6
|
|
|
* @license AGPL-3.0 |
|
7
|
|
|
* |
|
8
|
|
|
* This code is free software: you can redistribute it and/or modify |
|
9
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
|
10
|
|
|
* as published by the Free Software Foundation. |
|
11
|
|
|
* |
|
12
|
|
|
* This program is distributed in the hope that it will be useful, |
|
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
* GNU Affero General Public License for more details. |
|
16
|
|
|
* |
|
17
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
|
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
|
19
|
|
|
* |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace OCA\Activity\Controller; |
|
23
|
|
|
|
|
24
|
|
|
use OC\Files\View; |
|
25
|
|
|
use OCA\Activity\Data; |
|
26
|
|
|
use OCA\Activity\Exception\InvalidFilterException; |
|
27
|
|
|
use OCA\Activity\GroupHelper; |
|
28
|
|
|
use OCA\Activity\Navigation; |
|
29
|
|
|
use OCA\Activity\UserSettings; |
|
30
|
|
|
use OCA\Activity\ViewInfoCache; |
|
31
|
|
|
use OCP\AppFramework\Controller; |
|
32
|
|
|
use OCP\AppFramework\Http\JSONResponse; |
|
33
|
|
|
use OCP\AppFramework\Http\TemplateResponse; |
|
34
|
|
|
use OCP\Files; |
|
35
|
|
|
use OCP\Files\IMimeTypeDetector; |
|
36
|
|
|
use OCP\IConfig; |
|
37
|
|
|
use OCP\IDateTimeFormatter; |
|
38
|
|
|
use OCP\IPreview; |
|
39
|
|
|
use OCP\IRequest; |
|
40
|
|
|
use OCP\IURLGenerator; |
|
41
|
|
|
use OCP\Template; |
|
42
|
|
|
|
|
43
|
|
|
class Activities extends Controller { |
|
44
|
|
|
|
|
45
|
|
|
/** @var \OCA\Activity\Data */ |
|
46
|
|
|
protected $data; |
|
47
|
|
|
|
|
48
|
|
|
/** @var \OCA\Activity\Navigation */ |
|
49
|
|
|
protected $navigation; |
|
50
|
|
|
|
|
51
|
|
|
/** @var \OCP\IConfig */ |
|
52
|
|
|
protected $config; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* constructor of the controller |
|
56
|
|
|
* |
|
57
|
|
|
* @param string $appName |
|
58
|
|
|
* @param IRequest $request |
|
59
|
|
|
* @param IConfig $config |
|
60
|
|
|
* @param Data $data |
|
61
|
|
|
* @param Navigation $navigation |
|
62
|
|
|
*/ |
|
63
|
2 |
|
public function __construct($appName, |
|
64
|
|
|
IRequest $request, |
|
65
|
|
|
IConfig $config, |
|
66
|
|
|
Data $data, |
|
67
|
|
|
Navigation $navigation) { |
|
68
|
2 |
|
parent::__construct($appName, $request); |
|
69
|
2 |
|
$this->data = $data; |
|
70
|
2 |
|
$this->config = $config; |
|
71
|
2 |
|
$this->navigation = $navigation; |
|
72
|
2 |
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @NoAdminRequired |
|
76
|
|
|
* @NoCSRFRequired |
|
77
|
|
|
* |
|
78
|
|
|
* @param string $filter |
|
79
|
|
|
* @return TemplateResponse |
|
80
|
|
|
*/ |
|
81
|
1 |
|
public function showList($filter = 'all') { |
|
82
|
1 |
|
$filter = $this->data->validateFilter($filter); |
|
83
|
|
|
|
|
84
|
1 |
|
return new TemplateResponse('activity', 'stream.body', [ |
|
85
|
1 |
|
'appNavigation' => $this->navigation->getTemplate($filter), |
|
86
|
1 |
|
'avatars' => $this->config->getSystemValue('enable_avatars', true) ? 'yes' : 'no', |
|
87
|
1 |
|
'filter' => $filter, |
|
88
|
|
|
]); |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|