• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/controller/documentservice.php
  • Класс: BitrixDiskControllerDocumentService
  • Вызов: DocumentService::restoreDocumentInteractionAction
public function restoreDocumentInteractionAction(DocumentOnlyOfficeModelsDocumentSession $documentSession)
{
	$currentUser = $this->getCurrentUser();
	if (!$currentUser)
	{
		$this->addError(new Error('Could not find current user.'));

		return null;
	}

	$sessionManager = new DocumentOnlyOfficeDocumentSessionManager();
	$sessionManager
		->setUserId($currentUser->getId())
		->setSessionType($documentSession->getType())
		->setSessionContext($documentSession->getContext())
		->setFile($documentSession->getFile())
		->setVersion($documentSession->getVersion())
	;

	if (!$sessionManager->lock())
	{
		$this->addError(new Error('Could not getting lock for the session.'));

		return null;
	}

	$forkedSession = $sessionManager->findOrCreateSession();
	if (!$forkedSession)
	{
		$this->addErrors($forkedSession->getErrors());

		return null;
	}
	$sessionManager->unlock();

	$content = $GLOBALS['APPLICATION']->includeComponent(
		'bitrix:ui.sidepanel.wrapper',
		'',
		[
			'RETURN_CONTENT' => true,
			'POPUP_COMPONENT_NAME' => 'bitrix:disk.file.editor-onlyoffice',
			'POPUP_COMPONENT_TEMPLATE_NAME' => '',
			'POPUP_COMPONENT_PARAMS' => [
				'DOCUMENT_SESSION' => $forkedSession,
				'SHOW_BUTTON_OPEN_NEW_WINDOW' => false,
			],
			'PLAIN_VIEW' => true,
			'IFRAME_MODE' => true,
			'PREVENT_LOADING_WITHOUT_IFRAME' => false,
			'USE_PADDING' => false,
		]
	);

	$response = new HttpResponse();
	$response->setContent($content);

	return $response;
}