ea22c0732176395de2b53c67f7e7ae7ee100ff92
[GitHub/WoltLab/WCF.git] /
1 <?php
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;
6 use wcf\system\WCF;
7
8 /**
9 * Handles user activity events.
10 *
11 * @author Alexander Ebert
12 * @copyright 2001-2015 WoltLab GmbH
13 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14 * @package com.woltlab.wcf
15 * @subpackage system.menu.user.profile.content
16 * @category Community Framework
17 */
18 class RecentActivityUserProfileMenuContent extends SingletonFactory implements IUserProfileMenuContent {
19 /**
20 * @see \wcf\system\menu\user\profile\content\IUserProfileMenuContent::getContent()
21 */
22 public function getContent($userID) {
23 $eventList = new ViewableUserActivityEventList();
24 $eventList->getConditionBuilder()->add("user_activity_event.userID = ?", array($userID));
25 $eventList->readObjects();
26
27 $lastEventTime = $eventList->getLastEventTime();
28 if ($lastEventTime) {
29 UserActivityEventHandler::validateEvents($eventList);
30 }
31
32 WCF::getTPL()->assign(array(
33 'eventList' => $eventList,
34 'lastEventTime' => $lastEventTime,
35 'placeholder' => WCF::getLanguage()->get('wcf.user.profile.content.recentActivity.noEntries'),
36 'userID' => $userID
37 ));
38
39 return WCF::getTPL()->fetch('recentActivities');
40 }
41
42 /**
43 * @see \wcf\system\menu\user\profile\content\IUserProfileMenuContent::isVisible()
44 */
45 public function isVisible($userID) {
46 return true;
47 }
48 }