Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
user.php
1<?
2
3namespace Bitrix\Main\Grid\Uf;
4
7
8class User extends Base
9{
10 protected $userFieldsReserved = [
11 'UF_DEPARTMENT',
12 'UF_USER_CRM_ENTITY',
13 'UF_PUBLIC',
14 'UF_TIMEMAN',
15 'UF_TM_REPORT_REQ',
16 'UF_TM_FREE',
17 'UF_REPORT_PERIOD',
18 'UF_1C',
19 'UF_TM_ALLOWED_DELTA',
20 'UF_SETTING_DATE',
21 'UF_LAST_REPORT_DATE',
22 'UF_DELAY_TIME',
23 'UF_TM_REPORT_DATE',
24 'UF_TM_DAY',
25 'UF_TM_TIME',
26 'UF_TM_REPORT_TPL',
27 'UF_TM_MIN_DURATION',
28 'UF_TM_MIN_FINISH',
29 'UF_TM_MAX_START',
30 'UF_CONNECTOR_MD5',
31 'UF_WORK_BINDING',
32 'UF_IM_SEARCH',
33 'UF_BXDAVEX_CALSYNC',
34 'UF_BXDAVEX_MLSYNC',
35 'UF_UNREAD_MAIL_COUNT',
36 'UF_BXDAVEX_CNTSYNC',
37 'UF_BXDAVEX_MAILBOX',
38 'UF_VI_PASSWORD',
39 'UF_VI_BACKPHONE',
40 'UF_VI_PHONE',
41 'UF_VI_PHONE_PASSWORD'
42 ];
43
44 public function __construct()
45 {
46 parent::__construct(UserTable::getUfId());
47 }
48
49 public function addUFHeaders(&$gridHeaders, $import = false)
50 {
51 $userUFList = $this->getEntityUFList();
52
53 foreach($userUFList as $FIELD_NAME => $uf)
54 {
55 if(
56 !isset($uf['SHOW_IN_LIST'])
57 || $uf['SHOW_IN_LIST'] !== 'Y'
58 || !isset($uf['EDIT_IN_LIST'])
59 || $uf['EDIT_IN_LIST'] !== 'Y'
60 )
61 {
62 continue;
63 }
64
65 $type = $uf['USER_TYPE']['BASE_TYPE'];
66
67 if (in_array($uf['USER_TYPE']['USER_TYPE_ID'], ['enumeration', 'iblock_section', 'iblock_element']))
68 {
69 $type = 'list';
70 }
71 else if ($uf['USER_TYPE']['USER_TYPE_ID'] == 'boolean')
72 {
73 $type = 'list';
74
75 //Default value must be placed at first position.
76 $defaultValue = (
77 isset($uf['SETTINGS']['DEFAULT_VALUE'])
78 ? (int)$uf['SETTINGS']['DEFAULT_VALUE']
79 : 0
80 );
81 }
82 elseif ($uf['USER_TYPE']['BASE_TYPE'] == 'datetime')
83 {
84 $type = 'date';
85 }
86 elseif (
87 $uf['USER_TYPE']['USER_TYPE_ID'] == 'crm_status'
88 && Loader::includeModule('crm')
89 )
90 {
91 $type = 'list';
92 }
93 elseif(mb_substr($uf['USER_TYPE']['USER_TYPE_ID'], 0, 5) === 'rest_')
94 {
95 // skip REST type fields here
96 continue;
97 }
98
99 if($type === 'string')
100 {
101 $type = 'text';
102 }
103 elseif(
104 $type === 'int'
105 || $type === 'double'
106 )
107 {
108 //HACK: \CMainUIGrid::prepareEditable does not recognize 'number' type
109 $type = 'int';
110 }
111
112 $gridHeaders[$FIELD_NAME] = array(
113 'id' => $FIELD_NAME,
114 'name' => htmlspecialcharsbx($uf['LIST_COLUMN_LABEL'] <> '' ? $uf['LIST_COLUMN_LABEL'] : $FIELD_NAME),
115 'sort' => $uf['MULTIPLE'] == 'N' ? $FIELD_NAME : false,
116 'default' => false,
117 'editable' => false,
118 'type' => $type
119 );
120
121 if ($import)
122 {
123 $gridHeaders[$FIELD_NAME]['mandatory'] = (
124 $uf['MANDATORY'] === 'Y'
125 ? 'Y'
126 : 'N'
127 );
128 }
129 }
130
131 }
132
133}
addUFHeaders(&$gridHeaders, $import=false)
Definition user.php:49
static includeModule($moduleName)
Definition loader.php:69
static getUfId()
Definition user.php:52