Merge branch '3.0'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / page / RecentActivityListPage.class.php
CommitLineData
320f4a6d
MW
1<?php
2namespace wcf\page;
3use wcf\data\user\activity\event\ViewableUserActivityEventList;
ac4ff35d 4use wcf\system\page\PageLocationManager;
6791cfbc 5use wcf\system\request\LinkHandler;
320f4a6d
MW
6use wcf\system\user\activity\event\UserActivityEventHandler;
7use wcf\system\WCF;
8
9/**
10 * Shows the global recent activity list page.
11 *
12 * @author Marcel Werk
c839bd49 13 * @copyright 2001-2018 WoltLab GmbH
320f4a6d 14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
e71525e4 15 * @package WoltLabSuite\Core\Page
320f4a6d
MW
16 */
17class RecentActivityListPage extends AbstractPage {
320f4a6d
MW
18 /**
19 * viewable user activity event list
ac4ff35d 20 * @var ViewableUserActivityEventList
320f4a6d
MW
21 */
22 public $eventList = null;
23
6791cfbc
MW
24 /**
25 * @inheritDoc
26 */
27 public function readParameters() {
28 parent::readParameters();
29
30 $this->canonicalURL = LinkHandler::getInstance()->getLink('RecentActivityList');
31 }
32
320f4a6d 33 /**
ac4ff35d 34 * @inheritDoc
320f4a6d
MW
35 */
36 public function readData() {
37 parent::readData();
38
39 $this->eventList = new ViewableUserActivityEventList();
b91831d6
MW
40
41 // load more items than necessary to avoid empty list if some items are invisible for current user
42 $this->eventList->sqlLimit = 60;
43
320f4a6d
MW
44 $this->eventList->readObjects();
45
46 // add breadcrumbs
ac4ff35d 47 if (MODULE_MEMBERS_LIST) PageLocationManager::getInstance()->addParentLocation('com.woltlab.wcf.MembersList');
320f4a6d
MW
48 }
49
50 /**
ac4ff35d 51 * @inheritDoc
320f4a6d
MW
52 */
53 public function assignVariables() {
54 parent::assignVariables();
55
b2aa772d 56 // removes orphaned and non-accessible events
320f4a6d
MW
57 UserActivityEventHandler::validateEvents($this->eventList);
58
b91831d6
MW
59 // remove unused items
60 $this->eventList->truncate(20);
2df9068b 61
ac4ff35d 62 WCF::getTPL()->assign([
320f4a6d 63 'eventList' => $this->eventList,
92608257 64 'lastEventTime' => $this->eventList->getLastEventTime()
ac4ff35d 65 ]);
320f4a6d
MW
66 }
67}