• Модуль: rpa
  • Путь к файлу: ~/bitrix/modules/rpa/lib/components/itemlist.php
  • Класс: BitrixRpaComponentsItemList
  • Вызов: ItemList::init
protected function init(): void
{
	parent::init();
	if($this->getErrors())
	{
		return;
	}

	$typeId = (int) $this->arParams['typeId'];
	if($typeId > 0)
	{
		$this->type = Driver::getInstance()->getType($typeId);
	}
	if(!$this->type)
	{
		$this->errorCollection[] = new BitrixMainError(Loc::getMessage('RPA_NOT_FOUND_ERROR'));
		return;
	}

	$this->display = new Display($this->type);

	if(!Driver::getInstance()->getUserPermissions()->canViewType($this->type->getId()))
	{
		$this->errorCollection[] = new BitrixMainError(Loc::getMessage('RPA_ACCESS_DENIED'));
		return;
	}

	if(!$this->getErrors())
	{
		$director = Driver::getInstance()->getDirector();
		$scenarios = $director->getScenariosForType($this->type);
		if($scenarios->count() > 0)
		{
			$result = $scenarios->playAll();
			if(!$result->isSuccess())
			{
				$this->errorCollection->add($result->getErrors());
			}
			else
			{
				$resultData = $result->getData();
				if(isset($resultData['eventIds']) && is_array($resultData['eventIds']))
				{
					$this->eventIds = array_merge($this->eventIds, $resultData['eventIds']);
				}
			}
		}
	}

	if(!$this->getErrors())
	{
		$this->setLastVisitedTypeId($this->getTypeId());
	}

	$settings = new FilterItemSettings([
		'ID' => $this->getFilterId(),
	], $this->type);

	$this->itemProvider = new FilterItemProvider($settings);
	$this->itemUfProvider = new FilterItemUfProvider($settings);

	$this->filter = new BitrixMainFilterFilter($settings->getID(), $this->itemProvider, [$this->itemUfProvider]);
}