‪TYPO3CMS  9.5
NoteController.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 
21 
28 {
32  protected ‪$notesRepository;
33 
34  public function ‪__construct()
35  {
36  $this->notesRepository = GeneralUtility::makeInstance(SysNoteRepository::class);
37  }
38 
46  public function ‪listAction($pids, int $position = null): string
47  {
48  if (empty($pids) || empty(‪$GLOBALS['BE_USER']->user['uid'])) {
49  return '';
50  }
51 
52  $notes = $this->notesRepository->findByPidsAndAuthorId($pids, (int)‪$GLOBALS['BE_USER']->user['uid'], $position);
53  if ($notes) {
54  $view = GeneralUtility::makeInstance(StandaloneView::class);
55  $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
56  'EXT:sys_note/Resources/Private/Templates/Note/List.html'
57  ));
58  $view->setLayoutRootPaths(['EXT:sys_note/Resources/Private/Layouts']);
59  $view->getRequest()->setControllerExtensionName('SysNote');
60  $view->assign('notes', $notes);
61  return $view->render();
62  }
63 
64  return '';
65  }
66 }
‪TYPO3\CMS\SysNote\Controller\NoteController
Definition: NoteController.php:28
‪TYPO3\CMS\SysNote\Controller\NoteController\listAction
‪string listAction($pids, int $position=null)
Definition: NoteController.php:45
‪TYPO3\CMS\SysNote\Controller\NoteController\$notesRepository
‪SysNoteRepository $notesRepository
Definition: NoteController.php:31
‪TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository
Definition: SysNoteRepository.php:28
‪TYPO3\CMS\SysNote\Controller\NoteController\__construct
‪__construct()
Definition: NoteController.php:33
‪TYPO3\CMS\SysNote\Controller
Definition: NoteController.php:3
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:32
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45