/** * Init * * @return void */ public function initializeAction() { $this->databaseConnection = $GLOBALS['TYPO3_DB']; $this->controllerContext = $this->buildControllerContext(); $this->user = $this->div->getCurrentUser(); $this->cObj = $this->configurationManager->getContentObject(); $this->pluginVariables = $this->request->getArguments(); $this->allConfig = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $this->config = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); $this->config = $this->config['plugin.']['tx_femanager.']['settings.']; $controllerName = strtolower($this->controllerContext->getRequest()->getControllerName()); $removeFromUserGroupSelection = $this->settings[$controllerName]['misc']['removeFromUserGroupSelection']; $this->allUserGroups = $this->userGroupRepository->findAllForFrontendSelection($removeFromUserGroupSelection); if (isset($this->arguments['user'])) { $this->arguments['user']->getPropertyMappingConfiguration()->forProperty('dateOfBirth')->setTypeConverterOption('TYPO3\\CMS\\Extbase\\Property\\TypeConverter\\DateTimeConverter', DateTimeConverter::CONFIGURATION_DATE_FORMAT, LocalizationUtility::translate('tx_femanager_domain_model_user.dateFormat', 'femanager')); } // check if ts is included if ($this->settings['_TypoScriptIncluded'] != 1 && !GeneralUtility::_GP('eID') && TYPO3_MODE !== 'BE') { $this->addFlashMessage(LocalizationUtility::translate('error_no_typoscript', 'femanager'), '', FlashMessage::ERROR); } // check if storage pid was set if (intval($this->allConfig['persistence']['storagePid']) === 0 && !GeneralUtility::_GP('eID') && TYPO3_MODE !== 'BE') { $this->addFlashMessage(LocalizationUtility::translate('error_no_storagepid', 'femanager'), '', FlashMessage::ERROR); } }
/** * Overwrite usergroups from user by flexform settings * * @param User $object * @param array $settings * @param string $controllerName * @return User $object */ public function overrideUserGroup($object, $settings, $controllerName = 'new') { if (empty($settings[$controllerName]['overrideUserGroup'])) { return $object; } // for each selected usergroup in the flexform $object->removeAllUsergroups(); foreach (GeneralUtility::trimExplode(',', $settings[$controllerName]['overrideUserGroup'], 1) as $usergroupUid) { $usergroup = $this->userGroupRepository->findByUid($usergroupUid); $object->addUsergroup($usergroup); } return $object; }