• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/controller/documentservice.php
  • Класс: BitrixDiskControllerDocumentService
  • Вызов: DocumentService::viewDocumentAction
public function viewDocumentAction(DocumentOnlyOfficeModelsDocumentSession $documentSession): HttpResponse
{
	$currentUser = $this->getCurrentUser();
	if ($documentSession->isOutdatedByFileContent())
	{
		$forkedSession = $documentSession->cloneWithNewHash($currentUser->getId());
		/** @see BitrixDiskControllerDocumentService::viewDocumentAction() */
		$viewUri = $this->getActionUri('viewDocument', ['documentSessionId' => $forkedSession->getId()]);

		return $this->redirectTo($viewUri);
	}

	if (!$documentSession->belongsToUser($currentUser->getId()))
	{
		//we already checked rights in filter DocumentSessionCheck and acccess to the type of document session.
		$forkedSession = $documentSession->forkForUser($currentUser->getId(), $documentSession->getContext());
		if ($forkedSession)
		{
			/** @see BitrixDiskControllerDocumentService::viewDocumentAction() */
			$viewUri = $this->getActionUri('viewDocument', ['documentSessionId' => $forkedSession->getId()]);

			return $this->redirectTo($viewUri);
		}

		$this->addErrors($documentSession->getErrors());
		$response = new HttpResponse();
		$response->setContent(implode("n", $this->getErrors()));

		return $response;
	}

	$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' => $documentSession,
				'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;
}