3namespace Bitrix\Iblock\Integration\UI\EntitySelector;
5use Bitrix\Iblock\Component\Tools;
6use Bitrix\UI\EntitySelector\BaseProvider;
7use Bitrix\UI\EntitySelector\Dialog;
8use Bitrix\UI\EntitySelector\Item;
9use Bitrix\UI\EntitySelector\SearchQuery;
14 private const ELEMENTS_LIMIT = 100;
18 parent::__construct();
25 return $GLOBALS[
'USER']->isAuthorized();
32 $filter = !empty($ids) ? [
'ID' => $ids] : [];
34 foreach ($this->getElements(
$filter) as $element)
36 $items[] = $this->makeItem($element);
54 $recentItems = $dialog->
getRecentItems()->getEntityItems(self::ENTITY_ID);
55 $recentItemsCount =
count($recentItems);
57 if ($recentItemsCount < self::ELEMENTS_LIMIT)
59 $elements = $this->getElements([], self::ELEMENTS_LIMIT);
60 foreach ($elements as $element)
77 $elements = $this->getElements(
$filter, self::ELEMENTS_LIMIT);
78 if (
count($elements) === self::ELEMENTS_LIMIT)
82 foreach ($elements as $element)
85 $this->makeItem($element)
95 private function getQueryFilter(
string $query):
array
102 private function getElements(
array $additionalFilter = [], ?
int $limit =
null):
array
106 $filter = $this->getDefaultFilter();
107 if (!empty($additionalFilter))
129 $elementData = \CIBlockSection::GetList(
136 while ($element = $elementData->fetch())
138 $element[
'PICTURE'] = $this->getImageSource((
int)$element[
'PICTURE']);
139 $elements[] = $element;
146 private function makeItem(
array $element): Item
149 'id' => $element[
'ID'] ??
null,
150 'entityId' => self::ENTITY_ID,
151 'title' => $element[
'NAME'] ??
null,
152 'subtitle' => $element[
'ID'] ??
null,
153 'description' => $element[
'DESCRIPTION'] ??
null,
154 'avatar' => $element[
'PICTURE'] ??
null,
156 'xmlId' => $element[
'XML_ID'] ??
null,
160 return new Item($itemParams);
163 private function getDefaultFilter():
array
166 'CHECK_PERMISSIONS' =>
'Y',
167 'MIN_PERMISSION' =>
'R',
176 $activeFilter = $this->
getOption(
'activeFilter',
false);
185 private function getImageSource(
int $id): ?string
192 $file = \CFile::GetFileArray($id);
198 return Tools::getImageSrc($file,
false) ?:
null;
__construct(array $options=[])
fillDialog(Dialog $dialog)
getPreselectedItems(array $ids)
doSearch(SearchQuery $searchQuery, Dialog $dialog)
getOption(string $option, $defaultValue=null)
loadPreselectedItems($preselectedMode=true)
addRecentItem(Item $item)
setCacheable(bool $flag=true)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
$GLOBALS['____1690880296']
</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."%"