CCrmViewHelper::RenderFiles

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmViewHelper
  4. RenderFiles
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_view_helper.php
  • Класс: \CCrmViewHelper
  • Вызов: CCrmViewHelper::RenderFiles
static function RenderFiles($fileIDs, $fileUrlTemplate = '', $fileMaxWidth = 0, $fileMaxHeight = 0)
{
	if(!is_array($fileIDs))
	{
		return 0;
	}
	$fileUrlTemplate = strval($fileUrlTemplate);
	$fileMaxWidth = intval($fileMaxWidth);
	if($fileMaxWidth <= 0)
	{
		$fileMaxWidth = 350;
	}
	$fileMaxHeight = intval($fileMaxHeight);
	if($fileMaxHeight <= 350)
	{
		$fileMaxHeight = 350;
	}

	$file = new CFile();
	$processed = 0;
	foreach($fileIDs as $fileID)
	{
		$fileInfo = $file->GetFileArray($fileID);
		if (!is_array($fileInfo))
		{
			continue;
		}

		if($processed > 0)
		{
			echo '
'; } echo ''; $fileInfo['name'] = $fileInfo['ORIGINAL_NAME']; if ($file->IsImage($fileInfo['ORIGINAL_NAME'], $fileInfo['CONTENT_TYPE'])) { echo $file->ShowImage($fileInfo, $fileMaxWidth, $fileMaxHeight, '', '', true, false, 0, 0, $fileUrlTemplate); } else { echo ' $fileInfo['ID']) ) ), '">', htmlspecialcharsbx($fileInfo['ORIGINAL_NAME']).'', CFile::FormatSize($fileInfo['FILE_SIZE']).''; } echo ''; $processed++; } return $processed; }

Добавить комментарий