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