• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/task/viewed.php
  • Класс: BitrixTasksInternalsTaskViewedTable
  • Вызов: ViewedTable::getListForReadAll
static function getListForReadAll(int $currentUserId, string $userJoin, string $groupCondition = '', array $select = []) :? array
{
	$result = [];
	$connection = MainApplication::getConnection();

	$strSelect = "T.ID as IDn";
	foreach ($select as $key => $field)
	{
		$strSelect .= ",". $field["FIELD_NAME"]." AS ".$key."n";
	}

	$sql = "
		SELECT
				{$strSelect}
			FROM b_tasks T
			INNER JOIN b_tasks_scorer TS
				ON TS.TASK_ID = T.ID
				AND TS.USER_ID = {$currentUserId}
			{$userJoin}
			WHERE 
				TS.USER_ID = {$currentUserId}      
				{$groupCondition}
				AND TS.TYPE IN (
					'".CounterDictionary::COUNTER_MY_NEW_COMMENTS."',
					'".CounterDictionary::COUNTER_MY_MUTED_NEW_COMMENTS."',
					'".CounterDictionary::COUNTER_ACCOMPLICES_NEW_COMMENTS."',
					'".CounterDictionary::COUNTER_ACCOMPLICES_MUTED_NEW_COMMENTS."',
					'".CounterDictionary::COUNTER_AUDITOR_NEW_COMMENTS."',
					'".CounterDictionary::COUNTER_AUDITOR_MUTED_NEW_COMMENTS."',
					'".CounterDictionary::COUNTER_ORIGINATOR_NEW_COMMENTS."',
					'".CounterDictionary::COUNTER_ORIGINATOR_MUTED_NEW_COMMENTS."',
					'".CounterDictionary::COUNTER_GROUP_COMMENTS."'
				)
	";

	$res = $connection->query($sql);

	while ($row = $res->fetch())
	{
		$result[] = $row;
	}

	return $result;
}