[TASK] Re-work/simplify copyright header in PHP files - Part 9
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Classes / Controller / AbstractController.php
1 <?php
2 namespace TYPO3\CMS\Extensionmanager\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 * Abstract action controller.
18 *
19 * @author Susanne Moog <typo3@susannemoog.de>
20 */
21 class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
22
23 const TRIGGER_RefreshModuleMenu = 'refreshModuleMenu';
24
25 /**
26 * @var array
27 */
28 protected $triggerArguments = array(
29 self::TRIGGER_RefreshModuleMenu,
30 );
31
32 /**
33 * Resolve view and initialize the general view-variables extensionName,
34 * controllerName and actionName based on the request object
35 *
36 * @return \TYPO3\CMS\Fluid\View\TemplateView
37 */
38 protected function resolveView() {
39 $view = parent::resolveView();
40 $view->assignMultiple(array(
41 'extensionName' => $this->request->getControllerExtensionName(),
42 'controllerName' => $this->request->getControllerName(),
43 'actionName' => $this->request->getControllerActionName()
44 ));
45 return $view;
46 }
47
48 /**
49 * Translation shortcut
50 *
51 * @param $key
52 * @param NULL|array $arguments
53 * @return NULL|string
54 */
55 protected function translate($key, $arguments = NULL) {
56 return \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($key, 'extensionmanager', $arguments);
57 }
58
59 /**
60 * Handles trigger arguments, e.g. refreshing the module menu
61 * widget if an extension with backend modules has been enabled
62 * or disabled.
63 *
64 * @return void
65 */
66 protected function handleTriggerArguments() {
67 $triggers = array();
68
69 foreach ($this->triggerArguments as $triggerArgument) {
70 if ($this->request->hasArgument($triggerArgument)) {
71 $triggers[$triggerArgument] = $this->request->getArgument($triggerArgument);
72 }
73 }
74
75 $this->view->assign('triggers', $triggers);
76 }
77 }