CCrmViewHelper::PrepareFormResponsible

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmViewHelper
  4. PrepareFormResponsible
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_view_helper.php
  • Класс: \CCrmViewHelper
  • Вызов: CCrmViewHelper::PrepareFormResponsible
static function PrepareFormResponsible($userID, $nameTemplate, $userProfileUrlTemplate)
{
	$userID = (int)$userID;
	if($userID <= 0)
	{
		return '';
	}


	$dbUsers = CUser::GetList(
		'id', 'asc',
		array('ID' => $userID),
		array('FIELDS' =>  array('ID', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'LOGIN', 'TITLE', 'EMAIL', 'PERSONAL_PHOTO'))
	);

	$user = $dbUsers->Fetch();
	if(!is_array($user))
	{
		return '';
	}

	$name = CUser::FormatName(
		$nameTemplate,
		$user,
		true,
		true
	);

	$photoID = isset($user['PERSONAL_PHOTO']) ? intval($user['PERSONAL_PHOTO']) : 0;
	$photoUrl = '';
	if($photoID > 0)
	{
		$photoInfo = CFile::ResizeImageGet(
			$photoID,
			array('width' => 38, 'height' => 38),
			BX_RESIZE_IMAGE_EXACT
		);
		$photoUrl = is_array($photoInfo) ? $photoInfo['src'] : '';
	}

	$showUrl = $userID > 0 && $userProfileUrlTemplate !== '' ? str_replace('#user_id#', $userID, $userProfileUrlTemplate) : '#';

	return "
\"\"
{$name}
"; }

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