• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/volume/module/crm.php
  • Класс: BitrixDiskVolumeModuleCrm
  • Вызов: Crm::getMeasurementFolderResult
public function getMeasurementFolderResult($collectedData = [])
{
	$resultList = [];

	$totalSize = 0;
	$storageList = $this->getStorageList();
	if (count($storageList) > 0)
	{
		foreach ($storageList as $storage)
		{
			$folders = $this->getFolderList($storage);
			$folderIds = [];
			foreach ($folders as $folder)
			{
				$folderIds[] = $folder->getId();
			}

			$agr = new VolumeFolderTree();
			$agr
				->setOwner($this->getOwner())
				->addFilter('=STORAGE_ID', $storage->getId())
				->addFilter('@FOLDER_ID', $folderIds)
				->loadTotals();

			if ($agr->getTotalCount() > 0)
			{
				$result = $agr->getMeasurementResult();

				foreach ($result as $row)
				{
					$resultList[] = $row;
					$totalSize += $row['FILE_SIZE'];
				}
			}
		}
	}
	if ($totalSize > 0)
	{
		foreach ($resultList as $id => $row)
		{
			$percent = $row['FILE_SIZE'] * 100 / $totalSize;
			$resultList[$id]['PERCENT'] = round($percent, 1);
		}
	}

	return $resultList;
}