• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/task.php
  • Класс: CTasks
  • Вызов: CTasks::GetUpdatesCount
static function GetUpdatesCount($arViewed)
{
	global $DB;
	if ($userID = User::getId())
	{
		$arSqlSearch = [];
		$arUpdatesCount = [];
		foreach ($arViewed as $key => $val)
		{
			$arSqlSearch[] = "(CREATED_DATE > "
				. Db::charToDateFunction($val)
				. " AND TASK_ID = "
				. (int)$key
				. ")";
			$arUpdatesCount[$key] = 0;
		}

		if (!empty($arSqlSearch))
		{
			$strSql = "
				SELECT
					TL.TASK_ID AS TASK_ID,
					COUNT(TL.TASK_ID) AS CNT
				FROM
					b_tasks_log TL
				WHERE
					USER_ID != " . $userID . "
					AND (
					" . implode(" OR ", $arSqlSearch) . "
					)
				GROUP BY
					TL.TASK_ID
			";

			$rsUpdatesCount = $DB->Query($strSql, false, "File: " . __FILE__ . "
Line: " . __LINE__); while ($arUpdate = $rsUpdatesCount->Fetch()) { $arUpdatesCount[$arUpdate["TASK_ID"]] = $arUpdate["CNT"]; } return $arUpdatesCount; } } return false; }