• Модуль: pull
  • Путь к файлу: ~/bitrix/modules/pull/lib/mobilecounter.php
  • Класс: BitrixPullMobileCounter
  • Вызов: MobileCounter::setConfig
static function setConfig($config, $userId = null)
{
	if (!is_array($config))
	{
		return false;
	}

	if (is_null($userId) && is_object($GLOBALS['USER']))
	{
		$userId = $GLOBALS['USER']->getId();
	}
	$userId = intval($userId);
	if ($userId <= 0)
	{
		return false;
	}

	$needUpdate = false;
	$types = self::getConfig($userId);

	foreach ($config as $type => $status)
	{
		if (!isset($types[$type]))
		{
			continue;
		}
		$types[$type] = (bool)$status;
		$needUpdate = true;
	}

	if ($needUpdate)
	{
		CUserOptions::SetOption('pull', 'mobileCounterType', $types, false, $userId);
	}

	return true;
}