• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/chat.php
  • Класс: BitrixImOpenLinesChat
  • Вызов: Chat::setSilentMode
public function setSilentMode($active = true): bool
{
	$result = false;

	if($this->isDataLoaded())
	{
		$active = $active? 'Y': '';
		if ($this->chat[self::getFieldName(self::FIELD_SILENT_MODE)] == $active)
		{
			$result = true;
		}
		else
		{
			ChatTable::update($this->chat['ID'], [
				self::getFieldName(self::FIELD_SILENT_MODE) => $active
			]);

			Im::addMessage([
				'TO_CHAT_ID' => $this->chat['ID'],
				'MESSAGE' => Loc::getMessage($active? 'IMOL_CHAT_STEALTH_ON': 'IMOL_CHAT_STEALTH_OFF'),
				'SYSTEM' => 'Y',
			]);

			$result = true;
		}
	}

	return $result;
}