Skip to content

Commit

Permalink
Localize UIRequest service usage
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Fedurtsya <[email protected]>
  • Loading branch information
Sieg committed Jan 4, 2024
1 parent 45e61cd commit b40ae53
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Application/Controller/Admin/MediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
class MediaController extends AdminDetailsController
{
protected UIRequestInterface $request;
protected ?Media $mediaService = null;
protected ?ImageResourceInterface $imageResource = null;

Expand All @@ -36,8 +35,6 @@ public function init()
parent::init();
$this->setTemplateName('@ddoemedialibrary/dialog/ddoemedia');

$this->request = $this->getService(UIRequestInterface::class);

$this->mediaService = $this->getService(Media::class);
$this->mediaService->createDirs();

Expand All @@ -57,15 +54,17 @@ public function render()
{
$request = Registry::getRequest();

$uiRequest = $this->getService(UIRequestInterface::class);
$mediaRepository = $this->getService(MediaRepositoryInterface::class);
$this->addTplParam('iFileCount', $mediaRepository->getFolderMediaCount($this->request->getFolderId()));
$this->addTplParam('iFileCount', $mediaRepository->getFolderMediaCount($uiRequest->getFolderId()));

$this->addTplParam('sResourceUrl', $this->imageResource->getMediaUrl());
$this->addTplParam('sThumbsUrl', $this->imageResource->getThumbnailUrl());
$this->addTplParam('sFoldername', $this->imageResource->getFolderName());
$this->addTplParam('sFolderId', $this->imageResource->getFolderId());
$this->addTplParam('sTab', $request->getRequestEscapedParameter('tab'));
$this->addTplParam('request', $this->getService(UIRequestInterface::class));

$this->addTplParam('request', $uiRequest);

return parent::render();
}
Expand Down Expand Up @@ -233,9 +232,11 @@ public function movefile()
*/
public function moreFiles()
{
$uiRequest = $this->getService(UIRequestInterface::class);

$pageSize = 18;
$folderId = $this->request->getFolderId();
$listStartIndex = $this->request->getMediaListStartIndex();
$folderId = $uiRequest->getFolderId();
$listStartIndex = $uiRequest->getMediaListStartIndex();

$mediaRepository = $this->getService(MediaRepositoryInterface::class);
$folderMediaCount = $mediaRepository->getFolderMediaCount($folderId);
Expand Down

0 comments on commit b40ae53

Please sign in to comment.