Ejemplo n.º 1
0
 public static function formatListsElement($fields, $params, $mail = false)
 {
     $element = array('EVENT' => $fields, 'CREATED_BY' => array(), 'ENTITY' => array(), 'EVENT_FORMATTED' => array());
     $userObject = CUser::getByID($fields['ENTITY_ID']);
     $user = $userObject->fetch();
     if ($user) {
         if (!$mail) {
             global $APPLICATION;
             $rights = array();
             $rightsQuery = CSocNetLogRights::getList(array(), array('LOG_ID' => $fields['ID']));
             while ($right = $rightsQuery->fetch()) {
                 $rights[] = $right['GROUP_CODE'];
             }
             if (defined('BX_COMP_MANAGED_CACHE')) {
                 $GLOBALS['CACHE_MANAGER']->registerTag('LISTS_ELEMENT_LIVE_FEED');
             }
             $componentResult = $APPLICATION->includeComponent('bitrix:bizproc.workflow.livefeed', '', array('WORKFLOW_ID' => $fields['MESSAGE']), null, array('HIDE_ICONS' => 'Y'));
             $siteDir = rtrim(SITE_DIR, '/');
             $url = CSocNetLogTools::formatEvent_GetURL($fields, true);
             $url = str_replace('#SITE_DIR#', $siteDir, $url);
             $url .= '' . $fields['ID'] . '/';
             $element = array('EVENT' => $fields, 'EVENT_FORMATTED' => array('TITLE_24' => '<a href="' . $fields['TITLE_TEMPLATE'] . '" class="bx-lists-live-feed-title-link">' . $fields['TITLE'] . '</a>', 'MESSAGE' => $fields['TEXT_MESSAGE'] . $componentResult['MESSAGE'], 'IS_IMPORTANT' => false, 'STYLE' => 'new-employee', 'AVATAR_STYLE' => 'avatar-info', 'DESTINATION' => CSocNetLogTools::formatDestinationFromRights($rights, array_merge($params, array('CREATED_BY' => $fields['USER_ID']))), 'URL' => $url), 'CREATED_BY' => CSocNetLogTools::formatEvent_GetCreatedBy($fields, $params, $mail), 'AVATAR_SRC' => CSocNetLog::formatEvent_CreateAvatar($fields, $params), 'CACHED_JS_PATH' => $componentResult['CACHED_JS_PATH'], 'CACHED_CSS_PATH' => $componentResult['CACHED_CSS_PATH']);
             if ($params['MOBILE'] == 'Y') {
                 $element['EVENT_FORMATTED']['TITLE_24'] = Loc::getMessage('LISTS_LF_MOBILE_DESTINATION');
                 $element['EVENT_FORMATTED']['TITLE_24_2'] = $fields['TITLE'];
             }
             if (CModule::IncludeModule('bizproc')) {
                 $workflowId = \CBPStateService::getWorkflowByIntegerId($element['EVENT']['SOURCE_ID']);
             }
             if ($workflowId) {
                 $element['EVENT']['SOURCE_ID'] = $workflowId;
             }
         }
         return $element;
     }
 }