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