3434use In2code \Lux \Exception \AuthenticationException ;
3535use In2code \Lux \Utility \BackendUtility ;
3636use In2code \Lux \Utility \LocalizationUtility ;
37- use In2code \Lux \Utility \ObjectUtility ;
3837use Psr \Http \Message \ResponseInterface ;
3938use Psr \Http \Message \ServerRequestInterface ;
4039use Psr \Http \Message \StreamInterface ;
4140use TYPO3 \CMS \Core \Http \JsonResponse ;
4241use TYPO3 \CMS \Core \Utility \GeneralUtility ;
42+ use TYPO3 \CMS \Core \View \ViewFactoryData ;
4343use TYPO3 \CMS \Extbase \Http \ForwardResponse ;
4444use TYPO3 \CMS \Extbase \Mvc \Exception \NoSuchArgumentException ;
4545use TYPO3 \CMS \Extbase \Persistence \Exception \IllegalObjectTypeException ;
@@ -539,19 +539,18 @@ public function detailAjaxPage(ServerRequestInterface $request): ResponseInterfa
539539 'Analysis ' ,
540540 ['searchterm ' => (string )$ request ->getQueryParams ()['page ' ], 'limit ' => 10 ]
541541 );
542- $ standaloneView = ObjectUtility:: getStandaloneView ();
543- $ standaloneView -> setTemplatePathAndFilename (GeneralUtility:: getFileAbsFileName (
544- 'EXT:lux/Resources/Private/Templates/Analysis/ContentDetailPageAjax.html '
542+ $ view = $ this -> viewFactory -> create ( new ViewFactoryData (
543+ templateRootPaths: [ ' EXT:lux/Resources/Private/Templates/ ' ],
544+ partialRootPaths: [ 'EXT:lux/Resources/Private/Partials/ ' ],
545545 ));
546- $ standaloneView ->setPartialRootPaths (['EXT:lux/Resources/Private/Partials/ ' ]);
547- $ standaloneView ->assignMultiple ([
546+ $ view ->assignMultiple ([
548547 'pagevisits ' => $ this ->pagevisitsRepository ->findByFilter ($ filter ),
549548 'numberOfVisitorsData ' => GeneralUtility::makeInstance (PagevisistsDataProvider::class, $ filter ),
550549 ]);
551550 $ response = GeneralUtility::makeInstance (JsonResponse::class);
552551 /** @var StreamInterface $stream */
553552 $ stream = $ response ->getBody ();
554- $ stream ->write (json_encode (['html ' => $ standaloneView ->render ()]));
553+ $ stream ->write (json_encode (['html ' => $ view ->render (' Analysis/ContentDetailPageAjax ' )]));
555554 return $ response ;
556555 }
557556
@@ -571,20 +570,19 @@ public function detailAjaxSource(ServerRequestInterface $request): ResponseInter
571570 'Analysis ' ,
572571 ['searchterm ' => (string )$ request ->getQueryParams ()['referrerDomain ' ], 'limit ' => 10 ]
573572 );
574- $ standaloneView = ObjectUtility:: getStandaloneView ();
575- $ standaloneView -> setTemplatePathAndFilename (GeneralUtility:: getFileAbsFileName (
576- 'EXT:lux/Resources/Private/Templates/Analysis/SourcesDetailAjax.html '
573+ $ view = $ this -> viewFactory -> create ( new ViewFactoryData (
574+ templateRootPaths: [ ' EXT:lux/Resources/Private/Templates/ ' ],
575+ partialRootPaths: [ 'EXT:lux/Resources/Private/Partials/ ' ],
577576 ));
578- $ standaloneView ->setPartialRootPaths (['EXT:lux/Resources/Private/Partials/ ' ]);
579- $ standaloneView ->assignMultiple ([
577+ $ view ->assignMultiple ([
580578 'filter ' => $ filter ,
581579 'pagevisits ' => $ this ->pagevisitsRepository ->findByReferrerDomain ($ filter ),
582580 'pagevisitsBySourceData ' => GeneralUtility::makeInstance (PagevisistsBySourceDataProvider::class, $ filter ),
583581 ]);
584582 $ response = GeneralUtility::makeInstance (JsonResponse::class);
585583 /** @var StreamInterface $stream */
586584 $ stream = $ response ->getBody ();
587- $ stream ->write (json_encode (['html ' => $ standaloneView ->render ()]));
585+ $ stream ->write (json_encode (['html ' => $ view ->render (' Analysis/SourcesDetailAjax ' )]));
588586 return $ response ;
589587 }
590588
@@ -606,20 +604,19 @@ public function detailNewsAjaxPage(ServerRequestInterface $request): ResponseInt
606604 );
607605 /** @var News $news */
608606 $ news = $ this ->newsRepository ->findByIdentifier ((int )$ request ->getQueryParams ()['news ' ]);
609- $ standaloneView = ObjectUtility:: getStandaloneView ();
610- $ standaloneView -> setTemplatePathAndFilename (GeneralUtility:: getFileAbsFileName (
611- 'EXT:lux/Resources/Private/Templates/Analysis/NewsDetailPageAjax.html '
607+ $ view = $ this -> viewFactory -> create ( new ViewFactoryData (
608+ templateRootPaths: [ ' EXT:lux/Resources/Private/Templates/ ' ],
609+ partialRootPaths: [ 'EXT:lux/Resources/Private/Partials/ ' ],
612610 ));
613- $ standaloneView ->setPartialRootPaths (['EXT:lux/Resources/Private/Partials/ ' ]);
614- $ standaloneView ->assignMultiple ([
611+ $ view ->assignMultiple ([
615612 'news ' => $ news ,
616613 'newsvisits ' => $ this ->newsvisitRepository ->findByFilter ($ filter ),
617614 'newsvisitsData ' => GeneralUtility::makeInstance (NewsvisistsDataProvider::class, $ filter ),
618615 ]);
619616 $ response = GeneralUtility::makeInstance (JsonResponse::class);
620617 /** @var StreamInterface $stream */
621618 $ stream = $ response ->getBody ();
622- $ stream ->write (json_encode (['html ' => $ standaloneView ->render ()]));
619+ $ stream ->write (json_encode (['html ' => $ view ->render (' Analysis/NewsDetailPageAjax ' )]));
623620 return $ response ;
624621 }
625622
@@ -645,25 +642,24 @@ public function detailUtmAjaxPage(ServerRequestInterface $request): ResponseInte
645642 */
646643 public function detailSearchAjaxPage (ServerRequestInterface $ request ): ResponseInterface
647644 {
648- $ standaloneView = ObjectUtility:: getStandaloneView ();
649- $ standaloneView -> setTemplatePathAndFilename (GeneralUtility:: getFileAbsFileName (
650- 'EXT:lux/Resources/Private/Templates/Analysis/SearchDetailPageAjax.html '
645+ $ view = $ this -> viewFactory -> create ( new ViewFactoryData (
646+ templateRootPaths: [ ' EXT:lux/Resources/Private/Templates/ ' ],
647+ partialRootPaths: [ 'EXT:lux/Resources/Private/Partials/ ' ],
651648 ));
652- $ standaloneView ->setPartialRootPaths (['EXT:lux/Resources/Private/Partials/ ' ]);
653649 $ filter = BackendUtility::getFilterFromSession (
654650 'search ' ,
655651 'Analysis ' ,
656652 ['searchterm ' => urldecode ($ request ->getQueryParams ()['searchterm ' ]), 'limit ' => 10 ]
657653 );
658- $ standaloneView ->assignMultiple ([
654+ $ view ->assignMultiple ([
659655 'searches ' => $ this ->searchRepository ->findByFilter ($ filter ),
660656 'searchterm ' => urldecode ($ request ->getQueryParams ()['searchterm ' ]),
661657 'searchData ' => GeneralUtility::makeInstance (SearchDataProvider::class, $ filter ),
662658 ]);
663659 $ response = GeneralUtility::makeInstance (JsonResponse::class);
664660 /** @var StreamInterface $stream */
665661 $ stream = $ response ->getBody ();
666- $ stream ->write (json_encode (['html ' => $ standaloneView ->render ()]));
662+ $ stream ->write (json_encode (['html ' => $ view ->render (' Analysis/SearchDetailPageAjax ' )]));
667663 return $ response ;
668664 }
669665
@@ -682,19 +678,18 @@ public function detailAjaxDownload(ServerRequestInterface $request): ResponseInt
682678 'Analysis ' ,
683679 ['href ' => (string )$ request ->getQueryParams ()['download ' ], 'limit ' => 10 ]
684680 );
685- $ standaloneView = ObjectUtility:: getStandaloneView ();
686- $ standaloneView -> setTemplatePathAndFilename (GeneralUtility:: getFileAbsFileName (
687- 'EXT:lux/Resources/Private/Templates/Analysis/ContentDetailDownloadAjax.html '
681+ $ view = $ this -> viewFactory -> create ( new ViewFactoryData (
682+ templateRootPaths: [ ' EXT:lux/Resources/Private/Templates/ ' ],
683+ partialRootPaths: [ 'EXT:lux/Resources/Private/Partials/ ' ],
688684 ));
689- $ standaloneView ->setPartialRootPaths (['EXT:lux/Resources/Private/Partials/ ' ]);
690- $ standaloneView ->assignMultiple ([
685+ $ view ->assignMultiple ([
691686 'downloads ' => $ this ->downloadRepository ->findByFilter ($ filter ),
692687 'numberOfDownloadsData ' => GeneralUtility::makeInstance (DownloadsDataProvider::class, $ filter ),
693688 ]);
694689 $ response = GeneralUtility::makeInstance (JsonResponse::class);
695690 /** @var StreamInterface $stream */
696691 $ stream = $ response ->getBody ();
697- $ stream ->write (json_encode (['html ' => $ standaloneView ->render ()]));
692+ $ stream ->write (json_encode (['html ' => $ view ->render (' Analysis/ContentDetailDownloadAjax ' )]));
698693 return $ response ;
699694 }
700695
@@ -711,19 +706,18 @@ public function detailAjaxLinklistener(ServerRequestInterface $request): Respons
711706 'Analysis ' ,
712707 ['searchterm ' => (string )$ request ->getQueryParams ()['linkListener ' ], 'limit ' => 10 ]
713708 );
714- $ standaloneView = ObjectUtility:: getStandaloneView ();
715- $ standaloneView -> setTemplatePathAndFilename (GeneralUtility:: getFileAbsFileName (
716- 'EXT:lux/Resources/Private/Templates/Analysis/LinkListenerAjax.html '
709+ $ view = $ this -> viewFactory -> create ( new ViewFactoryData (
710+ templateRootPaths: [ ' EXT:lux/Resources/Private/Templates/ ' ],
711+ partialRootPaths: [ 'EXT:lux/Resources/Private/Partials/ ' ],
717712 ));
718- $ standaloneView ->setPartialRootPaths (['EXT:lux/Resources/Private/Partials/ ' ]);
719- $ standaloneView ->assignMultiple ([
713+ $ view ->assignMultiple ([
720714 'linkclicks ' => $ this ->linkclickRepository ->findByFilter ($ filter ),
721715 'allLinkclickData ' => GeneralUtility::makeInstance (AllLinkclickDataProvider::class, $ filter ),
722716 ]);
723717 $ response = GeneralUtility::makeInstance (JsonResponse::class);
724718 /** @var StreamInterface $stream */
725719 $ stream = $ response ->getBody ();
726- $ stream ->write (json_encode (['html ' => $ standaloneView ->render ()]));
720+ $ stream ->write (json_encode (['html ' => $ view ->render (' Analysis/LinkListenerAjax ' )]));
727721 return $ response ;
728722 }
729723
0 commit comments