3035bcac64afc4238ac27e6d95ac17277411308e
[GitHub/WoltLab/woltlab.github.io.git] /
1 <?php
2
3 namespace wcf\system\user\activity\event;
4
5 use wcf\data\person\information\PersonInformationList;
6 use wcf\system\SingletonFactory;
7 use wcf\system\WCF;
8
9 /**
10 * User activity event implementation for person information.
11 *
12 * @author Matthias Schmidt
13 * @copyright 2001-2021 WoltLab GmbH
14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
15 * @package WoltLabSuite\Core\System\User\Activity\Event
16 */
17 class PersonInformationUserActivityEvent extends SingletonFactory implements IUserActivityEvent
18 {
19 /**
20 * @inheritDoc
21 */
22 public function prepare(array $events)
23 {
24 $objectIDs = \array_column($events, 'objectID');
25
26 $informationList = new PersonInformationList();
27 $informationList->setObjectIDs($objectIDs);
28 $informationList->readObjects();
29 $information = $informationList->getObjects();
30
31 foreach ($events as $event) {
32 if (isset($information[$event->objectID])) {
33 $personInformation = $information[$event->objectID];
34
35 $event->setIsAccessible();
36 $event->setTitle(
37 WCF::getLanguage()->getDynamicVariable(
38 'wcf.user.profile.recentActivity.personInformation',
39 [
40 'person' => $personInformation->getPerson(),
41 'personInformation' => $personInformation,
42 ]
43 )
44 );
45 $event->setDescription($personInformation->getFormattedExcerpt());
46 }
47 }
48 }
49 }