CBPCalc::functionConvert

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPCalc
  4. functionConvert
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/calc.php
  • Класс: CBPCalc
  • Вызов: CBPCalc::functionConvert
private function functionConvert($args)
{
	if (!is_array($args))
		$args = [$args];

	$ar = $this->ArrgsToArray($args);
	$val = array_shift($ar);
	$type = array_shift($ar);
	$attr = array_shift($ar);

	$type = mb_strtolower($type);
	if ($type === 'printableuserb24')
	{
		$result = [];

		$users = CBPHelper::StripUserPrefix($val);
		if (!is_array($users))
			$users = [$users];

		foreach ($users as $userId)
		{
			$db = CUser::GetByID($userId);
			if ($ar = $db->GetNext())
			{
				$ix = randString(5);
				$attr = (!empty($attr) ? 'href="'.$attr.'"' : 'href="#" onClick="return false;"');
				$result[] = ''.CUser::FormatName(CSite::GetNameFormat(false), $ar, false).'';
			}
		}

		$result = implode(", ", $result);
	}
	elseif ($type == 'printableuser')
	{
		$result = [];

		$users = CBPHelper::StripUserPrefix($val);
		if (!is_array($users))
			$users = [$users];

		foreach ($users as $userId)
		{
			$db = CUser::GetByID($userId);
			if ($ar = $db->GetNext())
				$result[] = CUser::FormatName(CSite::GetNameFormat(false), $ar, false);
		}

		$result = implode(", ", $result);

	}
	else
	{
		$result = $val;
	}

	return $result;
}

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