/** * ViewController constructor. */ function __construct() { parent::__construct(); $this->cacheUtility = new CacheUtility('bwrk_resources_slider'); $this->pid = $GLOBALS['TSFE']->id; $this->cacheIdentifier = $this->getCacheIdentifier(); }
/** * Initializes the module view. * * @param ViewInterface $view The view * @return void */ protected function initializeView(ViewInterface $view) { $extPath = $this->getRelativeExtensionPath() . 'Resources/Public/CSS/'; // Skip, if view is initialized in non-backend context if (!$view instanceof BackendTemplateView) { return; } parent::initializeView($view); if ($this->actionMethodName === 'indexAction') { $view->getModuleTemplate()->getPageRenderer()->addCssFile($extPath . 'fullcalendar.min.css'); $view->getModuleTemplate()->getPageRenderer()->addCssFile($extPath . 'scheduler.min.css'); $view->getModuleTemplate()->getPageRenderer()->addCssFile($extPath . 'index.css'); $view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Sessions/Contrib/fullcalendar'); $view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Sessions/Contrib/scheduler'); $view->getModuleTemplate()->getPageRenderer()->addRequireJsConfiguration(['paths' => ['sightglass' => $this->getRelativeExtensionPath() . 'Resources/Public/JavaScript/Contrib/sightglass'], 'shim' => ['TYPO3/CMS/Sessions/Contrib/scheduler' => ['deps' => ['TYPO3/CMS/Sessions/Contrib/fullcalendar']], 'TYPO3/CMS/Sessions/Contrib/rivets' => ['deps' => ['sightglass']]]]); } if ($this->actionMethodName === 'manageAction') { $view->getModuleTemplate()->getPageRenderer()->addCssFile($extPath . 'manage.css'); $view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Sessions/Contrib/uri-templates'); } if (!in_array($this->actionMethodName, $this->actionsWithoutMenu)) { $this->generateModuleMenu(); $this->generateModuleButtons(); } }
/** * Initializes the view before invoking an action method. * * Override this method to solve assign variables common for all actions * or prepare the view in another way before the action is called. * * @param \TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view The view to be initialized * @return void * @api */ protected function initializeView(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view) { $this->contentObject = $this->configurationManager->getContentObject(); $this->contentObjectData = $this->contentObject->data; $this->data['parent'] = $this->contentObjectData; $view->assign('data', $this->data); if ($this->settings['region']['htmlTag_langKey']) { $this->region = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('_', $this->settings['region']['htmlTag_langKey']); $this->region = $this->region[1]; } else { $this->region = $this->settings['region']['default']; } $view->assign('region', $this->region); parent::initializeView($view); if (count($this->settings['javascript']['load']) > 0) { foreach ($this->settings['javascript']['load'] as $key => $value) { if ($value['enable']) { $src = $value['src']; if ($key == 'googleMapsApi') { $src .= '&language=' . ($this->settings['region']['htmlTag_langKey'] ? $this->settings['region']['htmlTag_langKey'] : $this->settings['region']['default']); } if ($key == 'googleMapsApi' && '' != $this->settings['general']['google']['apikey']) { $src .= '&key=' . $this->settings['general']['google']['apikey']; } $this->response->addAdditionalHeaderData($this->wrapJavascriptFile($src)); } } } }
/** * Initializes the module view. * * @param ViewInterface $view The view * @return void * * @throws */ protected function initializeView(ViewInterface $view) { // Skip, if view is initialized in non-backend context if ($view instanceof TemplateView) { parent::initializeView($view); } }
/** * Calls the specified action method and passes the arguments. * * If the action returns a string, it is appended to the content in the * response object. If the action doesn't return anything and a valid * view exists, the view is rendered automatically. * * @return void * @api */ protected function callActionMethod() { parent::callActionMethod(); if (isset($this->feedFormats[$this->request->getFormat()])) { $this->sendHeaderAndFilename($this->feedFormats[$this->request->getFormat()], $this->request->getFormat()); } }
/** * Initialize the view * * @param ViewInterface $view The view * @return void */ public function initializeView(ViewInterface $view) { /** @var BackendTemplateView $view */ parent::initializeView($view); $this->registerDocheaderButtons(); $view->assign('copyright', BackendUtility::TYPO3_copyRightNotice()); }
/** * Set up the doc header properly here * * @param ViewInterface $view */ protected function initializeView(ViewInterface $view) { /** @var BackendTemplateView $view */ parent::initializeView($view); // Disable Path $view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation([]); }
/** * Adds the needed validators to the Arguments: * * - Validators checking the data type from the @param annotation * - Custom validators specified with validate annotations. * - Model-based validators (validate annotations in the model) * - Custom model validator classes * - Validators from framework configuration * * @return void */ protected function initializeActionMethodValidators() { parent::initializeActionMethodValidators(); $frameworkConfiguration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $actionArgumentValidation = !empty($frameworkConfiguration['mvc']['validation'][$this->request->getControllerName()][$this->request->getControllerActionName()]) ? $frameworkConfiguration['mvc']['validation'][$this->request->getControllerName()][$this->request->getControllerActionName()] : array(); // Dynamically add argument validators foreach ($actionArgumentValidation as $argumentName => $validators) { try { $argumentValidator = $this->arguments->getArgument($argumentName)->getValidator(); } catch (NoSuchArgumentException $e) { continue; } $validatorConjunction = $this->validatorResolver->createValidator('TYPO3.CMS.Extbase:Conjunction'); foreach ($validators as $validatorConfiguration) { if (isset($validatorConfiguration['type'])) { $validatorType = $validatorConfiguration['type']; $validatorOptions = isset($validatorConfiguration['options']) ? $validatorConfiguration['options'] : array(); $validator = $this->validatorResolver->createValidator($validatorType, $validatorOptions); $validatorConjunction->addValidator($validator); } } if (count($validatorConjunction)) { $argumentValidator->addValidator($validatorConjunction); } } }
/** * Call a sub-module's controller * */ protected function invokeModuleController() { $activeModuleDescription = $this->moduleManager->getModuleDescription($this->activeModuleName); $request = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request'); /* @var Request $request */ $request->setControllerExtensionName(ucfirst($activeModuleDescription['extensionKey'])); $request->setControllerName($activeModuleDescription['controller'] . 'Module'); $request->setControllerActionName('index'); if (!is_null($this->site)) { $request->setArgument('site', $this->site); } $request->setPluginName($this->request->getPluginName()); if ($this->request->hasArgument('moduleAction')) { // TODO check whether action is registered/allowed $request->setControllerActionName($this->request->getArgument('moduleAction')); } // transfer additional parameters foreach ($this->request->getArguments() as $argumentName => $argumentValue) { if (in_array($argumentName, array('module', 'moduleAction', 'controller'))) { // these have been transferred already continue; } $request->setArgument($argumentName, $argumentValue); } $response = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response'); /* @var Response $response */ while (!$request->isDispatched()) { try { $this->activeModule->processRequest($request, $response); } catch (StopActionException $ignoredException) { } } $this->view->assign('moduleContent', $response->getContent()); }
/** * Set up the doc header properly here * * @param ViewInterface $view */ protected function initializeView(ViewInterface $view) { if ($view instanceof BackendTemplateView) { /** @var BackendTemplateView $view */ parent::initializeView($view); $view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation([]); $uriBuilder = $this->objectManager->get(UriBuilder::class); $uriBuilder->setRequest($this->request); $this->view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Documentation/Main'); $menu = $this->view->getModuleTemplate()->getDocHeaderComponent()->getMenuRegistry()->makeMenu(); $menu->setIdentifier('DocumentationModuleMenu'); $isListActive = $this->request->getControllerActionName() === 'list' ? true : false; $uri = $uriBuilder->reset()->uriFor('list', array(), 'Document'); $listMenuItem = $menu->makeMenuItem()->setTitle($this->getLanguageService()->sL('LLL:EXT:documentation/Resources/Private/Language/locallang.xlf:showDocumentation'))->setHref($uri)->setActive($isListActive); $menu->addMenuItem($listMenuItem); if ($this->getBackendUser()->isAdmin()) { $isDownloadActive = $this->request->getControllerActionName() === 'download' ? true : false; $uri = $uriBuilder->reset()->uriFor('download', array(), 'Document'); $downloadMenuItem = $menu->makeMenuItem()->setTitle($this->getLanguageService()->sL('LLL:EXT:documentation/Resources/Private/Language/locallang.xlf:downloadDocumentation'))->setHref($uri)->setActive($isDownloadActive); $menu->addMenuItem($downloadMenuItem); } $this->view->getModuleTemplate()->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu); $this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue()); } }
/** * @param string $messageBody * @param string $messageTitle * @param int $severity * @param bool $storeInSession */ public function addFlashMessage($messageBody, $messageTitle = '', $severity = AbstractMessage::OK, $storeInSession = true) { if (null === $this->controllerContext) { $this->controllerContext = $this->buildControllerContext(); } parent::addFlashMessage($messageBody, $messageTitle, $severity, $storeInSession); }
/** * Set up the doc header properly here * * @param ViewInterface $view */ protected function initializeView(ViewInterface $view) { /** @var BackendTemplateView $view */ parent::initializeView($view); // Disable Path $view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation([]); $view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/EqualHeight'); }
/** * Maps arguments delivered by the request object to the local controller arguments. * * @return void */ protected function mapRequestArgumentsToControllerArguments() { try { parent::mapRequestArgumentsToControllerArguments(); } catch (\Exception $e) { $this->throwStatus(404, null, ucfirst($this->resourceArgumentName) . ' not found.'); } }
/** * Initializes the view before invoking an action method. * Override this method to solve assign variables common for all actions * or prepare the view in another way before the action is called. * * @param \TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view The view to be initialized * @return void */ protected function initializeView(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view) { $cObjData = $this->configurationManager->getContentObject()->data; $view->assign('newsItem', $cObjData); //$view->assign('contentObjectData', $this->configurationManager->getContentObject()->data); $view->assign('emConfiguration', EmConfiguration::getSettings()); parent::initializeView($view); }
public function __construct() { parent::__construct(); $GLOBALS['LANG']->includeLLFile('EXT:viewpage/Resources/Private/Language/locallang.xlf'); $this->pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer(); $this->pageRenderer->addInlineSettingArray('web_view', array('States' => $GLOBALS['BE_USER']->uc['moduleData']['web_view']['States'])); $this->pageRenderer->addInlineLanguageLabelFile('EXT:viewpage/Resources/Private/Language/locallang.xlf'); }
public function initializeAction() { parent::initializeAction(); $this->userSession = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Bjr\\BjrLend\\Utility\\UserSession'); $this->basketRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Bjr\\BjrLend\\Domain\\Repository\\BasketRepository'); $this->articleRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Bjr\\BjrLend\\Domain\\Repository\\ArticleRepository'); $this->orderRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Bjr\\BjrLend\\Domain\\Repository\\OrderRepository'); }
/** * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request * @param \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response * @throws \RuntimeException */ public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) { try { parent::processRequest($request, $response); } catch (\TYPO3\CMS\Extbase\Property\Exception $exception) { throw new \RuntimeException($this->getRuntimeIdentifier() . ': ' . $exception->getMessage() . ' (' . $exception->getCode() . ')'); } }
/** * Initialize the view * * @param ViewInterface $view The view * * @return void */ protected function initializeView(ViewInterface $view) { /** @var BackendTemplateView $view */ parent::initializeView($view); $view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation([]); $this->generateMenu(); $this->generateButtons(); }
/** * @param RequestInterface $request * @param ResponseInterface $response * @throws \Exception */ public function processRequest(RequestInterface $request, ResponseInterface $response) { try { parent::processRequest($request, $response); } catch (\Exception $exception) { $this->handleKnownExceptionsElseThrowAgain($exception); } }
/** * CacheUtility constructor. */ public function __construct() { parent::__construct(); $this->_extKey = GeneralUtility::camelCaseToLowerCaseUnderscored($this->extensionName); $this->_request = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Mvc\\Request'); $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); $this->_configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager'); }
/** * Set up the doc header properly here * * @param ViewInterface $view * @return void */ protected function initializeView(ViewInterface $view) { /** @var BackendTemplateView $view */ parent::initializeView($view); if ($this->actionMethodName == 'indexAction' || $this->actionMethodName == 'onlineAction' || $this->actionMethodName == 'compareAction') { $this->generateMenu(); $this->registerDocheaderButtons(); } }
/** * Processes a general request. The result can be returned by altering the given response. * * @param RequestInterface $request The request object * @param ResponseInterface $response The response, modified by this handler */ public function processRequest(RequestInterface $request, ResponseInterface $response) { $GLOBALS['SOBE'] = new \stdClass(); $GLOBALS['SOBE']->doc = $this->documentTemplate; parent::processRequest($request, $response); $pageHeader = $this->documentTemplate->startpage($this->languageService->sL('LLL:EXT:typo3_forum/Resources/Private/Language/locallang_mod.xml:module.title')); $pageEnd = $this->documentTemplate->endPage(); $response->setContent($pageHeader . $response->getContent() . $pageEnd); }
/** * Set up the doc header properly here * * @param ViewInterface $view * @return void */ protected function initializeView(ViewInterface $view) { /** @var BackendTemplateView $view */ parent::initializeView($view); if ($this->actionMethodName == 'indexAction' || $this->actionMethodName == 'onlineAction' || $this->actionMethodName == 'compareAction') { $this->generateMenu(); $this->registerDocheaderButtons(); $this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue()); } }
/** * initialize the controller * * @return void */ protected function initializeAction() { parent::initializeAction(); //fallback to current pid if no storagePid is defined $configuration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); if (empty($configuration['persistence']['storagePid'])) { $currentPid['persistence']['storagePid'] = $GLOBALS["TSFE"]->id; $this->configurationManager->setConfiguration(array_merge($configuration, $currentPid)); } }
/** * action initialize * * @see TYPO3\CMS\Extbase\Mvc\Controller.ActionController::initializeAction() */ public function initializeAction() { parent::initializeAction(); $this->config = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); $this->cacheService->clearPageCache(array($GLOBALS["TSFE"]->id)); // clear cache //$GLOBALS['TSFE']->additionalHeaderData['extCss1'] = '<link rel="stylesheet" type="text/css" href="typo3conf/ext/ajax_data/Resources/Public/Css/AjaxData.css">'; $GLOBALS['TSFE']->additionalHeaderData['extJs1'] = '<script src="typo3conf/ext/ajax_data/Resources/Public/Js/jquery-1.7.2.min.js" type="text/javascript"></script>'; $GLOBALS['TSFE']->additionalHeaderData['extJs2'] = '<script src="typo3conf/ext/ajax_data/Resources/Public/Js/AjaxData.js" type="text/javascript"></script>'; }
/** * Processes a general request. The result can be returned by altering the given response. * * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request The request object * @param \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response The response, modified by this handler * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException if the controller doesn't support the current request type * @return void */ public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) { $this->template = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->pageRenderer = $this->template->getPageRenderer(); $GLOBALS['SOBE'] = new \stdClass(); $GLOBALS['SOBE']->doc = $this->template; parent::processRequest($request, $response); $pageHeader = $this->template->startpage($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:module.title')); $pageEnd = $this->template->endPage(); $response->setContent($pageHeader . $response->getContent() . $pageEnd); }
/** * Initialize Actions */ protected function initializeAction() { parent::initializeAction(); $this->cacheUtility = new CacheUtility('bwrk_fluidmenu'); $this->pid = $GLOBALS['TSFE']->id; $this->menuType = isset($this->settings['menuType']) ? $this->settings['menuType'] : 'Default'; $this->showLevels = isset($this->settings['showLevels']) && !empty($this->settings['showLevels']) ? $this->settings['showLevels'] : 50; $this->entryLevel = $this->settings['entryLevel']; $this->pagesToExclude = $this->settings['pagesToExclude']; $this->rootPageId = $this->getRecursiveRootpageId($this->pid); }
/** * Load and persist module data * * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request * @param \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response * @return void * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException */ public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) { $this->moduleData = $this->moduleDataStorageService->loadModuleData(); // We "finally" persist the module data. try { parent::processRequest($request, $response); $this->moduleDataStorageService->persistModuleData($this->moduleData); } catch (\TYPO3\CMS\Extbase\Mvc\Exception\StopActionException $e) { $this->moduleDataStorageService->persistModuleData($this->moduleData); throw $e; } }
/** * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request * @param \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response * @return void * @throws \Exception * @override \TYPO3\CMS\Extbase\Mvc\Controller\ActionController * @see http://nerdcenter.de/extbase-fehlerbehandlung/ */ public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) { try { parent::processRequest($request, $response); } catch (PropertyException $exception) { // If the property mapper did throw a \TYPO3\CMS\Extbase\Property\Exception, because it was unable to find the requested entity, call the page-not-found handler. $previousException = $exception->getPrevious(); if ($previousException instanceof PropertyTargetNotFoundException || $previousException instanceof PropertyInvalidSourceException) { $GLOBALS['TSFE']->pageNotFoundAndExit($this->entityNotFoundMessage); } throw $exception; } }
/** * Load and persist module data * * @param RequestInterface $request * @param ResponseInterface $response * * @throws StopActionException * @return void */ public function processRequest(RequestInterface $request, ResponseInterface $response) { /* @var $persistenceManager \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager */ $persistenceManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager'); // We "finally" persist the module data. try { parent::processRequest($request, $response); $persistenceManager->persistAll(); } catch (StopActionException $e) { $persistenceManager->persistAll(); throw $e; } }