1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
userfieldassembler.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\Grid\Row\Assembler\Field;
4
5use Bitrix\Main\Grid\Row\FieldAssembler;
6use Bitrix\Main\UserTable;
7use CSite;
8use CUser;
9
14{
15 private array $userCache = [];
16
26 protected function loadUserName(int $userId): string
27 {
28 $nameFormat = CSite::GetNameFormat();
29
30 $row = UserTable::getRow([
31 'select' => [
32 'ID',
33 'LOGIN',
34 'NAME',
35 'LAST_NAME',
36 'SECOND_NAME',
37 'EMAIL',
38 'TITLE',
39 ],
40 'filter' => [
41 '=ID' => $userId,
42 ],
43 ]);
44 if ($row)
45 {
46 return CUser::FormatName($nameFormat, $row, true, true);
47 }
48
49 return '';
50 }
51
59 private function getUserName(int $userId): ?string
60 {
61 if (!isset($this->userCache[$userId]))
62 {
63 $this->userCache[$userId] = $this->loadUserName($userId);
64 }
65
66 return $this->userCache[$userId];
67 }
68
74 protected function prepareColumn($value)
75 {
76 if (isset($value) && is_numeric($value))
77 {
78 $value = (int)$value;
79 if ($value > 0)
80 {
81 return $this->getUserName($value);
82 }
83 }
84
85 return null;
86 }
87}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static getRow(array $parameters)
Определения datamanager.php:398
$nameFormat
Определения discount_coupon_list.php:278
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804