• Модуль: mobile
  • Путь к файлу: ~/bitrix/modules/mobile/lib/livefeed/helper.php
  • Класс: BitrixMobileLivefeedHelper
  • Вызов: Helper::getDiskUFDataForComments
static function getDiskUFDataForComments($inlineDiskObjectIdList = array(), $inlineDiskAttachedObjectIdList = array())
{
	$result = false;

	if (
		(
			!empty($inlineDiskObjectIdList)
			|| !empty($inlineDiskAttachedObjectIdList)
		)
		&& BitrixMainLoader::includeModule('disk')
	)
	{
		$inlineDiskAttachedObjectIdImageList = $entityAttachedObjectIdList = array();

		$filter = array(
			'=OBJECT.TYPE_FILE' => BitrixDiskTypeFile::IMAGE
		);

		$subFilter = [];
		if (!empty($inlineDiskObjectIdList))
		{
			$subFilter['@OBJECT_ID'] = $inlineDiskObjectIdList;
		}
		elseif (!empty($inlineDiskAttachedObjectIdList))
		{
			$subFilter['@ID'] = $inlineDiskAttachedObjectIdList;
		}

		if(count($subFilter) > 1)
		{
			$subFilter['LOGIC'] = 'OR';
			$filter[] = $subFilter;
		}
		else
		{
			$filter = array_merge($filter, $subFilter);
		}

		$res = BitrixDiskInternalsAttachedObjectTable::getList(array(
			'filter' => $filter,
			'select' => array('ID', 'OBJECT_ID', 'ENTITY_ID')
		));
		while ($attachedObjectFields = $res->fetch())
		{
			$inlineDiskAttachedObjectIdImageList[(int)$attachedObjectFields['ID']] = (int)$attachedObjectFields['OBJECT_ID'];
			if (!isset($entityAttachedObjectIdList[(int)$attachedObjectFields['ENTITY_ID']]))
			{
				$entityAttachedObjectIdList[(int)$attachedObjectFields['ENTITY_ID']] = array();
			}
			$entityAttachedObjectIdList[(int)$attachedObjectFields['ENTITY_ID']][] = (int)$attachedObjectFields['ID'];
		}

		$result = array(
			'ATTACHED_OBJECT_DATA' => $inlineDiskAttachedObjectIdImageList,
			'ENTITIES_DATA' => $entityAttachedObjectIdList
		);
	}

	return $result;
}