CBPHelper::convertToSimpleGroups

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPHelper
  4. convertToSimpleGroups
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/helper.php
  • Класс: CBPHelper
  • Вызов: CBPHelper::convertToSimpleGroups
static function convertToSimpleGroups($users, $extractUsers = false)
{
	$users = (array)$users;
	$converted = [];

	foreach ($users as $user)
	{
		if (!is_scalar($user))
			continue;
		$user = mb_strtolower((string)$user);
		if (mb_strpos($user, 'group_u') === 0)
		{
			$converted[] = 'user_'.mb_substr($user, mb_strlen('group_u'));
		}
		elseif (mb_strpos($user, 'group_g') === 0)
		{
			$converted[] = mb_substr($user, mb_strlen('group_g'));
		}
		elseif (mb_strpos($user, 'group_') === 0)
		{
			if ($extractUsers)
			{
				$extracted = self::extractUsersFromExtendedGroup($user);
				if ($extracted !== false)
				{
					foreach ($extracted as $exUser)
					{
						$converted[] = 'user_'.$exUser;
					}
				}
			}
		}
		else
			$converted[] = $user;
	}
	return $converted;
}

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