1 | <?php |
||
2 | namespace EWW\Dpf\Controller; |
||
3 | |||
4 | /* |
||
5 | * This file is part of the TYPO3 CMS project. |
||
6 | * |
||
7 | * It is free software; you can redistribute it and/or modify it under |
||
8 | * the terms of the GNU General Public License, either version 2 |
||
9 | * of the License, or any later version. |
||
10 | * |
||
11 | * For the full copyright and license information, please read the |
||
12 | * LICENSE.txt file that was distributed with this source code. |
||
13 | * |
||
14 | * The TYPO3 project - inspiring people to share! |
||
15 | */ |
||
16 | |||
17 | use EWW\Dpf\Domain\Model\FrontendUser; |
||
18 | use TYPO3\CMS\Extbase\Utility\LocalizationUtility; |
||
19 | |||
20 | /** |
||
21 | * Controller for the "workspace"/"my publications" area. |
||
22 | */ |
||
23 | class UserController extends AbstractController |
||
24 | { |
||
25 | /** |
||
26 | * benutzerRepository |
||
27 | * |
||
28 | * @var EWW\Dpf\Domain\Repository\FrontendUserRepository |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
29 | * @TYPO3\CMS\Extbase\Annotation\Inject |
||
30 | */ |
||
31 | protected $frontendUserRepository; |
||
32 | |||
33 | public function settingsAction() { |
||
34 | |||
35 | $currentUser = $this->frontendUserRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']); |
||
36 | |||
37 | $this->view->assign('frontendUser', $currentUser); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @param FrontendUser $frontendUser |
||
42 | * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException |
||
43 | */ |
||
44 | public function saveSettingsAction(FrontendUser $frontendUser) { |
||
45 | if ($frontendUser->getFisPersId()) { |
||
46 | $fisUserService = new \EWW\Dpf\Services\FeUser\FisDataService(); |
||
47 | $fisUserData = $fisUserService->getPersonData($frontendUser->getFisPersId()); |
||
48 | if ($fisUserData == NULL) { |
||
49 | $frontendUser->setFisPersId(""); |
||
50 | $severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::WARNING; |
||
51 | $this->addFlashMessage( |
||
52 | LocalizationUtility::translate("manager.locallang.user.settings.message.invalidFisId", "dpf"), |
||
53 | '', |
||
54 | $severity,false |
||
55 | ); |
||
56 | } |
||
57 | } |
||
58 | |||
59 | $this->frontendUserRepository->update($frontendUser); |
||
60 | $severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::OK; |
||
61 | $this->addFlashMessage( |
||
62 | LocalizationUtility::translate("manager.locallang.user.settings.message.successfullySaved", "dpf"), |
||
63 | '', |
||
64 | $severity,false |
||
65 | ); |
||
66 | |||
67 | $this->forward('settings'); |
||
68 | } |
||
69 | } |
||
70 |