- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/lib/item/usercontentview.php
- Класс: BitrixSocialnetworkItemUserContentView
- Вызов: UserContentView::set
static function set(array $params = []): void
{
$xmlIdList = (
isset($params["xmlIdList"])
&& is_array($params["xmlIdList"])
? $params["xmlIdList"]
: []
);
$context = ($params['context'] ?? '');
$userId = (
isset($params['userId'])
&& (int)$params['userId'] > 0
? (int)$params['userId'] :
0
);
if (!empty($xmlIdList))
{
foreach ($xmlIdList as $val)
{
$xmlId = $val['xmlId'];
$save = (
!isset($val['save'])
|| $val['save'] !== 'N'
);
[ $entityType, $entityId ] = self::parseXmlId($xmlId);
if (
!empty($entityType)
&& $entityId > 0
)
{
$provider = LivefeedProvider::init([
'ENTITY_TYPE' => $entityType,
'ENTITY_ID' => $entityId,
]);
if ($provider)
{
$hasPermissions = true;
if (
isset($val['checkAccess'])
&& $val['checkAccess'] === true
)
{
$provider->setOption('checkAccess', true);
$provider->initSourceFields();
if (empty($provider->getSourceFields()))
{
$hasPermissions = false;
}
}
if ($hasPermissions)
{
$provider->setContentView([
'save' => $save,
]);
}
/*
TODO: https://bitrix24.team/company/personal/user/15/tasks/task/view/167281/
$provider->deleteCounter([
'userId' => $this->getCurrentUser()->getId(),
'siteId' => SITE_ID
]);
*/
}
}
}
self::finalize([
'userId' => $userId,
'context' => $context
]);
}
}