• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/notify.php
  • Класс: BitrixImNotify
  • Вызов: Notify::search
public function search(): array
{
	if (!$this->chatId)
	{
		return [];
	}

	if (!$this->searchText && !$this->searchType && !$this->searchDate)
	{
		return [];
	}

	if ($this->lastId > 0)
	{
		$this->lastType = self::ALL_TYPES;
		$this->firstPage = false;
	}

	// fetching searched notifications
	$collection = $this->requestData(self::ALL_TYPES, $this->pageLimit);

	$result = [
		'CHAT_ID' => $this->chatId,
		'NOTIFICATIONS' => $collection,
		'USERS' => $this->users,
	];

	if (!$this->lastId)
	{
		$result['TOTAL_RESULTS'] = $this->requestSearchTotalCount();
	}

	foreach ($result['NOTIFICATIONS'] as $key => $value)
	{
		if ($value['DATE'] instanceof DateTime)
		{
			$result['NOTIFICATIONS'][$key]['DATE'] = date('c', $value['DATE']->getTimestamp());
		}

		$result['NOTIFICATIONS'][$key] = array_change_key_case($result['NOTIFICATIONS'][$key], CASE_LOWER);
	}
	$result['NOTIFICATIONS'] = array_values($result['NOTIFICATIONS']);
	$result['USERS'] = array_values($result['USERS']);
	$result = array_change_key_case($result, CASE_LOWER);

	return $result;
}