9namespace Bitrix\Socialnetwork\Item;
11use Bitrix\Main\Config\Option;
12use Bitrix\Main\Entity\ExpressionField;
13use Bitrix\Main\Loader;
14use Bitrix\Main\ModuleManager;
15use Bitrix\Socialnetwork\Integration\Extranet\User;
16use Bitrix\Socialnetwork\UserContentViewTable;
17use Bitrix\Main\DB\SqlQueryException;
18use Bitrix\Socialnetwork\Livefeed;
22 private static array $viewDataCache = [];
73 $cacheKey = self::generateViewDataCacheKey(
$contentId);
75 if (isset(self::$viewDataCache[$cacheKey]))
77 return self::$viewDataCache[$cacheKey];
80 $res = UserContentViewTable::getList([
84 'select' => [
'CNT',
'CONTENT_ID',
'RATING_TYPE_ID',
'RATING_ENTITY_ID' ],
88 'group' => [
'CONTENT_ID' ]
96 self::$viewDataCache[$cacheKey] =
$result;
126 'USER_NAME' =>
'USER.NAME',
127 'USER_LAST_NAME' =>
'USER.LAST_NAME',
128 'USER_SECOND_NAME' =>
'USER.SECOND_NAME',
129 'USER_LOGIN' =>
'USER.LOGIN',
130 'USER_PERSONAL_PHOTO' =>
'USER.PERSONAL_PHOTO',
131 'USER_PERSONAL_GENDER' =>
'USER.PERSONAL_GENDER'
134 $extranetInstalled = $mailInstalled =
false;
135 $extranetIdList = [];
137 if (ModuleManager::isModuleInstalled(
'extranet'))
139 $extranetInstalled =
true;
140 $select[
'USER_UF_DEPARTMENT'] =
"USER.UF_DEPARTMENT";
145 $mailInstalled =
true;
146 $select[
'USER_EXTERNAL_AUTH_ID'] =
"USER.EXTERNAL_AUTH_ID";
151 'DATE_VIEW' =>
'DESC'
159 if (!$extranetInstalled)
162 $queryParams[
'offset'] = ($pageNum - 1) *
$pageSize;
166 $timeZoneOffset = \CTimeZone::getOffset();
168 $res = UserContentViewTable::getList($queryParams);
174 if ((
int)
$fields[
'USER_PERSONAL_PHOTO'] <= 0)
176 switch (
$fields[
'USER_PERSONAL_GENDER'])
187 $fields[
'USER_PERSONAL_PHOTO'] = Option::get(
'socialnetwork',
'default_user_picture_' . $suffix,
false,
SITE_ID);
191 !empty(
$fields[
'USER_PERSONAL_PHOTO'])
192 && (
int)
$fields[
'USER_PERSONAL_PHOTO'] > 0
195 $file = \CFile::resizeImageGet(
196 $fields[
"USER_PERSONAL_PHOTO"],
197 [
'width' => 58,
'height' => 58 ],
203 $photoSrc = $file[
"src"];
207 'NAME' =>
$fields[
'USER_NAME'],
208 'LAST_NAME' =>
$fields[
'USER_LAST_NAME'],
209 'SECOND_NAME' =>
$fields[
'USER_SECOND_NAME'],
210 'LOGIN' =>
$fields[
'USER_LOGIN'],
216 &&
$fields[
"USER_EXTERNAL_AUTH_ID"] ===
"email"
221 elseif ($extranetInstalled)
223 if ((empty(
$fields[
"USER_UF_DEPARTMENT"]) || (
int)
$fields[
"USER_UF_DEPARTMENT"][0] <= 0))
225 $userType =
"extranet";
226 $extranetIdList[] =
$fields[
"USER_ID"];
229 if (User::isCollaber((
int)
$fields[
"USER_ID"]))
231 $userType =
'collaber';
236 $fields[
'DATE_VIEW'] instanceof \Bitrix\Main\Type\DateTime
237 ?
$fields[
'DATE_VIEW']->toString()
246 "user_id" =>
$fields[
"USER_ID"],
247 "USER_ID" =>
$fields[
"USER_ID"]
249 'PHOTO_SRC' => $photoSrc,
250 'FULL_NAME' => \CUser::formatName(\CSite::getNameFormat(), $userFields,
true,
true),
251 'DATE_VIEW' => $dateView,
252 'DATE_VIEW_FORMATTED' => (
254 ? \CComponentUtil::getDateTimeFormatted(
MakeTimeStamp($dateView),
"FULL", $timeZoneOffset)
262 $userIdToCheckList = [];
263 if (Loader::includeModule(
'extranet'))
265 $userIdToCheckList = (
272 $isTaskContentId = str_contains(
$contentId,
'TASK');
273 if (!empty($userIdToCheckList))
275 $myGroupsUserList = \CExtranet::getMyGroupsUsersSimple(\CExtranet::getExtranetSiteID());
277 foreach ($userIdToCheckList as $userIdToCheck)
280 !in_array($userIdToCheck, $myGroupsUserList)
284 if ($isTaskContentId)
286 $userList[$userIdToCheck][
'PUBLIC_MODE'] =
false;
297 if (!$extranetInstalled)
303 $res = new \CDBResult();
346 && is_array(
$params[
"xmlIdList"])
364 $xmlId =
$val[
'xmlId'];
367 ||
$val[
'save'] !==
'N'
378 'ENTITY_TYPE' => $entityType,
383 $hasPermissions =
true;
385 isset(
$val[
'checkAccess'])
386 &&
$val[
'checkAccess'] ===
true
389 $provider->setOption(
'checkAccess',
true);
394 $hasPermissions =
false;
434 $context !==
'forum.comments/mobile'
435 && ModuleManager::isModuleInstalled(
'tasks')
439 if (!empty($taskIdList))
441 $event = new \Bitrix\Main\Event(
442 'socialnetwork',
'onContentFinalizeView',
445 'commentsTaskIdList' => $taskIdList
457 $tmp = explode(
'-', $xmlId, 2);
458 $entityType = trim(
$tmp[0]);
464 private static function generateViewDataCacheKey(
array $params): string
466 return md5(serialize(
$params));
if(!Loader::includeModule('messageservice')) $provider
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
static getConnection($name="")
static getUserList(array $params=[])
static finalize($params=[])
static getViewData($params=[])
static deleteNoDemand($userId=0)
static parseXmlId(string $xmlId='')
static init(array $params)
static makePathFromTemplate($template, $arParams=array())
if(!is_array($prop["VALUES"])) $tmp
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
const BX_RESIZE_IMAGE_EXACT
IsModuleInstalled($module_id)
MakeTimeStamp($datetime, $format=false)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']