CCrmProductFileControl::GetHTML

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmProductFileControl
  4. GetHTML
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_product_file.php
  • Класс: \CCrmProductFileControl
  • Вызов: CCrmProductFileControl::GetHTML
function GetHTML($params)
{
	$html = '';

	$max_size = 102400;
	$max_width = 150;
	$max_height = 150;
	$url_template = '';
	$show_input = true;
	$show_info = true;

	if(is_array($params))
	{
		if(isset($params['max_size']))
			$max_size = intval($params['max_size']);
		if(isset($params['max_width']))
			$max_width = intval($params['max_width']);
		if(isset($params['max_height']))
			$max_height = intval($params['max_height']);
		if(isset($params['url_template']))
			$url_template = $params['url_template'];
		if(isset($params['show_input']))
			$show_input = (bool)$params['show_input'];
		if(isset($params['show_info']))
			$show_info = (bool)$params['show_info'];
	}

	if($show_input)
	{
		$html .= $this->_ob_file->GetInputHTML(array(
			'show_info' => true,
			'url_template' => $url_template,
			'input_name' => $this->_input_name,
		));
	}
	elseif($show_info)
	{
		$html .= $this->_ob_file->GetInfoHTML(array(
			'url_template' => $url_template,
		));
	}

	if($this->_ob_file->IsImage() && $this->_ob_file->GetSize()/* < $max_size*/)
	{
		$img_src = CHTTP::urlAddParams(
			$this->_ob_file->GetImgSrc(array('url_template'=>$url_template)),
			array('ncc' => '1')
		);
		CUtil::InitJSCore(array("viewer"));
		self::$_counter++;
		$divId = 'lists-image-' . self::$_counter;

		$html .= '
'; $html .= $this->_ob_file->GetImgHtml(array( 'url_template' => $url_template, 'max_width' => $max_width, 'max_height' => $max_height, 'html_attributes' => array( 'border' => '0', 'data-bx-image' => $img_src ), )); $html .= '
'; } $html .= $this->_ob_file->GetLinkHtml(array( 'url_template' => $url_template, 'download_text' => $params['download_text'], )); return $html; }

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