99a275e28df43f6cfd610d42f45456bfa633e8be
[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-2016 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
15 */
16 class RecentActivityUserProfileMenuContent extends SingletonFactory implements IUserProfileMenuContent {
17 /**
18 * @inheritDoc
19 */
20 public function getContent($userID) {
21 $eventList = new ViewableUserActivityEventList();
22 $eventList->getConditionBuilder()->add("user_activity_event.userID = ?", [$userID]);
23 $eventList->readObjects();
24
25 $lastEventTime = $eventList->getLastEventTime();
26 if ($lastEventTime) {
27 UserActivityEventHandler::validateEvents($eventList);
28 }
29
30 WCF::getTPL()->assign([
31 'eventList' => $eventList,
32 'lastEventTime' => $lastEventTime,
33 'placeholder' => WCF::getLanguage()->get('wcf.user.profile.content.recentActivity.noEntries'),
34 'userID' => $userID
35 ]);
36
37 return WCF::getTPL()->fetch('recentActivities');
38 }
39
40 /**
41 * @inheritDoc
42 */
43 public function isVisible($userID) {
44 return true;
45 }
46 }