47 if (
$request->get(
'flt_date_datesel') ===
null)
49 $componentParams[
'LOG_DATE_FROM'] = (
$request->get(
'flt_date_from') <>
'' ? trim(
$request->get(
'flt_date_from')) :
'');
50 $componentParams[
'LOG_DATE_TO'] = (
$request->get(
'flt_date_to') <>
'' ? trim(
$request->get(
'flt_date_to')) :
'');
52 elseif (
$request->get(
'flt_date_datesel') <>
'')
59 switch(
$request->get(
'flt_date_datesel'))
62 $componentParams[
'LOG_DATE_FROM'] = $componentParams[
'LOG_DATE_TO'] = convertTimeStamp();
65 $componentParams[
'LOG_DATE_FROM'] = $componentParams[
'LOG_DATE_TO'] = convertTimeStamp(time()-86400);
68 $componentParams[
'LOG_DATE_FROM'] = convertTimeStamp(time()-($day-1)*86400);
69 $componentParams[
'LOG_DATE_TO'] = convertTimeStamp(time()+(7-$day)*86400);
72 $componentParams[
'LOG_DATE_FROM'] = convertTimeStamp(time()-($day-1+7)*86400);
73 $componentParams[
'LOG_DATE_TO'] = convertTimeStamp(time()-($day)*86400);
76 $componentParams[
'LOG_DATE_FROM'] = convertTimeStamp(mktime(0, 0, 0, date(
'n'), 1));
77 $componentParams[
'LOG_DATE_TO'] = convertTimeStamp(mktime(0, 0, 0, date(
'n')+1, 0));
80 $componentParams[
'LOG_DATE_FROM'] = convertTimeStamp(mktime(0, 0, 0, date(
'n')-1, 1));
81 $componentParams[
'LOG_DATE_TO'] = convertTimeStamp(mktime(0, 0, 0, date(
'n'), 0));
84 $componentParams[
'LOG_DATE_FROM'] = convertTimeStamp(time() - (
int)
$request->get(
'flt_date_days')*86400);
85 $componentParams[
'LOG_DATE_TO'] =
'';
88 $componentParams[
'LOG_DATE_FROM'] = $componentParams[
'LOG_DATE_TO'] =
$request->get(
'flt_date_from');
91 $componentParams[
'LOG_DATE_FROM'] =
$request->get(
'flt_date_from');
92 $componentParams[
'LOG_DATE_TO'] =
'';
95 $componentParams[
'LOG_DATE_FROM'] =
'';
96 $componentParams[
'LOG_DATE_TO'] =
$request->get(
'flt_date_to');
99 $componentParams[
'LOG_DATE_FROM'] =
$request->get(
'flt_date_from');
100 $componentParams[
'LOG_DATE_TO'] =
$request->get(
'flt_date_to');
106 $componentParams[
'LOG_DATE_FROM'] = $componentParams[
'LOG_DATE_TO'] =
'';
144 if ($componentParams[
'GROUP_ID'] <= 0)
148 && !empty(
$request->get(
'TO_CODE')[
'SG'])
149 && is_array(
$request->get(
'TO_CODE')[
'SG'])
152 preg_match(
'/^SG(\d+)$/',
$request->get(
'TO_CODE')[
'SG'][0], $matches);
153 if (!empty($matches))
155 $componentParams[
'GROUP_ID'] = $matches[1];
158 elseif (!empty(
$request->get(
'flt_group_id')))
160 $componentParams[
'GROUP_ID'] = (int)
$request->get(
'flt_group_id');
164 if (empty($componentParams[
'DESTINATION']))
166 $componentParams[
'DESTINATION'] = [];
169 && is_array(
$request->get(
'TO_CODE'))
172 foreach(
$request->get(
'TO_CODE') as $codeList)
174 if (is_array($codeList))
176 foreach($codeList as $code)
178 $componentParams[
'DESTINATION'][] = $code;
185 $componentParams[
'ENTITY_TYPE'] =
'';
186 $componentParams[
'TO_USER_ID'] = 0;
188 if ($componentParams[
'GROUP_ID'] > 0)
190 $componentParams[
'ENTITY_TYPE'] = SONET_ENTITY_GROUP;
194 && is_array(
$request->get(
'TO_CODE'))
195 && !empty(
$request->get(
'TO_CODE')[
'U'])
196 && is_array(
$request->get(
'TO_CODE')[
'U'])
199 preg_match(
'/^U(\d+)$/',
$request->get(
'TO_CODE')[
'U'][0], $matches);
200 if (!empty($matches))
202 $componentParams[
'TO_USER_ID'] = (int)$matches[1];
207 $componentParams[
'TO_USER_ID'] = (int)
$request->get(
'flt_to_user_id');
211 $componentParams[
'ENTITY_TYPE'] ==
''
212 &&
$request->get(
'flt_entity_type') <>
''
215 $componentParams[
'ENTITY_TYPE'] = trim(
$request->get(
'flt_entity_type'));
220 $componentParams[
'USER_ID'] <= 0
221 && !empty(
$request->get(
'flt_user_id'))
224 $componentParams[
'USER_ID'] = (int)
$request->get(
'flt_user_id');
227 $componentParams[
'CREATED_BY_ID'] = 0;
230 !empty(
$request->get(
'CREATED_BY_CODE'))
231 && is_array(
$request->get(
'CREATED_BY_CODE'))
232 && !empty(
$request->get(
'CREATED_BY_CODE')[
'U'])
233 && is_array(
$request->get(
'CREATED_BY_CODE')[
'U'])
236 preg_match(
'/^U(\d+)$/',
$request->get(
'CREATED_BY_CODE')[
'U'][0], $matches);
237 if (!empty($matches))
239 $componentParams[
'CREATED_BY_ID'] = (int)$matches[1];
242 elseif (!empty(
$request->get(
'flt_created_by_id')))
244 $createdByIdValue =
$request->get(
'flt_created_by_id');
245 if (is_array($createdByIdValue))
247 $createdByIdValue = $createdByIdValue[0];
250 if (!is_array($createdByIdValue))
252 if (preg_match(
'/^(\d+)$/', $createdByIdValue, $matches))
254 $componentParams[
'CREATED_BY_ID'] = $createdByIdValue;
258 $userList = \CSocNetUser::searchUser($createdByIdValue,
false);
264 $componentParams[
'CREATED_BY_ID'] = key($userList);
270 $componentParams[
'TAG'] = (
$request->get(
'TAG') ? trim(
$request->get(
'TAG')) :
'');
271 $componentParams[
'FIND'] = (
$request->get(
'FIND') ? trim(
$request->get(
'FIND')) :
'');
338 $parentParams = $this->
getComponent()->getParent()->arParams;
342 Util::checkEmptyParamString($componentParams,
'BLOG_COMMENT_ALLOW_IMAGE_UPLOAD', trim($parentParams[
'BLOG_COMMENT_ALLOW_IMAGE_UPLOAD'] ??
''));
346 $componentParams[
'BLOG_GROUP_ID'] = (int) ($parentParams[
'BLOG_GROUP_ID'] ??
null);
347 $componentParams[
'BLOG_USE_CUT'] = (isset($parentParams[
'BLOG_USE_CUT']) ? trim($parentParams[
'BLOG_USE_CUT']) : (isset($componentParams[
'BLOG_USE_CUT']) ? trim($componentParams[
'BLOG_USE_CUT']) :
''));
348 $componentParams[
'PHOTO_USER_IBLOCK_TYPE'] = trim($parentParams[
'PHOTO_USER_IBLOCK_TYPE'] ??
'');
349 $componentParams[
'PHOTO_USER_IBLOCK_ID'] = (int) ($parentParams[
'PHOTO_USER_IBLOCK_ID'] ?? 0);
350 $componentParams[
'PHOTO_GROUP_IBLOCK_TYPE'] = trim($parentParams[
'PHOTO_GROUP_IBLOCK_TYPE'] ??
'');
351 $componentParams[
'PHOTO_GROUP_IBLOCK_ID'] = (int) ($parentParams[
'PHOTO_GROUP_IBLOCK_ID'] ?? 0);
352 $componentParams[
'PHOTO_MAX_VOTE'] = (int) ($parentParams[
'PHOTO_MAX_VOTE'] ?? 0);
353 $componentParams[
'PHOTO_USE_COMMENTS'] = trim($parentParams[
'PHOTO_USE_COMMENTS'] ??
'');
354 $componentParams[
'PHOTO_COMMENTS_TYPE'] = trim($parentParams[
'PHOTO_COMMENTS_TYPE'] ??
'');
355 $componentParams[
'PHOTO_FORUM_ID'] = (int) ($parentParams[
'PHOTO_FORUM_ID'] ?? 0);
356 $componentParams[
'PHOTO_BLOG_URL'] = trim($parentParams[
'PHOTO_BLOG_URL'] ??
'');
357 $componentParams[
'PHOTO_USE_CAPTCHA'] = trim($parentParams[
'PHOTO_USE_CAPTCHA'] ??
'');
358 $componentParams[
'PHOTO_COUNT'] = (int) ($parentParams[
'LOG_PHOTO_COUNT'] ?? 0);
359 $componentParams[
'PHOTO_THUMBNAIL_SIZE'] = (int) ($parentParams[
'LOG_PHOTO_THUMBNAIL_SIZE'] ?? 0);
360 $componentParams[
'FORUM_ID'] = (int) ($parentParams[
'FORUM_ID'] ?? 0);
401 $componentParams[
'AUTH'] ===
'Y'
402 || $USER->isAuthorized()
405 $presetFilterId = $this->
getComponent()->getPresetFilterIdValue();
406 $presetFilterTopId = $this->
getComponent()->getPresetFilterTopIdValue();
409 if(isset($componentParams[
'DISPLAY']))
411 $componentParams[
'SHOW_UNREAD'] =
'N';
412 $componentParams[
'SHOW_REFRESH'] =
'N';
413 $componentParams[
'SHOW_EVENT_ID_FILTER'] =
'N';
416 $componentParams[
'DISPLAY'] > 0
417 || in_array($componentParams[
'DISPLAY'], [
'mine',
'forme' ])
420 $componentParams[
'SET_LOG_COUNTER'] =
'N';
421 $componentParams[
'SET_LOG_PAGE_CACHE'] =
'N';
423 elseif ($componentParams[
'DISPLAY'] ===
'my')
425 $componentParams[
'SET_LOG_PAGE_CACHE'] =
'N';
429 if (empty($componentParams[
'DESTINATION']))
432 ($componentParams[
'GROUP_ID'] > 0 && !$this->isSpace($componentParams))
433 || !$this->isSmartTrackingMode($componentParams)
436 $componentParams[
'SET_LOG_PAGE_CACHE'] =
'Y';
437 $componentParams[
'USE_FOLLOW'] =
'N';
439 elseif ($componentParams[
'TO_USER_ID'] > 0)
441 $componentParams[
'SET_LOG_PAGE_CACHE'] =
'N';
442 $componentParams[
'USE_FOLLOW'] =
'N';
445 $componentParams[
'TAG'] <>
''
446 || $componentParams[
'FIND'] <>
''
449 $componentParams[
'SET_LOG_COUNTER'] =
'N';
450 $componentParams[
'SET_LOG_PAGE_CACHE'] =
'N';
451 $componentParams[
'SHOW_UNREAD'] =
'N';
452 $componentParams[
'USE_FOLLOW'] =
'N';
458 isset($componentParams[
'!EXACT_EVENT_ID'])
459 && $componentParams[
'!EXACT_EVENT_ID'] <>
''
462 isset($componentParams[
'EXACT_EVENT_ID'])
463 && $componentParams[
'EXACT_EVENT_ID'] <>
''
466 isset($componentParams[
'EVENT_ID'])
467 && !is_array($componentParams[
'EVENT_ID'])
468 && $componentParams[
'EVENT_ID'] <>
''
470 || $presetFilterId ===
'extranet'
471 || $componentParams[
'CREATED_BY_ID'] > 0
473 isset($componentParams[
'EVENT_ID'])
474 && is_array($componentParams[
'EVENT_ID'])
475 && !in_array(
'all', $componentParams[
'EVENT_ID'],
true)
478 isset($componentParams[
'LOG_DATE_FROM'])
479 && $componentParams[
'LOG_DATE_FROM'] <>
''
480 && makeTimeStamp($componentParams[
'LOG_DATE_FROM'], \CSite::getDateFormat(
'SHORT')) < time() + \CTimeZone::getOffset()
483 isset($componentParams[
'LOG_DATE_TO'])
484 && $componentParams[
'LOG_DATE_TO'] <>
''
485 && makeTimeStamp($componentParams[
'LOG_DATE_TO'], \CSite::getDateFormat(
'SHORT')) < time() + \CTimeZone::getOffset()
489 $componentParams[
'SET_LOG_COUNTER'] =
'N';
490 $componentParams[
'SET_LOG_PAGE_CACHE'] =
'N';
491 $componentParams[
'SHOW_UNREAD'] =
'N';
492 $componentParams[
'USE_FOLLOW'] =
'N';
495 if ($componentParams[
'IS_CRM'] ===
'Y')
500 if ($componentParams[
'CRM_ENTITY_TYPE'] <>
'')
502 $componentParams[
'SET_LOG_COUNTER'] =
'N';
503 $componentParams[
'SET_LOG_PAGE_CACHE'] =
'N';
504 $componentParams[
'SHOW_UNREAD'] =
'N';
506 elseif ($presetFilterTopId)
508 $componentParams[
'SET_LOG_COUNTER'] =
'N';
509 $componentParams[
'SHOW_UNREAD'] =
'N';
511 $componentParams[
'CRM_EXTENDED_MODE'] = (isset($componentParams[
'CRM_EXTENDED_MODE']) && $componentParams[
'CRM_EXTENDED_MODE'] ===
'Y' ?
'Y' :
'N');
514 if ($componentParams[
'LOG_CNT'] > 0)
516 $componentParams[
'SHOW_NAV_STRING'] =
'N';
517 $componentParams[
'SHOW_REFRESH'] =
'N';
522 !isset($componentParams[
'USE_FAVORITES'])
523 || $componentParams[
'USE_FAVORITES'] !==
'N'
525 && isset($componentParams[
'FAVORITES'])
526 && $componentParams[
'FAVORITES'] ===
'Y'
529 $componentParams[
'SET_LOG_COUNTER'] =
'N';
530 $componentParams[
'SET_LOG_PAGE_CACHE'] =
'N';
531 $componentParams[
'SHOW_UNREAD'] =
'N';
534 if ((
int)
$request->get(
'pagesize') > 0)
536 $componentParams[
'SET_LOG_PAGE_CACHE'] =
'N';
543 $requestParams = $this->
getRequest()->getPost(
'params');
545 $componentParams[
'UID'] = (
546 !empty($requestParams)
547 && is_array($requestParams)
548 && !empty($requestParams[
'commentFormUID'])
549 ? $requestParams[
'commentFormUID']
550 : \Bitrix\Main\Security\Random::getString(4)
553 $componentParams[
'BLOG_UID'] = (
554 !empty($requestParams)
555 && is_array($requestParams)
556 && !empty($requestParams[
'blogCommentFormUID'])
557 ? $requestParams[
'blogCommentFormUID']
558 : \Bitrix\Main\Security\Random::getString(4)
561 $componentParams[
'FORM_ID'] =
'sonetCommentForm' . $componentParams[
'UID'];
562 $componentParams[
'BLOG_FORM_ID'] =
'blogCommentForm' . $componentParams[
'BLOG_UID'];
571 $presetFilterTopId = $this->
getComponent()->getPresetFilterTopIdValue();
572 $presetFilterId = $this->
getComponent()->getPresetFilterIdValue();
573 $commentsNeeded = $this->
getComponent()->getCommentsNeededValue();
576 $request->get(
'preset_filter_top_id') <>
''
577 &&
$request->get(
'preset_filter_top_id') !==
'clearall'
580 $presetFilterTopId =
$request->get(
'preset_filter_top_id');
583 isset($componentParams[
'preset_filter_top_id'])
584 && $componentParams[
'preset_filter_top_id'] <>
''
585 && $componentParams[
'preset_filter_top_id'] !==
'clearall'
588 $presetFilterTopId = $componentParams[
'preset_filter_top_id'];
592 $request->get(
'preset_filter_id') <>
''
593 &&
$request->get(
'preset_filter_id') !==
'clearall'
596 $presetFilterId =
$request->get(
'preset_filter_id');
599 isset($componentParams[
'preset_filter_id'])
600 && $componentParams[
'preset_filter_id'] <>
''
601 && $componentParams[
'preset_filter_id'] !==
'clearall'
604 $presetFilterId = $componentParams[
'preset_filter_id'];
607 $presetFiltersOptions = $presetFiltersList =
false;
609 $componentParams[
'SHOW_EVENT_ID_FILTER'] !==
'N'
610 && $USER->isAuthorized()
613 $presetFiltersOptions = \CUserOptions::getOption(
'socialnetwork',
'~log_filter_'.SITE_ID);
614 if (!is_array($presetFiltersOptions))
616 $presetFiltersOptions = \CUserOptions::getOption(
'socialnetwork',
'~log_filter');
621 is_array($presetFiltersOptions)
622 && $componentParams[
'SHOW_EVENT_ID_FILTER'] !==
'N'
623 && $componentParams[
'IS_CRM'] !==
'Y'
626 if(
$request->get(
'preset_filter_id') <>
'')
628 \CUserOptions::deleteOption(
'socialnetwork',
'~log_'.$componentParams[
'ENTITY_TYPE'].
'_'.($componentParams[
'ENTITY_TYPE'] == SONET_ENTITY_GROUP ? $componentParams[
'GROUP_ID'] : $componentParams[
'USER_ID']));
631 $presetFiltersList = \CSocNetLogComponent::convertPresetToFilters($presetFiltersOptions, $componentParams[
'GROUP_ID'] ??
null);
635 'filterItems' => $presetFiltersList
637 AddEventHandler(
'socialnetwork',
'OnBeforeSonetLogFilterFill', [ $livefeedFilterHandler,
'OnBeforeSonetLogFilterFill' ]);
641 $componentParams[
'IS_CRM'] ===
'Y'
642 && isset($componentParams[
'CRM_ENTITY_TYPE'])
643 && Loader::includeModule(
'crm')
646 $liveFeedFilter = new \CCrmLiveFeedFilter([
'EntityTypeID' => \CCrmLiveFeedEntity::resolveEntityTypeID($componentParams[
'CRM_ENTITY_TYPE']) ]);
647 AddEventHandler(
'socialnetwork',
'OnSonetLogFilterProcess', [ $liveFeedFilter,
'OnSonetLogFilterProcess' ]);
650 $presetTopFiltersList = [];
651 if (!is_array($presetFiltersList))
653 $presetFiltersList = [];
656 $res = GetModuleEvents(
'socialnetwork',
'OnSonetLogFilterProcess');
657 while ($eventFields = $res->fetch())
659 $eventResult = ExecuteModuleEventEx($eventFields, [ $presetFilterTopId, $presetFilterId, $presetTopFiltersList, $presetFiltersList ]);
660 if (is_array($eventResult))
662 if (isset($eventResult[
'GET_COMMENTS']))
664 $commentsNeeded = $eventResult[
'GET_COMMENTS'];
666 if (isset($eventResult[
'PARAMS']) && is_array($eventResult[
'PARAMS']))
668 foreach($eventResult[
'PARAMS'] as $key => $value)
670 $componentParams[$key] = $value;
676 if ($componentParams[
'SHOW_EVENT_ID_FILTER'] !==
'N')
678 $eventResult = \CSocNetLogComponent::onSonetLogFilterProcess($presetFilterTopId, $presetFilterId, $presetTopFiltersList, $presetFiltersList);
679 if (is_array($eventResult))
681 if (isset($eventResult[
'GET_COMMENTS']))
683 $commentsNeeded = $eventResult[
'GET_COMMENTS'];
685 if (isset($eventResult[
'PARAMS']) && is_array($eventResult[
'PARAMS']))
687 foreach($eventResult[
'PARAMS'] as $key => $value)
689 $componentParams[$key] = $value;
695 $this->
getComponent()->setPresetFilterTopIdValue($presetFilterTopId);
696 $this->
getComponent()->setPresetFilterIdValue($presetFilterId);
697 $this->
getComponent()->setCommentsNeededValue($commentsNeeded);