CBPHelper::convertUserToPrintableForm

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPHelper
  4. convertUserToPrintableForm
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/helper.php
  • Класс: CBPHelper
  • Вызов: CBPHelper::convertUserToPrintableForm
static function convertUserToPrintableForm($userId, $nameTemplate = "", $htmlSpecialChars = true)
{
	if (mb_substr($userId, 0, mb_strlen("user_")) == "user_")
	{
		$userId = mb_substr($userId, mb_strlen("user_"));
	}

	if (empty($nameTemplate))
	{
		$nameTemplate = COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID);
	}

	$userId = intval($userId);

	$db = CUser::GetList(
		"LAST_NAME",
		"asc",
		["ID_EQUAL_EXACT" => $userId],
		[
			"NAV_PARAMS" => false,
			'FIELDS'=> [
				'ID',
				'LOGIN',
				'EMAIL',
				'NAME',
				'LAST_NAME',
				'SECOND_NAME'
			]
		]
	);

	$str = "";
	if ($ar = $db->Fetch())
	{
		$str = CUser::FormatName($nameTemplate, $ar, true, $htmlSpecialChars);
		$str = $str." [".$ar["ID"]."]";
		$str = str_replace(",", " ", $str);
	}

	return $str;
}

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