2namespace Bitrix\SocialNetwork\Integration\UI\EntitySelector;
4use Bitrix\Main\Entity\Query;
5use Bitrix\Main\Entity\Query\Join;
6use Bitrix\Main\Entity\ReferenceField;
7use Bitrix\Main\Localization\Loc;
8use Bitrix\SocialNetwork\EO_WorkgroupTag ;
9use Bitrix\SocialNetwork\EO_WorkgroupTag_Collection ;
10use Bitrix\Socialnetwork\UserToGroupTable;
11use Bitrix\Socialnetwork\WorkgroupTable;
12use Bitrix\Socialnetwork\WorkgroupTagTable;
13use Bitrix\UI\EntitySelector\BaseProvider;
14use Bitrix\UI\EntitySelector\Dialog;
15use Bitrix\UI\EntitySelector\Item;
16use Bitrix\UI\EntitySelector\RecentItem;
17use Bitrix\UI\EntitySelector\SearchQuery;
18use Bitrix\UI\EntitySelector\Tab;
27 private static $entityId =
'project-tag';
28 private static $maxCount = 100;
32 parent::__construct();
34 $this->options[
'groupId'] =
$options[
'groupId'];
39 return $GLOBALS[
'USER']->isAuthorized();
66 $query = WorkgroupTagTable::query();
67 $query->setSelect([
'NAME',
'GROUP_ID']);
74 if (!empty(
$options[
'searchQuery'] ??
null) && is_string(
$options[
'searchQuery']))
78 ->registerRuntimeField(
82 WorkgroupTable::getEntity(),
83 Join::on(
'this.GROUP_ID',
'ref.ID'),
84 [
'join_type' =>
'left']
87 ->registerRuntimeField(
91 UserToGroupTable::getEntity(),
92 Join::on(
'this.GROUP_ID',
'ref.GROUP_ID'),
93 [
'join_type' =>
'left']
99 ->where(
'G.VISIBLE',
'Y')
102 ->whereNotNull(
'UG.ID')
103 ->whereIn(
'UG.ROLE', UserToGroupTable::getRolesMember())
106 ->whereLike(
'NAME',
"{$options['searchQuery']}%")
110 return $query->exec()->fetchCollection();
126 foreach ($tags as $tag)
143 'id' => $tag->getName(),
144 'entityId' => self::$entityId,
145 'title' => $tag->getName(),
163 'title' => Loc::getMessage(
'SOCNET_ENTITY_SELECTOR_PROJECT_TAG_TAB_TITLE'),
178 $this->fillWithRecentTags($dialog);
182 private function fillWithRecentTags(
Dialog $dialog): void
185 foreach ($recentItems as $item)
193 $name = (string)$item->getId();
197 'entityId' => self::$entityId,
__construct(array $options=[])
static makeItem(EO_WorkgroupTag $tag, array $options=[])
getTagItems(array $options=[])
makeTagItems(EO_WorkgroupTag_Collection $tags, array $options=[])
fillDialog(Dialog $dialog)
static getTags(array $options=[])
getTagCollection(array $options=[])
static makeItems(EO_WorkgroupTag_Collection $tags, array $options=[])
getSelectedItems(array $ids)
doSearch(SearchQuery $searchQuery, Dialog $dialog)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
$GLOBALS['_____370096793']