3namespace Bitrix\Socialnetwork\Integration\UI\EntitySelector;
5use Bitrix\Main\Application;
6use Bitrix\Main\DB\SqlExpression;
7use Bitrix\Main\Entity\Query;
8use Bitrix\Main\EO_User;
9use Bitrix\Main\EO_User_Collection;
10use Bitrix\Main\Localization\Loc;
11use Bitrix\UI\EntitySelector\Dialog;
12use Bitrix\UI\EntitySelector\Item;
13use Bitrix\UI\EntitySelector\Tab;
22 $this->options[
'activeUsers'] =
false;
26 $this->options[
'fieldName'] =
$options[
'fieldName'];
29 if (isset(
$options[
'referenceClass']) && is_string(
$options[
'referenceClass']))
31 $this->options[
'referenceClass'] =
$options[
'referenceClass'];
34 if (isset(
$options[
'referenceAdditionalFilter']) && is_array(
$options[
'referenceAdditionalFilter']))
36 $this->options[
'referenceAdditionalFilter'] =
$options[
'referenceAdditionalFilter'];
39 if (isset(
$options[
'referenceFieldName']) && is_string(
$options[
'referenceFieldName']))
41 $this->options[
'referenceFieldName'] =
$options[
'referenceFieldName'];
45 $this->options[
'referenceFieldName'] =
'ASSIGNED_BY_ID';
48 $this->options[
'module'] = (
54 $this->options[
'entityTypeId'] = (
69 && class_exists(
$options[
'referenceClass'])
77 $sqlHelper = Application::getConnection()->getSqlHelper();
78 $fieldName = $sqlHelper->quote(
$options[
'fieldName']);
79 $tableName = mb_strtolower(
$query->getEntity()->getCode());
82 $referenceAdditionalFilter =
$options[
'referenceAdditionalFilter'] ?? [];
83 $referenceClassTableName =
$options[
'referenceClass']::getTableName();
84 foreach ($referenceAdditionalFilter as $filterFieldName => $filterFieldValue)
86 $preparedWhere[] = $sqlHelper->prepareAssignment(
87 $referenceClassTableName,
93 $where = array_merge([
"{$fieldName} = {$tableName}.ID"], $preparedWhere);
97 .
$options[
'referenceClass']::getTableName()
98 .
" WHERE " . implode(
' AND ', $where)
101 $derivedTableQuery =
$options[
'referenceClass']::query()
102 ->addSelect(
$options[
'referenceFieldName'])
103 ->addGroup(
$options[
'referenceFieldName'])
105 $entity = \Bitrix\Main\ORM\Entity::getInstanceByQuery($derivedTableQuery);
107 $query->registerRuntimeField(
122 $event = new \Bitrix\Main\Event(
'ui',
'onFiredUserProviderQuery', [
124 'entityTypeId' =>
$options[
'entityTypeId'],
134 'LAST_ACTIVITY_DATE' =>
'desc',
136 'limit' => self::MAX_USERS_IN_RECENT_TAB,
148 parent::fillDialog($dialog);
151 if (
count($dialog->getItemCollection()->getEntityItems(
'fired-user')))
154 'data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2223%22%20height%3D%2223%22%20' .
155 'fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M11' .
156 '.934%202.213a.719.719%200%2001.719%200l3.103%201.79c.222.13.36.367.36.623V8.21a.719.71' .
157 '9%200%2001-.36.623l-3.103%201.791a.72.72%200%2001-.719%200L8.831%208.832a.719.719%200%' .
158 '2001-.36-.623V4.627c0-.257.138-.495.36-.623l3.103-1.791zM7.038%2010.605a.719.719%200%2' .
159 '001.719%200l3.103%201.792a.72.72%200%2001.359.622v3.583a.72.72%200%2001-.36.622l-3.102' .
160 '%201.792a.719.719%200%2001-.72%200l-3.102-1.791a.72.72%200%2001-.36-.623v-3.583c0-.257' .
161 '.138-.494.36-.622l3.103-1.792zM20.829%2013.02a.719.719%200%2000-.36-.623l-3.102-1.792a' .
162 '.719.719%200%2000-.72%200l-3.102%201.792a.72.72%200%2000-.36.622v3.583a.72.72%200%2000' .
163 '.36.622l3.103%201.792a.719.719%200%2000.719%200l3.102-1.791a.719.719%200%2000.36-.623v' .
164 '-3.583z%22%20fill%3D%22%23ABB1B8%22/%3E%3C/svg%3E';
166 $firedTab =
new Tab([
167 'id' =>
'fired-user',
168 'title' => Loc::getMessage(
'SOCNET_ENTITY_SELECTOR_FIREDUSER_TAB_TITLE'),
172 'selected' => str_replace(
'ABB1B8',
'fff', $icon),
177 'content' => Loc::getMessage(
'SOCNET_ENTITY_SELECTOR_FIREDUSER_FOOTER_INFO'),
179 $firedTab->setFooter(
'BX.SocialNetwork.EntitySelector.TextFooter', $footerOptions);
180 $dialog->addTab($firedTab);
189 $item->setAvailableInRecentTab(
false);
getPreloadedUsersCollection()
handleBeforeItemSave(Item $item)
prepareOptions(array $options=[])
static sendOnFiredUserProviderQueryEvent(array $options)
fillDialog(Dialog $dialog)
static getQuery(array $options=[])
static makeItem(EO_User $user, array $options=[])
getUserCollection(array $options=[])
setSaveable(bool $flag=true)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"