• Модуль: report
  • Путь к файлу: ~/bitrix/modules/report/lib/sharing.php
  • Класс: BitrixReportSharing
  • Вызов: Sharing::getEntityOfSharing
static function getEntityOfSharing($reportId)
{
	$reportId = intval($reportId);
	$entitySharing = array();

	$cacheTime = defined('BX_COMP_MANAGED_CACHE') ? 3153600 : 3600*4;
	$cacheId = 'report-sharing-'.$reportId;
	$cacheDir = '/report/sharing/'.$reportId;
	$cache = new CPHPCache;
	if($cache->initCache($cacheTime, $cacheId, $cacheDir))
	{
		$entitySharing = $cache->getVars();
	}
	else
	{
		$cache->startDataCache();
		$result = SharingTable::getList(array(
			'select' => array('ID', 'ENTITY', 'RIGHTS'),
			'filter' => array('=REPORT_ID' => $reportId),
		));
		while($data = $result->fetch())
		{
			$entitySharing[] = array(
				'ENTITY' => $data['ENTITY'],
				'RIGHTS' => $data['RIGHTS'],
			);
		}
		$cache->endDataCache($entitySharing);
	}

	return $entitySharing;
}