- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/integration/socialnetwork/group.php
- Класс: BitrixTasksIntegrationSocialNetworkGroup
- Вызов: Group::getLastViewedProject
static function getLastViewedProject($userId): int
{
$res = BitrixSocialnetworkWorkgroupViewTable::getList(array(
'select' => array(
'GROUP_ID'
),
'filter' => array(
'USER_ID' => $userId,
'=GROUP.ACTIVE' => 'Y',
'=GROUP.CLOSED' => 'N',
),
'order' => array(
'DATE_VIEW' => 'DESC'
)
));
while ($row = $res->fetch())
{
if (self::canReadGroupTasks($userId, $row['GROUP_ID']))
{
$lastGroupId = $row['GROUP_ID'];
break;
}
}
if (!$lastGroupId)
{
// get by date activity
$res = CSocNetUserToGroup::GetList(
array(
'GROUP_DATE_ACTIVITY' => 'DESC'
),
array(
'USER_ID' => $userId,
'!ROLE' => array(
SONET_ROLES_BAN,
SONET_ROLES_REQUEST
),
'USER_ACTIVE' => 'Y',
'GROUP_ACTIVE' => 'Y'
),
false, false,
array(
'GROUP_ID'
)
);
while ($row = $res->fetch())
{
if (self::canReadGroupTasks($userId, $row['GROUP_ID']))
{
$lastGroupId = $row['GROUP_ID'];
break;
}
}
}
return (int) $lastGroupId;
}