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

	if($this->isDataLoaded())
	{
		$session = new Session();
		$session->setChat($this);

		$resultLoad = $session->load(Array(
			'USER_CODE' => $this->chat['ENTITY_ID'],
			'SKIP_CREATE' => 'Y'
		));
		if ($resultLoad)
		{
			if($this->validationAction($session->getData('CHAT_ID')))
			{
				$eventData = array(
					'RUNTIME_SESSION' => $session,
					'USER_ID' => $userId,
				);
				$event = new Event("imopenlines", "OnChatSkip", $eventData);
				$event->send();

				if ($userId)
				{
					$userSkip = User::getInstance($userId);

					Im::addMessage(Array(
						"FROM_USER_ID" => $userId,
						"TO_CHAT_ID" => $this->chat['ID'],
						"MESSAGE" => Loc::getMessage('IMOL_CHAT_SKIP_'.$userSkip->getGender(), Array('#USER#' => '[USER='.$userSkip->getId().'][/USER]')),
						"SYSTEM" => 'Y',
					));
				}

				$result = $session->transferToNextInQueue();
			}
		}
		else
		{
			if ($userId > 0)
			{
				$chat = new CIMChat();
				$chat->DeleteUser($this->chat['ID'], $userId, false);
			}
		}
	}

	return $result;
}