19 $configureActions = parent::configureActions();
20 $configureActions[
'getNextPage'] = [
22 ActionFilter\Authentication::class,
25 $configureActions[
'refresh'] = [
27 ActionFilter\Authentication::class,
30 $configureActions[
'mobileLogError'] = [
32 ActionFilter\Authentication::class,
36 return $configureActions;
67 $entityType = (isset($params[
'entityType']) && $params[
'entityType'] <>
'' ? preg_replace(
"/[^a-z0-9_]/i",
'', $params[
'entityType']) :
false);
68 $entityId = (isset($params[
'entityId']) && (int)$params[
'entityId'] > 0 ? (
int)$params[
'entityId'] :
false);
69 $logId = (isset($params[
'logId']) && (int)$params[
'logId'] > 0 ? (
int)$params[
'logId'] :
false);
70 $additionalParams = (isset($params[
'additionalParams']) && is_array($params[
'additionalParams']) ? $params[
'additionalParams'] : []);
72 if (!Loader::includeModule(
'socialnetwork'))
74 $this->
addError(
new Error(
'Cannot include Socialnetwork module',
'SONET_CONTROLLER_LIVEFEED_NO_SOCIALNETWORK_MODULE'));
78 $provider = \Bitrix\Socialnetwork\Livefeed\Provider::init([
79 'ENTITY_TYPE' => $entityType,
80 'ENTITY_ID' => $entityId,
82 'CLONE_DISK_OBJECTS' =>
true
87 $this->
addError(
new Error(
'Cannot find Livefeed entity',
'SONET_CONTROLLER_LIVEFEED_NO_ENTITY'));
91 $returnFields = [
'TITLE',
'DESCRIPTION',
'DISK_OBJECTS',
'GROUPS_AVAILABLE',
'LIVEFEED_URL',
'SUFFIX',
'LOG_ID' ];
93 isset($additionalParams[
'returnFields'])
94 && is_array($additionalParams[
'returnFields'])
97 $returnFields = array_intersect($returnFields, $additionalParams[
'returnFields']);
101 'TITLE' => $provider->getSourceTitle(),
102 'DESCRIPTION' => $provider->getSourceDescription(),
103 'DISK_OBJECTS' => $provider->getSourceDiskObjects()
107 isset($additionalParams[
'getSonetGroupAvailable'])
108 && $additionalParams[
'getSonetGroupAvailable'] ===
'Y'
111 $feature = $operation =
false;
112 if (isset($additionalParams[
'checkPermissions'][
'operation'], $additionalParams[
'checkPermissions'][
'feature']))
114 $feature = $additionalParams[
'checkPermissions'][
'feature'];
115 $operation = $additionalParams[
'checkPermissions'][
'operation'];
118 $result[
'GROUPS_AVAILABLE'] = $provider->getSonetGroupsAvailable($feature, $operation);
122 isset($additionalParams[
'getLivefeedUrl'])
123 && $additionalParams[
'getLivefeedUrl'] ===
'Y'
126 $result[
'LIVEFEED_URL'] = $provider->getLiveFeedUrl();
128 isset($additionalParams[
'absoluteUrl'])
129 && $additionalParams[
'absoluteUrl'] ===
'Y'
132 $serverName = Option::get(
'main',
'server_name', $_SERVER[
'SERVER_NAME']);
133 $res = \CSite::getById(SITE_ID);
135 ($siteFields = $res->fetch())
136 && $siteFields[
'SERVER_NAME'] <>
''
139 $serverName = $siteFields[
'SERVER_NAME'];
142 $protocol = (\Bitrix\Main\Context::getCurrent()->getRequest()->isHttps() ?
'https' :
'http');
143 $result[
'LIVEFEED_URL'] = $protocol .
'://' . $serverName . $result[
'LIVEFEED_URL'];
147 $result[
'SUFFIX'] = $provider->getSuffix();
149 if (($logId = $provider->getLogId()))
151 $result[
'LOG_ID'] = $logId;
154 return array_filter($result,
static function ($key) use ($returnFields) {
155 return in_array($key, $returnFields,
true);
156 }, ARRAY_FILTER_USE_KEY);
161 $postEntityType = (isset($params[
'postEntityType']) && $params[
'postEntityType'] <>
'' ? preg_replace(
'/[^a-z0-9_]/i',
'', $params[
'postEntityType']) :
false);
162 $sourceEntityType = (isset($params[
'sourceEntityType']) && $params[
'sourceEntityType'] <>
'' ? preg_replace(
'/[^a-z0-9_]/i',
'', $params[
'sourceEntityType']) :
false);
163 $sourceEntityId = (int)($params[
'sourceEntityId'] ?? 0);
164 $sourceEntityData = (array)($params[
'sourceEntityData'] ?? []);
165 $entityType = (isset($params[
'entityType']) && $params[
'entityType'] <>
'' ? preg_replace(
'/[^a-z0-9_]/i',
'', $params[
'entityType']) :
false);
166 $entityId = (int)($params[
'entityId'] ?? 0);
167 $logId = (int)($params[
'logId'] ?? 0);
171 || $sourceEntityId <= 0
182 'ENTITY_TYPE' => $entityType,
183 'ENTITY_ID' => $entityId,
184 'SOURCE_ENTITY_TYPE' => $sourceEntityType,
185 'SOURCE_ENTITY_ID' => $sourceEntityId,
186 'SOURCE_ENTITY_DATA' => $sourceEntityData,
194 'ENTITY_TYPE' => $entityType,
195 'ENTITY_ID' => $entityId,
196 'POST_ENTITY_TYPE' => $postEntityType,
197 'SOURCE_ENTITY_TYPE' => $sourceEntityType,
198 'SOURCE_ENTITY_ID' => $sourceEntityId,
199 'SOURCE_ENTITY_DATA' => $sourceEntityData,
347 if (!Loader::includeModule(
'socialnetwork'))
349 $this->
addError(
new Error(
'Cannot include Socialnetwork module',
'SONET_CONTROLLER_LIVEFEED_NO_SOCIALNETWORK_MODULE'));
353 $viewValue = ($expertModeValue ===
'Y' ?
'N' :
'Y');
354 \Bitrix\Socialnetwork\LogViewTable::set($this->getCurrentUser()->getId(),
'tasks', $viewValue);
355 \Bitrix\Socialnetwork\LogViewTable::set($this->getCurrentUser()->getId(),
'crm_activity_add', $viewValue);
356 \Bitrix\Socialnetwork\LogViewTable::set($this->getCurrentUser()->getId(),
'crm_activity_add_comment', $viewValue);
358 $result[
'success'] =
true;
426 $componentParameters = $this->getUnsignedParameters();
427 if (!is_array($componentParameters))
429 $componentParameters = [];
431 $context = $params[
'context'] ??
'';
432 $requestParameters = [
434 'PAGE_NUMBER' => (isset($params[
'PAGE_NUMBER']) && (int)$params[
'PAGE_NUMBER'] >= 1 ? (
int)$params[
'PAGE_NUMBER'] : 1),
435 'LAST_LOG_TIMESTAMP' => (isset($params[
'LAST_LOG_TIMESTAMP']) && (int)$params[
'LAST_LOG_TIMESTAMP'] > 0 ? (
int)$params[
'LAST_LOG_TIMESTAMP'] : 0),
436 'PREV_PAGE_LOG_ID' => ($params[
'PREV_PAGE_LOG_ID'] ??
''),
437 'CONTEXT' => $context,
438 'useBXMainFilter' => ($params[
'useBXMainFilter'] ??
'N'),
439 'siteTemplateId' => ($params[
'siteTemplateId'] ??
'bitrix24'),
440 'preset_filter_top_id' => ($params[
'preset_filter_top_id'] ??
''),
441 'preset_filter_id' => ($params[
'preset_filter_id'] ??
''),
444 if ($context === Context::SPACES)
446 $requestParameters[
'SPACE_USER_ID'] = (int)($params[
'userId'] ?? $this->userId);
447 $requestParameters[
'GROUP_ID'] = (int)($componentParameters[
'GROUP_ID'] ?? $params[
'spaceId']);
451 return new Component(
'bitrix:socialnetwork.log.ex',
'', array_merge($componentParameters, $requestParameters), [], $this->getComponentReturnWhiteList());
456 $componentParameters = $this->getUnsignedParameters();
457 if (!is_array($componentParameters))
459 $componentParameters = [];
462 $context = $params[
'context'] ??
'';
463 $requestParameters = [
467 'CONTEXT' => $context,
468 'composition' => $params[
'composition'] ?? [],
469 'useBXMainFilter' => ($params[
'useBXMainFilter'] ??
'N'),
470 'siteTemplateId' => ($params[
'siteTemplateId'] ??
'bitrix24'),
471 'assetsCheckSum' => ($params[
'assetsCheckSum'] ??
'')
474 if ($context === Context::SPACES)
476 $requestParameters[
'SPACE_USER_ID'] = (int)($params[
'userId'] ?? $this->userId);
477 $requestParameters[
'GROUP_ID'] = (int)($componentParameters[
'GROUP_ID'] ?? $params[
'spaceId']);
480 return new Component(
'bitrix:socialnetwork.log.ex',
'', array_merge($componentParameters, $requestParameters), [], $this->getComponentReturnWhiteList());
485 $params = explode(
"|", $tag);
486 if (empty($params[1]) || empty($params[2]) || !Loader::includeModule(
'socialnetwork'))
491 $liveFeedEntity = \Bitrix\SocialNetwork\Livefeed\Provider::init([
492 'ENTITY_TYPE' => \
Bitrix\Socialnetwork\
Livefeed\Provider::DATA_ENTITY_TYPE_FORUM_POST,
493 'ENTITY_ID' => $params[2]
496 $suffix = $liveFeedEntity->getSuffix();
497 if ($suffix ===
'TASK')
499 $res = \Bitrix\Socialnetwork\LogTable::getList(array(
501 'ID' => $liveFeedEntity->getLogId()
503 'select' => [
'ENTITY_ID',
'EVENT_ID',
'SOURCE_ID' ]
505 if ($logEntryFields = $res->fetch())
507 if ($logEntryFields[
'EVENT_ID'] ===
'crm_activity_add')
510 Loader::includeModule(
'crm')
511 && ($activityFields = \CCrmActivity::getById($logEntryFields[
'ENTITY_ID'],
false))
512 && $activityFields[
'TYPE_ID'] == \CCrmActivityType::Task
515 $taskId = (int)$activityFields[
'ASSOCIATED_ENTITY_ID'];
520 $taskId = (int)$logEntryFields[
'SOURCE_ID'];
523 if (isset($taskId) && $taskId > 0 && Loader::includeModule(
'mobile'))
525 return \CMobileHelper::getParamsToCreateTaskLink($taskId);
530 return SITE_DIR .
"mobile/log/?ACTION=CONVERT&ENTITY_TYPE_ID=FORUM_POST&ENTITY_ID=" . $params[2];