• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/notify.php
  • Класс: BitrixImNotify
  • Вызов: Notify::requestSearchTotalCount
private function requestSearchTotalCount(): int
{
	$ormParams = [
		'select' => ['CNT'],
		'filter' => [
			'=CHAT_ID' => $this->chatId,
		],
		'runtime' => [
			new BitrixMainORMFieldsExpressionField('CNT', 'COUNT(*)')
		]
	];

	if ($this->searchText)
	{
		$ormParams['filter']['*%MESSAGE'] = $this->searchText;
	}
	if ($this->searchType)
	{
		$options = explode('|', $this->searchType);
		$ormParams['filter']['=NOTIFY_MODULE'] = $options[0];
		if (isset($options[1]))
		{
			$ormParams['filter']['=NOTIFY_EVENT'] = $options[1];
		}
	}
	if ($this->searchDate)
	{
		$dateStart = new DateTime(
			$this->searchDate,
			DateTimeInterface::RFC3339,
			new DateTimeZone('UTC')
		);
		$dateEnd = (
			new DateTime(
				$this->searchDate,
				DateTimeInterface::RFC3339,
				new DateTimeZone('UTC')
			)
		)->add('1 DAY');

		$ormParams['filter']['>fetch();
	if (!$totalSearchCount)
	{
		return 0;
	}

	return (int)$totalSearchCount['CNT'];
}