2 declare(strict_types=1);
3 namespace wcf\system\menu\user\profile\content;
4 use wcf\data\user\activity\event\ViewableUserActivityEventList;
5 use wcf\system\user\activity\event\UserActivityEventHandler;
6 use wcf\system\SingletonFactory;
10 * Handles user activity events.
12 * @author Alexander Ebert
13 * @copyright 2001-2018 WoltLab GmbH
14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
15 * @package WoltLabSuite\Core\System\Menu\User\Profile\Content
17 class RecentActivityUserProfileMenuContent extends SingletonFactory implements IUserProfileMenuContent {
21 public function getContent($userID) {
22 $eventList = new ViewableUserActivityEventList();
24 // load more items than necessary to avoid empty list if some items are invisible for current user
25 $eventList->sqlLimit = 60;
27 $eventList->getConditionBuilder()->add("user_activity_event.userID = ?", [$userID]);
28 $eventList->readObjects();
30 UserActivityEventHandler::validateEvents($eventList);
32 // remove unused items
33 $eventList->truncate(20);
35 WCF::getTPL()->assign([
36 'eventList' => $eventList,
37 'lastEventTime' => $eventList->getLastEventTime(),
38 'placeholder' => WCF::getLanguage()->get('wcf.user.profile.content.recentActivity.noEntries'),
42 return WCF::getTPL()->fetch('recentActivities');
48 public function isVisible($userID) {