• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/log_destination.php
  • Класс: CSocNetLogDestination
  • Вызов: CSocNetLogDestination::GetLastDepartment
static function GetLastDepartment()
{
	$arLastSelected = CUserOptions::GetOption("socialnetwork", "log_destination", array());
	$arLastSelected = (
		is_array($arLastSelected)
		&& $arLastSelected['department'] <> ''
		&& $arLastSelected['department'] !== '"{}"'
			? array_reverse(CUtil::JsObjectToPhp($arLastSelected['department']))
			: array()
	);

	$count = 0;
	$arDepartment = Array();
	foreach ($arLastSelected as $depId)
	{
		if ($count < 4)
		{
			$count++;
		}
		else
		{
			break;
		}

		$arDepartment[$depId] = $depId;
	}

	return array_reverse($arDepartment);
}