‪TYPO3CMS  9.5
OpenDocumentController.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 use Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
24 
32 {
36  protected ‪$documents;
37 
41  protected ‪$toolbarItem;
42 
46  public function ‪__construct()
47  {
48  $this->documents = GeneralUtility::makeInstance(OpenDocumentService::class);
49  $this->toolbarItem = GeneralUtility::makeInstance(OpendocsToolbarItem::class);
50  }
51 
57  public function ‪renderMenu(): ResponseInterface
58  {
59  return new ‪HtmlResponse($this->toolbarItem->getDropDown());
60  }
61 
68  public function ‪closeDocument(ServerRequestInterface $request): ResponseInterface
69  {
70  $identifier = $request->getParsedBody()['md5sum'] ?? $request->getQueryParams()['md5sum'];
71 
72  if ($identifier) {
73  $this->documents->closeDocument($identifier);
74  }
75 
76  return $this->‪renderMenu();
77  }
78 }
‪TYPO3\CMS\Opendocs\Backend\ToolbarItems\OpendocsToolbarItem
Definition: OpendocsToolbarItem.php:31
‪TYPO3\CMS\Opendocs\Controller\OpenDocumentController\closeDocument
‪ResponseInterface closeDocument(ServerRequestInterface $request)
Definition: OpenDocumentController.php:66
‪TYPO3\CMS\Opendocs\Controller\OpenDocumentController\__construct
‪__construct()
Definition: OpenDocumentController.php:44
‪TYPO3\CMS\Opendocs\Controller\OpenDocumentController\$toolbarItem
‪OpendocsToolbarItem $toolbarItem
Definition: OpenDocumentController.php:39
‪TYPO3\CMS\Opendocs\Controller\OpenDocumentController\renderMenu
‪ResponseInterface renderMenu()
Definition: OpenDocumentController.php:55
‪TYPO3\CMS\Opendocs\Controller\OpenDocumentController\$documents
‪OpenDocumentService $documents
Definition: OpenDocumentController.php:35
‪TYPO3\CMS\Opendocs\Service\OpenDocumentService
Definition: OpenDocumentService.php:25
‪TYPO3\CMS\Opendocs\Controller\OpenDocumentController
Definition: OpenDocumentController.php:32
‪TYPO3\CMS\Opendocs\Controller
Definition: OpenDocumentController.php:3
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Http\HtmlResponse
Definition: HtmlResponse.php:25