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