Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
crmemailusers.php
1
<?
2
namespace
Bitrix\Socialnetwork\Integration\Main\UISelector
;
3
4
use
Bitrix\Main\Localization\Loc
;
5
use
Bitrix\Main\ModuleManager
;
6
7
class
CrmEmailUsers
extends
\Bitrix\Main\UI\Selector\EntityBase
8
{
9
public
function
getData
($params = array())
10
{
11
$result = array(
12
'ITEMS'
=> array(),
13
'ITEMS_LAST'
=> array(),
14
'ADDITIONAL_INFO'
=> array(
15
'GROUPS_LIST'
=> array(
16
'crmemailusers'
=> array(
17
'TITLE'
=>
Loc::getMessage
(
'MAIN_UI_SELECTOR_TITLE_CRM_EMAIL_USERS'
),
18
'TYPE_LIST'
=> array(
Handler::ENTITY_TYPE_CRMEMAILUSERS
),
19
'DESC_LESS_MODE'
=>
'Y'
,
20
'SORT'
=> 15
21
)
22
),
23
'SORT_SELECTED'
=> 200
24
)
25
);
26
27
if
(
28
!ModuleManager::isModuleInstalled(
'mail'
)
29
|| !ModuleManager::isModuleInstalled(
'crm'
)
30
)
31
{
32
return
$result;
33
}
34
35
$options = (!empty($params[
'options'
]) ? $params[
'options'
] : array());
36
37
$lastItems = (!empty($params[
'lastItems'
]) ? $params[
'lastItems'
] : array());
38
39
$lastUserList = array();
40
if
(!empty($lastItems[
Handler::ENTITY_TYPE_USERS
]))
41
{
42
foreach
($lastItems[
Handler::ENTITY_TYPE_USERS
] as $value)
43
{
44
$lastUserList[] = str_replace(
'U'
,
''
, $value);
45
}
46
}
47
48
if
(!empty($lastUserList))
49
{
50
$usersList = \CSocNetLogDestination::getUsers(array(
51
'id'
=> $lastUserList,
52
'CRM_ENTITY'
=> ModuleManager::isModuleInstalled(
'crm'
)
53
));
54
55
foreach
($usersList as $key => $user)
56
{
57
if
(
58
!empty($user[
'isCrmEmail'
])
59
&& $user[
'isCrmEmail'
] ==
'Y'
60
)
61
{
62
$result[
'ITEMS'
][$key] = $user;
63
$result[
"ITEMS_LAST"
][] = $key;
64
}
65
}
66
}
67
68
return
$result;
69
}
70
71
public
function
getTabList
($params = array())
72
{
73
$result = array();
74
$options = (!empty($params[
'options'
]) ? $params[
'options'
] : array());
75
76
if
(
77
isset($options[
'addTab'
])
78
&& $options[
'addTab'
] ==
'Y'
79
&& ModuleManager::isModuleInstalled(
'mail'
)
80
&& ModuleManager::isModuleInstalled(
'crm'
)
81
)
82
{
83
$result[] = array(
84
'id'
=>
'crmemailusers'
,
85
'name'
=>
Loc::getMessage
(
'MAIN_UI_SELECTOR_TAB_CRM_EMAIL_USERS'
),
86
'sort'
=> 110
87
);
88
}
89
90
return
$result;
91
}
92
93
public
function
search
($params = array())
94
{
95
$result = array(
96
'ITEMS'
=> array(),
97
'ADDITIONAL_INFO'
=> array()
98
);
99
100
$entityOptions = (!empty($params[
'options'
]) ? $params[
'options'
] : array());
101
$requestFields = (!empty($params[
'requestFields'
]) ? $params[
'requestFields'
] : array());
102
$commonOptions = (!empty($requestFields[
'options'
]) ? $requestFields[
'options'
] : array());
103
104
$search = $requestFields[
'searchString'
];
105
106
if
($entityOptions[
'allowSearchCrmEmailUsers'
] ==
'Y'
)
107
{
108
$crmEntities = \CSocNetLogDestination::searchCrmEntities(array(
109
"SEARCH"
=> $search,
110
"NAME_TEMPLATE"
=> \
Bitrix
\Socialnetwork\Integration\Main\UISelector\
Users::getNameTemplate
($commonOptions[
'userNameTemplate'
])
111
));
112
foreach
($crmEntities as $crmEntity)
113
{
114
$crmEntity[
'id'
] =
'UE'
.$crmEntity[
'email'
];
115
$result[
"ITEMS"
][$crmEntity[
'id'
]] = $crmEntity;
116
}
117
}
118
119
return
$result;
120
}
121
122
public
function
getItemName
($itemCode =
''
)
123
{
124
return \Bitrix\Socialnetwork\Integration\Main\UISelector\Users::getUserName($itemCode);
125
}
126
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ModuleManager
Definition
modulemanager.php:5
Bitrix\Main\UI\Selector\EntityBase
Definition
entitybase.php:13
Bitrix\Socialnetwork\Integration\Main\UISelector\CrmEmailUsers
Definition
crmemailusers.php:8
Bitrix\Socialnetwork\Integration\Main\UISelector\CrmEmailUsers\getData
getData($params=array())
Definition
crmemailusers.php:9
Bitrix\Socialnetwork\Integration\Main\UISelector\CrmEmailUsers\getTabList
getTabList($params=array())
Definition
crmemailusers.php:71
Bitrix\Socialnetwork\Integration\Main\UISelector\CrmEmailUsers\search
search($params=array())
Definition
crmemailusers.php:93
Bitrix\Socialnetwork\Integration\Main\UISelector\CrmEmailUsers\getItemName
getItemName($itemCode='')
Definition
crmemailusers.php:122
Bitrix\Socialnetwork\Integration\Main\UISelector\Handler\ENTITY_TYPE_USERS
const ENTITY_TYPE_USERS
Definition
handler.php:20
Bitrix\Socialnetwork\Integration\Main\UISelector\Handler\ENTITY_TYPE_CRMEMAILUSERS
const ENTITY_TYPE_CRMEMAILUSERS
Definition
handler.php:22
Bitrix\Socialnetwork\Integration\Main\UISelector\Users\getNameTemplate
static getNameTemplate($requestNameTemplate='')
Definition
users.php:11
Bitrix\Socialnetwork\Integration\Main\UISelector
Definition
crmemailusers.php:2
Bitrix
modules
socialnetwork
lib
integration
main
uiselector
crmemailusers.php
Создано системой
1.10.0