1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
MembershipProvider.php
См. документацию.
1<?php
2
3namespace Bitrix\Socialnetwork\Space\List\RecentActivity\Collector;
4
5use Bitrix\Main\Application;
6use Bitrix\Main\Localization\Loc;
7use Bitrix\Main\UserTable;
8use Bitrix\Socialnetwork\Space\List\RecentActivity\Collector\Trait\EntityLoadTrait;
9use Bitrix\Socialnetwork\Space\List\RecentActivity\Dictionary;
10
12{
13 use EntityLoadTrait;
14
15 public function isAvailable(): bool
16 {
17 return true;
18 }
19
20 public function getTypeId(): string
21 {
22 return Dictionary::ENTITY_TYPE['membership'];
23 }
24
25 protected function fill(): void
26 {
27 $userIds = $this->getEntityIdsFromRecentActivityItems();
28 $users = [];
29 if (!empty($userIds))
30 {
31 $users = UserTable::query()
32 ->setSelect(['ID', 'NAME', 'LAST_NAME'])
33 ->whereIn('ID', $userIds)
34 ->fetchAll()
35 ;
36 }
37
38 foreach ($users as $user)
39 {
40 $this->addEntity((int)$user['ID'], $user);
41 }
42
43 $culture = Application::getInstance()->getContext()->getCulture();
44 $nameFormat = is_null($culture) ? '#NAME# #LAST_NAME#' : $culture->getNameFormat();
45
46 foreach ($this->recentActivityDataItems as $item)
47 {
48 $user = $this->getEntity($item->getEntityId());
49
50 if (empty($user))
51 {
52 continue;
53 }
54
55 $name = $user['NAME'] ?? '';
56 $lastName = $user['LAST_NAME'] ?? '';
57
58 $message = Loc::getMessage(
59 'SONET_MEMBERSHIP_RECENT_ACTIVITY_DESCRIPTION',
60 [
61 '#CONTENT#' => trim(str_replace(
62 ['#NAME#', '#LAST_NAME#'],
63 [$name, $lastName],
65 ))
66 ],
67 );
68 $item->setDescription($message);
69 }
70 }
71}
$nameFormat
Определения discount_coupon_list.php:278
$culture
Определения include.php:61
$name
Определения menu_edit.php:35
$user
Определения mysql_to_pgsql.php:33
$message
Определения payment.php:8