• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/classes/general/im_rest.php
  • Класс: CIMRestService
  • Вызов: CIMRestService::desktopPageOpen
static function desktopPageOpen($params, $n, CRestServer $server)
{
	$params = array_change_key_case($params, CASE_UPPER);

	if (CIMMessenger::GetDesktopVersion() === 0)
	{
		throw new BitrixRestRestException("Desktop was never installed", "NO_DESKTOP", CRestServer::STATUS_WRONG_REQUEST);
	}

	if (!CIMMessenger::CheckDesktopStatusOnline())
	{
		throw new BitrixRestRestException("Desktop is not online", "DESKTOP_CLOSED", CRestServer::STATUS_WRONG_REQUEST);
	}

	if (CModule::IncludeModule("pull"))
	{
		$userId = BitrixMainEngineCurrentUser::get()->getId();
		if (!$userId)
		{
			return false;
		}

		BitrixPullEvent::add($userId, [
			'module_id' => 'im',
			'command' => 'desktopOpenPage',
			'params' => [
				'url' => $params['URL']
			],
			'extra' => BitrixImCommon::getPullExtra()
		]);
	}

	return true;
}