- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/lib/componenthelper.php
- Класс: BitrixSocialnetworkComponentHelper
- Вызов: ComponentHelper::getBlogPostDestinations
static function getBlogPostDestinations($postId)
{
if (isset(self::$destinationsCache[$postId]))
{
$result = self::$destinationsCache[$postId];
}
else
{
$result = [];
if (!Loader::includeModule('blog'))
{
throw new MainSystemException("Could not load 'blog' module.");
}
$sonetPermission = CBlogPost::getSocnetPermsName($postId);
if (!empty($sonetPermission))
{
foreach ($sonetPermission as $typeCode => $type)
{
foreach ($type as $destination)
{
$name = false;
if ($typeCode === "SG")
{
if ($sonetGroup = CSocNetGroup::getByID($destination["ENTITY_ID"]))
{
$name = $sonetGroup["NAME"];
}
}
elseif ($typeCode === "U")
{
if(in_array("US" . $destination["ENTITY_ID"], $destination["ENTITY"], true))
{
$name = "#ALL#";
Loader::includeModule('intranet');
}
else
{
$name = CUser::formatName(
CSite::getNameFormat(false),
[
"NAME" => $destination["~U_NAME"],
"LAST_NAME" => $destination["~U_LAST_NAME"],
"SECOND_NAME" => $destination["~U_SECOND_NAME"],
"LOGIN" => $destination["~U_LOGIN"]
],
true
);
}
}
elseif ($typeCode === "DR")
{
$name = $destination["EL_NAME"];
}
if ($name)
{
$result[] = $name;
}
}
}
}
self::$destinationsCache[$postId] = $result;
}
return $result;
}